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

Reply via email to