public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/112494] ICE in ix86_cc_mode, at config/i386/i386.cc:16477
Date: Mon, 13 Nov 2023 10:51:13 +0000	[thread overview]
Message-ID: <bug-112494-4-Aofv8wg3ju@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112494-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
It looks to me that gcc_unreachable is problematic in SELECT_CC_MODE. We should
simply return CCmode for all unrecognised RTX:

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 2c80fd8ebf3..5b87361e2e1 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -16469,12 +16504,9 @@ ix86_cc_mode (enum rtx_code code, rtx op0, rtx op1)
        return CCNOmode;
       else
        return CCGCmode;
-      /* strcmp pattern do (use flags) and combine may ask us for proper
-        mode.  */
-    case USE:
-      return CCmode;
     default:
-      gcc_unreachable ();
+      /* CCmode should be used in all other cases.  */
+      return CCmode;
     }
 }


Using the above patch, we can also define cmpstrnqi_1 to what it really does:

@@ -22954,9 +22958,8 @@ (define_expand "cmpstrnqi_1"
                                     (const_int 0))
                  (compare:CC (match_operand 4 "memory_operand")
                              (match_operand 5 "memory_operand"))
-                 (const_int 0)))
+                 (reg:CC FLAGS_REG)))
              (use (match_operand:SI 3 "immediate_operand"))
-             (use (reg:CC FLAGS_REG))
              (clobber (match_operand 0 "register_operand"))
              (clobber (match_operand 1 "register_operand"))
              (clobber (match_dup 2))])]

  parent reply	other threads:[~2023-11-13 10:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12 14:25 [Bug c/112494] New: GCC: 14: internal compiler error: " 141242068 at smail dot nju.edu.cn
2023-11-12 20:57 ` [Bug rtl-optimization/112494] " ubizjak at gmail dot com
2023-11-12 21:12 ` [Bug rtl-optimization/112494] ICE " pinskia at gcc dot gnu.org
2023-11-13  7:57 ` pinskia at gcc dot gnu.org
2023-11-13  8:50 ` ubizjak at gmail dot com
2023-11-13  8:52 ` [Bug target/112494] " ubizjak at gmail dot com
2023-11-13  9:54 ` ubizjak at gmail dot com
2023-11-13  9:59 ` ubizjak at gmail dot com
2023-11-13 10:51 ` ubizjak at gmail dot com [this message]
2023-11-13 21:47 ` cvs-commit at gcc dot gnu.org
2023-11-28 15:57 ` cvs-commit at gcc dot gnu.org
2023-11-28 16:00 ` ubizjak at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112494-4-Aofv8wg3ju@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).