From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E96E738418A8; Sun, 10 Jul 2022 20:29:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E96E738418A8 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106243] Failure to optimize (0 - x) & 1 on gimple level (including vector types) Date: Sun, 10 Jul 2022 20:29:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW 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: short_desc everconfirmed cf_reconfirmed_on bug_status 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: Sun, 10 Jul 2022 20:29:21 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106243 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Failure to optimize (0 - x) |Failure to optimize (0 - x) |& 1 on vector type |& 1 on gimple level | |(including vector types) Ever confirmed|0 |1 Last reconfirmed| |2022-07-10 Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski --- Confirmed, even scalar version is not optimized on the gimple level: int f1(int x) { x =3D -x; return x & 1; } RTL level is done during combine for the scalar version: Trying 6 -> 7: 6: {r86:SI=3D-r87:SI;clobber flags:CC;} REG_DEAD r87:SI REG_UNUSED flags:CC 7: {r85:SI=3Dr86:SI&0x1;clobber flags:CC;} REG_DEAD r86:SI REG_UNUSED flags:CC Successfully matched this instruction: (parallel [ (set (reg:SI 85) (and:SI (reg:SI 87) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ])=