[Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b

2022-01-15 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Andrew Pinski  ---
.

[Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b

2022-01-13 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

--- Comment #6 from Hongtao.liu  ---
Fixed.

[Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b

2022-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

--- Comment #5 from CVS Commits  ---
The master branch has been updated by hongtao Liu :

https://gcc.gnu.org/g:b77e3b4e4589e56c01511fabdbaadb029cd47f5c

commit r12-6567-gb77e3b4e4589e56c01511fabdbaadb029cd47f5c
Author: liuhongt 
Date:   Thu Jan 13 22:51:49 2022 +0800

Fix ICE of unrecognizable insn. [PR target/104001]

For define_insn_and_split "*xor2andn":

1. Refine predicate of operands[0] from nonimmediate_operand to
register_operand.
2. Remove TARGET_AVX512BW from condition to avoid kmov when TARGET_BMI
is not available.

gcc/ChangeLog:

PR target/104001
PR target/94790
PR target/104014
* config/i386/i386.md (*xor2andn): Refine predicate of
operands[0] from nonimmediate_operand to
register_operand, remove TARGET_AVX512BW from condition.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr104001.c: New test.

[Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b

2022-01-13 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

--- Comment #4 from Uroš Bizjak  ---
(In reply to Hongtao.liu from comment #2)
> I'm testing
> 
> 1 file changed, 3 insertions(+), 3 deletions(-)
> gcc/config/i386/i386.md | 6 +++---
> 
> modified   gcc/config/i386/i386.md
> @@ -10455,7 +10455,7 @@ (define_insn_and_split "*xordi_1_btc"
>  
>  ;; PR target/94790: Optimize a ^ ((a ^ b) & mask) to (~mask & a) | (b &
> mask)

Please remove the reference to the PR.

>  (define_insn_and_split "*xor2andn"
> -  [(set (match_operand:SWI248 0 "nonimmediate_operand")
> +  [(set (match_operand:SWI248 0 "register_operand")
>   (xor:SWI248
> (and:SWI248
>   (xor:SWI248
> @@ -10464,8 +10464,7 @@ (define_insn_and_split "*xor2andn"
>   (match_operand:SWI248 3 "nonimmediate_operand"))
> (match_dup 1)))
>  (clobber (reg:CC FLAGS_REG))]
> -  "(TARGET_BMI || TARGET_AVX512BW)
> -   && ix86_pre_reload_split ()"
> +  "TARGET_BMI && ix86_pre_reload_split ()"
>"#"
>"&& 1"
>[(parallel [(set (match_dup 4)
> @@ -10486,6 +10485,7 @@ (define_insn_and_split "*xor2andn"
> (clobber (reg:CC FLAGS_REG))])]
>  {
>operands[1] = force_reg (mode, operands[1]);
> +  operands[2] = force_reg (mode, operands[2]);

You don't need to force this operand to reg, "and" will accept memory operand.
But please swap (match_dup 2) and (match_dup 3) here:

+   (parallel [(set (match_dup 5)
+   (and:SWI248
+ (match_dup 2)
+ (match_dup 3)))
+ (clobber (reg:CC FLAGS_REG))])

This will ease RA job a bit.

The patch is pre-approved with the above changes.

>operands[3] = force_reg (mode, operands[3]);
>operands[4] = gen_reg_rtx (mode);
>operands[5] = gen_reg_rtx (mode);
> 
> [back]

[Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b

2022-01-13 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

David Binderman  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #3 from David Binderman  ---
Another very similar test case:

int Mpm_p_pTruth0, Mpm_p_pTruth1, Mpm_p_tC, Mpm_p_t;

void Mpm_p() {
  Mpm_p_t = Mpm_p_tC & Mpm_p_pTruth1 | ~Mpm_p_tC & Mpm_p_pTruth0;
}

goes wrong with -O1 and -march=bdver2.

[Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b

2022-01-13 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

--- Comment #2 from Hongtao.liu  ---
I'm testing

1 file changed, 3 insertions(+), 3 deletions(-)
gcc/config/i386/i386.md | 6 +++---

modified   gcc/config/i386/i386.md
@@ -10455,7 +10455,7 @@ (define_insn_and_split "*xordi_1_btc"

 ;; PR target/94790: Optimize a ^ ((a ^ b) & mask) to (~mask & a) | (b & mask)
 (define_insn_and_split "*xor2andn"
-  [(set (match_operand:SWI248 0 "nonimmediate_operand")
+  [(set (match_operand:SWI248 0 "register_operand")
(xor:SWI248
  (and:SWI248
(xor:SWI248
@@ -10464,8 +10464,7 @@ (define_insn_and_split "*xor2andn"
(match_operand:SWI248 3 "nonimmediate_operand"))
  (match_dup 1)))
 (clobber (reg:CC FLAGS_REG))]
-  "(TARGET_BMI || TARGET_AVX512BW)
-   && ix86_pre_reload_split ()"
+  "TARGET_BMI && ix86_pre_reload_split ()"
   "#"
   "&& 1"
   [(parallel [(set (match_dup 4)
@@ -10486,6 +10485,7 @@ (define_insn_and_split "*xor2andn"
  (clobber (reg:CC FLAGS_REG))])]
 {
   operands[1] = force_reg (mode, operands[1]);
+  operands[2] = force_reg (mode, operands[2]);
   operands[3] = force_reg (mode, operands[3]);
   operands[4] = gen_reg_rtx (mode);
   operands[5] = gen_reg_rtx (mode);

[back]

[Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b

2022-01-13 Thread zsojka at seznam dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

Zdenek Sojka  changed:

   What|Removed |Added

 CC||zsojka at seznam dot cz

--- Comment #1 from Zdenek Sojka  ---
Probably the same issue:

$ cat testcase.C
int b, c, d;
int r;

void
foo ()
{
  r = ((b & ~d) | (c & d));
}
$ x86_64-pc-linux-gnu-gcc -O -mavx512bw testcase.c 
testcase.c: In function 'foo':
testcase.c:8:1: error: unrecognizable insn:
8 | }
  | ^
(insn 15 14 0 2 (parallel [
(set (mem/c:SI (symbol_ref:DI ("r") [flags 0x2] ) [1 r+0 S4 A32])
(ior:SI (reg:SI 92)
(reg:SI 93)))
(clobber (reg:CC 17 flags))
]) "testcase.c":7:17 -1
 (expr_list:REG_DEAD (reg:SI 93)
(expr_list:REG_DEAD (reg:SI 92)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil)
during RTL pass: ira
testcase.c:8:1: internal compiler error: in extract_insn, at recog.c:2769
0x764803 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
/repo/gcc-trunk/gcc/rtl-error.c:108
0x76487f _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
/repo/gcc-trunk/gcc/rtl-error.c:116
0x753518 extract_insn(rtx_insn*)
/repo/gcc-trunk/gcc/recog.c:2769
0x115b51f ira_remove_insn_scratches(rtx_insn*, bool, _IO_FILE*, rtx_def*
(*)(rtx_def*))
/repo/gcc-trunk/gcc/ira.c:5350
0x115e115 remove_scratches
/repo/gcc-trunk/gcc/ira.c:5394
0x115e115 ira
/repo/gcc-trunk/gcc/ira.c:5718
0x115e115 execute
/repo/gcc-trunk/gcc/ira.c:6077
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b

2022-01-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |12.0
   Priority|P3  |P1