public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/105927] New: ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse
@ 2022-06-11 19:50 zsojka at seznam dot cz
  2022-06-12 19:37 ` [Bug target/105927] " ubizjak at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2022-06-11 19:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105927
           Summary: ICE: RTL check: expected code 'reg', have 'mem' in
                    rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 53120
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53120&action=edit
reduced testcase

Compiler output:
$ 
x86_64-pc-linux-gnu-gcc -O1 -fno-tree-dce -mtune=k6-3 -msse -m32 testcase.c 
during RTL pass: combine
testcase.c: In function 'foo':
testcase.c:14:1: internal compiler error: RTL check: expected code 'reg', have
'mem' in rhs_regno, at rtl.h:1932
   14 | }
      | ^
0x772c50 rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int,
char const*)
        /repo/gcc-trunk/gcc/rtl.cc:916
0xac528d rhs_regno
        /repo/gcc-trunk/gcc/rtl.h:1932
0xac6013 rhs_regno
        /repo/gcc-trunk/gcc/config/i386/predicates.md:699
0xac6013 register_no_elim_operand_1
        /repo/gcc-trunk/gcc/config/i386/predicates.md:677
0xac6013 register_no_elim_operand(rtx_def*, machine_mode)
        /repo/gcc-trunk/gcc/config/i386/predicates.md:685
0xac6013 nonmemory_no_elim_operand(rtx_def*, machine_mode)
        /repo/gcc-trunk/gcc/config/i386/predicates.md:710
0x2041a01 recog_9
        /repo/gcc-trunk/gcc/config/i386/i386.md:3675
0x225d3ca recog_14
        /repo/gcc-trunk/gcc/config/i386/i386.md:1086
0x22dd73d recog_330
        /repo/gcc-trunk/gcc/config/i386/sse.md:28926
0x2307381 recog_for_combine_1
        /repo/gcc-trunk/gcc/combine.cc:11352
0x230e42e recog_for_combine
        /repo/gcc-trunk/gcc/combine.cc:11622
0x2320776 try_combine
        /repo/gcc-trunk/gcc/combine.cc:3543
0x2328674 combine_instructions
        /repo/gcc-trunk/gcc/combine.cc:1287
0x2328674 rest_of_handle_combine
        /repo/gcc-trunk/gcc/combine.cc:14976
0x2328674 execute
        /repo/gcc-trunk/gcc/combine.cc:15021
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-1049-20220611004016-gfddb7f65129-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r13-1049-20220611004016-gfddb7f65129-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220611 (experimental) (GCC)

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

* [Bug target/105927] ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse
  2022-06-11 19:50 [Bug target/105927] New: ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse zsojka at seznam dot cz
@ 2022-06-12 19:37 ` ubizjak at gmail dot com
  2022-06-12 20:33 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2022-06-12 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-06-12

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
combine pass is creating:

#12 0x0000000002306b0f in recog_for_combine (pnewpat=0x7fffffffd5e0,
insn=0x7fffea12f940, pnotes=0x7fffffffd630)
    at /home/uros/git/gcc/gcc/combine.cc:11622
11622     int insn_code_number = recog_for_combine_1 (pnewpat, insn, pnotes);
(gdb) p debug_rtx (insn)
(insn 32 31 33 2 (set (mem:HF (pre_modify:SI (reg/f:SI 7 sp)
                (plus:SI (reg/f:SI 7 sp)
                    (const_int -4 [0xfffffffffffffffc]))) [0  S2 A8])
        (subreg:HF (mem/c:HI (const:SI (plus:SI (symbol_ref:SI ("u") [flags
0x2] <var_decl 0x7fffea127c60 u>)
                        (const_int 2 [0x2]))) [1 u+2 S2 A16]) 0))
"pr105927.c":13:3 138 {*pushhf}
     (nil))
$2 = void

and SUBREG of memory operand ICES through nonmemory_no_elim_operand predicate
in

(define_insn "*pushhf_rex64"
  [(set (match_operand:HF 0 "push_operand" "=X,X")
        (match_operand:HF 1 "nonmemory_no_elim_operand" "r,x"))]
  "TARGET_64BIT"

(-msse2 has to be used with RTL-checking configured compiler.)

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

* [Bug target/105927] ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse
  2022-06-11 19:50 [Bug target/105927] New: ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse zsojka at seznam dot cz
  2022-06-12 19:37 ` [Bug target/105927] " ubizjak at gmail dot com
@ 2022-06-12 20:33 ` ubizjak at gmail dot com
  2022-06-13 15:11 ` cvs-commit at gcc dot gnu.org
  2022-06-13 15:16 ` ubizjak at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2022-06-12 20:33 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com
             Status|NEW                         |ASSIGNED

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 848a79a8d16..128144f1050 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -672,6 +672,12 @@ (define_predicate "register_no_elim_operand"
 {
   if (SUBREG_P (op))
     op = SUBREG_REG (op);
+
+  /* Before reload, we can allow (SUBREG (MEM...)) as a register operand
+     because it is guaranteed to be reloaded into one.  */
+  if (MEM_P (op))
+    return true;
+
   return !(op == arg_pointer_rtx
           || op == frame_pointer_rtx
           || IN_RANGE (REGNO (op),

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

* [Bug target/105927] ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse
  2022-06-11 19:50 [Bug target/105927] New: ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse zsojka at seznam dot cz
  2022-06-12 19:37 ` [Bug target/105927] " ubizjak at gmail dot com
  2022-06-12 20:33 ` ubizjak at gmail dot com
@ 2022-06-13 15:11 ` cvs-commit at gcc dot gnu.org
  2022-06-13 15:16 ` ubizjak at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-13 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:

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

commit r13-1071-gb3dd7d8b48227d3489039ca66b6c0ea2da743255
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Mon Jun 13 17:08:18 2022 +0200

    i386: Return true for (SUBREG (MEM....)) in register_no_elim_operand
[PR105927]

    Under certain conditions register_operand predicate also allows
    subregs of memory operands.  When RTL checking is enabled, these
    will fail with REGNO (op).

    Allow subregs of memory operands, these are guaranteed
    to be reloaded to a register.

    2022-06-13  Uroš Bizjak  <ubizjak@gmail.com>

    gcc/ChangeLog:

            PR target/105927
            * config/i386/predicates.md (register_no_elim_operand):
            Return true for subreg of a memory operand.

    gcc/testsuite/ChangeLog:

            PR target/105927
            * gcc.target/i386/pr105927.c: New test.

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

* [Bug target/105927] ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse
  2022-06-11 19:50 [Bug target/105927] New: ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2022-06-13 15:11 ` cvs-commit at gcc dot gnu.org
@ 2022-06-13 15:16 ` ubizjak at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2022-06-13 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
Fixed.

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

end of thread, other threads:[~2022-06-13 15:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11 19:50 [Bug target/105927] New: ICE: RTL check: expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1932 with -mtune=k6-3 -msse zsojka at seznam dot cz
2022-06-12 19:37 ` [Bug target/105927] " ubizjak at gmail dot com
2022-06-12 20:33 ` ubizjak at gmail dot com
2022-06-13 15:11 ` cvs-commit at gcc dot gnu.org
2022-06-13 15:16 ` ubizjak at gmail dot com

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).