From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6FDBD3858004; Wed, 9 Aug 2023 19:22:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FDBD3858004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691608929; bh=E+CBo0kGI8zECrPpgYndydGnUU8zdskcXjF+sXkEmAk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yzcnt7HKs9ErPHpZdIRcQrM0Jm2kjy2dYQSdi3sspB/VokWbKBfCpaEFhlg2X06A7 92Gd4DgNlNhoWA30Wsp6x2i1ewvH4KuQcCj8yga0K2FC9BWigwGkdoRFxqMwSppVq2 IajwtQf3PPwg40rx/9KX/7ERHWaooTpY4vs47qrU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/100798] a?~t:t and (-(!!a))^t don't produce the same assembly code Date: Wed, 09 Aug 2023 19:22:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal 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=3D100798 --- Comment #4 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:7fb65f102851248bafa0815401d8bdcea6d7626c commit r14-3110-g7fb65f102851248bafa0815401d8bdcea6d7626c Author: Andrew Pinski Date: Mon Aug 7 10:47:09 2023 -0700 MATCH: [PR110937/PR100798] (a ? ~b : b) should be optimized to b ^ -(a) This adds a simple match pattern for this case. I noticed it a couple of different places. One while I was looking at code generation of a parser and also while I was looking at locations where bitwise_inverted_equal_p should be used more. Committed as approved after bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/110937 PR tree-optimization/100798 gcc/ChangeLog: * match.pd (`a ? ~b : b`): Handle this case. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/bool-14.c: New test. * gcc.dg/tree-ssa/bool-15.c: New test. * gcc.dg/tree-ssa/phi-opt-33.c: New test. * gcc.dg/tree-ssa/20030709-2.c: Update testcase so `a ? -1 : 0` is not used to hit the match pattern.=