From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3BE7B3858D3C; Thu, 5 Oct 2023 04:15:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BE7B3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696479301; bh=2IbmqCieAjufqlyjMYBFqvCAlKwCXFEj6+TOr2sbIV4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VY6sguvu6Sfa6jlEZ9Bl2Xq6fCDSTs7kkMzEWKoryDiuLqWJhXEhHX1zYeoWQupO6 6/Xnc1LV9R9S6RA2SpipRib9i0/VEoqa8kYNhvKKg4GqRLKGNysuQ/OTAemU/tvzC2 7FNzkR0M4CRhiEdrShjT1n/J6Z8BB2bBjGTxShqg= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111679] `(~a) | (a ^ b)` is not simplified to `~(a & b)` Date: Thu, 05 Oct 2023 04:15:00 +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 X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia 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=3D111679 --- Comment #1 from Andrew Pinski --- ``` /* (~a) | (a ^ b) --> (~a) | (~b) (which might be done into ~(a & b) depending on if ~a is not a cmp) */ (simplify (bit_ior:c @0 (bit_xor:c @1 @2)) (with { bool wascmp; } (if (bitwise_inverted_equal_p (@0, @1, wascmp) && (!wascmp || element_precision (type) =3D=3D 1)) (bit_ior @0 (bit_not @2))))) ``` Still need some testcases.=