From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ECA023857808; Thu, 15 Oct 2020 14:00:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECA023857808 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/97437] builtins subcarry and addcarry still not generate the right code. Not get optimized to immediate value Date: Thu, 15 Oct 2020 14:00:48 +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: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2020 14:00:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97437 --- Comment #7 from Jakub Jelinek --- (In reply to Segher Boessenkool from comment #5) > Trying 7 -> 9: > 7: r97:SI=3D0x2a > 9: {flags:CCC=3Dcmp(r97:SI+r98:SI,r97:SI);r99:SI=3Dr97:SI+r98:SI;} > REG_DEAD r98:SI > REG_DEAD r97:SI > Failed to match this instruction: > (parallel [ > (set (reg:CC 17 flags) > (compare:CC (reg:SI 98 [ *b_12(D) ]) > (const_int -42 [0xffffffffffffffd6]))) > (set (reg:SI 99) > (plus:SI (reg:SI 98 [ *b_12(D) ]) > (const_int 42 [0x2a]))) > ]) >=20 > On rs6000 we have four special variants for the immediate add-with-carry > insn patterns: imm 0, imm -1, imm pos, imm neg. All of these have > different canonical RTL. The i386 backend has various patterns for that too, the problem is with that CCmode vs. CCCmode that was used originally here (otherwise sure, I can add more). These patterns ensure only CF is valid and so need to use CCCmode which ens= ures that users will only query CF flag and nothing else.=