public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
@ 2022-01-13  9:24 marxin at gcc dot gnu.org
  2022-01-13 10:17 ` [Bug target/104001] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-13  9:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

            Bug ID: 104001
           Summary: [12 Regression] ICE in extract_insn, at recog.c:2769
                    since
                    r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: haochen.jiang at intel dot com
  Target Milestone: ---

The following crashes:

$ cat math.ii
long select_mask, select_from0, select_from1, bigint_cnd_abs_x_0,
    bigint_cnd_abs_size___trans_tmp_1 =
        select_from0 & select_mask | select_from1 & ~select_mask;

$ g++ math.ii -c -march=znver1 -O2 -fmax-errors=1
math.ii: In function ‘(static initializers for math.ii)’:
math.ii:3:65: error: unrecognizable insn:
    3 |         select_from0 & select_mask | select_from1 & ~select_mask;
      |                                                                 ^
(insn 15 14 0 2 (parallel [
            (set (mem/c:DI (symbol_ref:DI ("bigint_cnd_abs_size___trans_tmp_1")
[flags 0x2] <var_decl 0x7ffff7fb7f30 bigint_cnd_abs_size___trans_tmp_1>) [1
bigint_cnd_abs_size___trans_tmp_1+0 S8 A64])
                (ior:DI (reg:DI 92)
                    (reg:DI 93)))
            (clobber (reg:CC 17 flags))
        ]) "math.ii":3:36 -1
     (expr_list:REG_DEAD (reg:DI 93)
        (expr_list:REG_DEAD (reg:DI 92)
            (expr_list:REG_UNUSED (reg:CC 17 flags)
                (nil)))))
during RTL pass: ira
math.ii:3:65: internal compiler error: in extract_insn, at recog.c:2769
0x218a6a8 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /home/marxin/Programming/gcc/gcc/rtl-error.c:108
0x218a6ca _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        /home/marxin/Programming/gcc/gcc/rtl-error.c:116
0x21584d3 extract_insn(rtx_insn*)
        /home/marxin/Programming/gcc/gcc/recog.c:2769
0x1f4bb13 ira_remove_insn_scratches(rtx_insn*, bool, _IO_FILE*, rtx_def*
(*)(rtx_def*))
        /home/marxin/Programming/gcc/gcc/ira.c:5350
0x1f4cd3e remove_scratches
        /home/marxin/Programming/gcc/gcc/ira.c:5394
0x1f4cd3e ira
        /home/marxin/Programming/gcc/gcc/ira.c:5718
0x1f4cd3e execute
        /home/marxin/Programming/gcc/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 <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
  2022-01-13  9:24 [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b marxin at gcc dot gnu.org
@ 2022-01-13 10:17 ` rguenth at gcc dot gnu.org
  2022-01-13 11:48 ` zsojka at seznam dot cz
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-13 10:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
           Priority|P3                          |P1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
  2022-01-13  9:24 [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b marxin at gcc dot gnu.org
  2022-01-13 10:17 ` [Bug target/104001] " rguenth at gcc dot gnu.org
@ 2022-01-13 11:48 ` zsojka at seznam dot cz
  2022-01-13 12:41 ` crazylht at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2022-01-13 11:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

Zdenek Sojka <zsojka at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zsojka at seznam dot cz

--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> ---
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] <var_decl
0x7fc1dea04e10 r>) [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 <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
  2022-01-13  9:24 [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b marxin at gcc dot gnu.org
  2022-01-13 10:17 ` [Bug target/104001] " rguenth at gcc dot gnu.org
  2022-01-13 11:48 ` zsojka at seznam dot cz
@ 2022-01-13 12:41 ` crazylht at gmail dot com
  2022-01-13 14:34 ` dcb314 at hotmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-01-13 12:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
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>mode, operands[1]);
+  operands[2] = force_reg (<MODE>mode, operands[2]);
   operands[3] = force_reg (<MODE>mode, operands[3]);
   operands[4] = gen_reg_rtx (<MODE>mode);
   operands[5] = gen_reg_rtx (<MODE>mode);

[back]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
  2022-01-13  9:24 [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-01-13 12:41 ` crazylht at gmail dot com
@ 2022-01-13 14:34 ` dcb314 at hotmail dot com
  2022-01-13 16:14 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2022-01-13 14:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dcb314 at hotmail dot com

--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
  2022-01-13  9:24 [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-01-13 14:34 ` dcb314 at hotmail dot com
@ 2022-01-13 16:14 ` ubizjak at gmail dot com
  2022-01-14  5:02 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2022-01-13 16:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(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>mode, operands[1]);
> +  operands[2] = force_reg (<MODE>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>mode, operands[3]);
>    operands[4] = gen_reg_rtx (<MODE>mode);
>    operands[5] = gen_reg_rtx (<MODE>mode);
> 
> [back]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
  2022-01-13  9:24 [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-01-13 16:14 ` ubizjak at gmail dot com
@ 2022-01-14  5:02 ` cvs-commit at gcc dot gnu.org
  2022-01-14  5:03 ` crazylht at gmail dot com
  2022-01-15  9:33 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-14  5:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:

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

commit r12-6567-gb77e3b4e4589e56c01511fabdbaadb029cd47f5c
Author: liuhongt <hongtao.liu@intel.com>
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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
  2022-01-13  9:24 [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-01-14  5:02 ` cvs-commit at gcc dot gnu.org
@ 2022-01-14  5:03 ` crazylht at gmail dot com
  2022-01-15  9:33 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2022-01-14  5:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/104001] [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b
  2022-01-13  9:24 [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-01-14  5:03 ` crazylht at gmail dot com
@ 2022-01-15  9:33 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-15  9:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104001

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-15  9:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13  9:24 [Bug target/104001] New: [12 Regression] ICE in extract_insn, at recog.c:2769 since r12-6538-g5f19303ada7db92c155332e7ba317233ca05946b marxin at gcc dot gnu.org
2022-01-13 10:17 ` [Bug target/104001] " rguenth at gcc dot gnu.org
2022-01-13 11:48 ` zsojka at seznam dot cz
2022-01-13 12:41 ` crazylht at gmail dot com
2022-01-13 14:34 ` dcb314 at hotmail dot com
2022-01-13 16:14 ` ubizjak at gmail dot com
2022-01-14  5:02 ` cvs-commit at gcc dot gnu.org
2022-01-14  5:03 ` crazylht at gmail dot com
2022-01-15  9:33 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).