From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 020E63858284; Wed, 11 Oct 2023 16:46:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 020E63858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697042812; bh=du09m9tESOUai/5pJIwxBeE1qC2PDIccOHR2aKkoH/c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=N2ZUTEnjvD68fpNybrIo/BOnO1aHBg8fRgJ4k4Q13hhxJX205lOtFWGjhTuii+BA+ 35Fq/gAky8H0+9f5QqP6hwnmyiAyiTTk9sACA9QLU9GD2C5Gdide9DF08TvjM8Zhnv oYh00cVrMmvMG++czhYfKugT2b4J2nIWfgzXZTfA= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111282] `a & (b ^ ~a)` (or `a & ~(a ^ b)`) not optimized to `a & b` in gimple Date: Wed, 11 Oct 2023 16:46:51 +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: 14.0 X-Bugzilla-Keywords: missed-optimization, patch X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111282 --- Comment #6 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:e8d418df3dc609f27487deece796d4aa69004b8c commit r14-4561-ge8d418df3dc609f27487deece796d4aa69004b8c Author: Andrew Pinski Date: Tue Oct 10 12:45:56 2023 -0700 MATCH: [PR111282] Simplify `a & (b ^ ~a)` to `a & b` While `a & (b ^ ~a)` is optimized to `a & b` on the rtl level, it is always good to optimize this at the gimple level and allows us to match a few extra things including where a is a comparison. Note I had to update/change the testcase and-1.c to avoid matching this case as we can match -2 and 1 as bitwise inversions. PR tree-optimization/111282 gcc/ChangeLog: * match.pd (`a & ~(a ^ b)`, `a & (a =3D=3D b)`, `a & ((~a) ^ b)`): New patterns. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/and-1.c: Update testcase to avoid matching `~1 & (a ^ 1)` simplification. * gcc.dg/tree-ssa/bitops-6.c: New test.=