From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9F860385381C; Thu, 13 Oct 2022 12:31:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F860385381C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665664297; bh=E8uXEOrEUEY1dO3Zz07RZhZ+8suHC+LlRuuKGvcodlw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bHTH9W2A6j496m1ZBFPPKSo0/XcINqWsMOhcSK+kY9R3azkYRCJY55XZVTMHhqcXA Di6+k3kSdSiiFLJGXxvbfpDI1S48A6aVgODWJV5SLvoftWombb6YphWyrQRGqbb2CC PYVIL0uPNl1fZACVDsBsTHa+y5Psx+/DWNFO1gvk= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/107172] [13 Regression] wrong code with "-O1 -ftree-vrp" on x86_64-linux-gnu since r13-1268-g8c99e307b20c502e Date: Thu, 13 Oct 2022 12:31:36 +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: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D107172 --- Comment #25 from Hongtao.liu --- (In reply to Uro=C5=A1 Bizjak from comment #24) > (In reply to Hongtao.liu from comment #23) > > looking at i386.c put_condition_code used by *setcc_qi, it looks like (= EQ > > (reg:CCCmode FLAG_REG) (const_int 0)) means get carry flag. > > Not (LTU: (REG:CCCmode FLAGS_REG) (const_int 0)). > > Now I got more confused. >=20 > CCCmode means that single flag is tested, it uses EQ and NE, so "c" and "= nc" > suffix is emitted. When CCmode is used, LTU/GEU operation on CCmode flags > reg produces "b" and "nb" suffix, which decodes to exactly the same assem= bly > as "c" and "nc" suffixes. >=20 > However, it looks that somewhere LTU/GEU is also generated with CCCmode > flags reg, and some fixup was introduced to put_condition_code to "fix" t= his > inconsistency. If LTU/GEU is valid only for CCmode, then the producers of > invalid RTX should be fixed. grep -e ltu -e geu *.md, it looks like most places use CCmode for LTU, only below cases use CCCmode, maybe we should use CCmode for all of those and "f= ix" put_condition_code? ------------cut CCCmode----------------------- i386.md: (ltu (reg:CCC FLAGS_REG) (const_int 0)) i386.md: (compare:CCC (neg:QI (geu:QI (reg:CC_CCC FLAGS_REG) (const_= int 0))) i386.md: (ltu:QI (reg:CC_CCC FLAGS_REG) (const_int 0)))= )] i386.md: (neg:SWI48 (ltu:SWI48 (reg:CCC FLAGS_REG) (const_int 0)))) i386.md: (neg:SWI (ltu:SWI (reg:CCC FLAGS_REG) (const_int 0))))]) ------------cut ends--------------------------- ------------cut CCmode--------------- i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) i386.md: (ltu: (reg:CC FLAGS_REG) (const_int 0= )) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int = 0)) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) i386.md: (ltu: (reg:CC FLAGS_REG) (const_int 0= )) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int = 0)) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0)) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) i386.md: (ltu: (reg:CC FLAGS_REG) (const_int 0= ))) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int = 0))) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) i386.md: (ltu: (reg:CC FLAGS_REG) (const_int 0= ))) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int = 0))) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))) i386.md: (ltu (reg:CC FLAGS_REG) (const_int 0)) i386.md: (ltu: (reg:CC FLAGS_REG) (const_int 0)) i386.md: (ltu: (reg:CC FLAGS_REG) (const_int 0)) i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int 0))] i386.md: (ltu:DWIH (reg:CC FLAGS_REG) (const_int = 0)) i386.md: (ltu: (reg:CC FLAGS_REG) (const_int 0))= ))) i386.md: (plus:DWIH (ltu:DWIH (reg:CC FLAGS_REG) (const= _int 0)) i386.md: (plus:SWI (ltu:SWI (reg:CC FLAGS_REG) (const_i= nt 0)) i386.md: (ltu:SWI (reg:CC FLAGS_REG) (const_= int 0))) i386.md: (plus:SWI (ltu:SWI (reg:CC FLAGS_REG) (const_int= 0)) i386.md: (ltu:SWI (reg:CC FLAGS_REG) (const_= int 0))) i386.md: (ltu:SWI (reg:CC FLAGS_REG) (const_= int 0))) i386.md: (plus:SWI (ltu:SWI (reg:CC FLAGS_REG) (const_i= nt 0)) i386.md: (ltu:SWI (reg:CC FLAGS_REG) (const_= int 0))) i386.md: (ltu:SWI (reg:CC FLAGS_REG) (const_int 0)))) i386.md: (ltu:SWI (reg:CC FLAGS_REG) (const_i= nt 0)) i386.md: (plus:DWIH (plus:DWIH (ltu:DWIH (reg:CC FLAGS_REG) (const= _int 0)) i386.md: (ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0)) i386.md: (ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0= ))) i386.md: (ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0)) i386.md: (if_then_else:SWI48 (ltu:SWI48 (reg:CC FLAGS_REG) (const_= int 0)) i386.md: (plus:DWIH (plus:DWIH (ltu:DWIH (reg:CC FLAGS_REG) (const= _int 0)) i386.md: (plus:DWIH (plus:DWIH (ltu:DWIH (reg:CC FLAGS_REG) (const= _int 0)) i386.md: (ltu:QI (reg:CC FLAGS_REG) (const_int 0))) i386.md: (ltu:QI (reg:CC FLAGS_REG) (const_int 0))) i386.md: (ltu:QI (reg:CC FLAGS_REG) (const_int 0))) i386.md: (neg:SWI48 (ltu:SWI48 (reg:CC FLAGS_REG) (const_int 0))))] i386.md: (neg:SWI (ltu:SWI (reg:CC FLAGS_REG) (const_int 0))))]) ------------cut ends-------------=