From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4BBDA388D3A8; Mon, 13 Nov 2023 10:51:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BBDA388D3A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699872674; bh=3Z4aGN3lonlnsSl3VPVvEX4IzJp/Rs5juXFW2s0tZGU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=v0H1lqvE5NCgEtOnYVNG33BXzVYAgmKEmxCCLat+hC22oBNyErBvSswsFPgXJ9OyH 3pFhiNdTqAwYaxikIRsP6MyEFNJOfOCCMQEVxOfasw2BU8JYNdJgJBQmje/8qcnGz5 NKps97F2RFdF0PDaw3i7o0c0Z0dwHcVi7zFQOmoo= From: "ubizjak at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ubizjak at gmail dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112494 --- Comment #7 from Uro=C5=A1 Bizjak --- It looks to me that gcc_unreachable is problematic in SELECT_CC_MODE. We sh= ould 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 doe= s: @@ -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))])]=