From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A2A9A3858D3C; Fri, 26 May 2023 11:57:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2A9A3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685102276; bh=GWiqiWcGaC9G6ekEJYOCfMH/+bYvIAWnnLurCpvY4UQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=boSL7JHpZw0wCr7/KNJe4hC6ivspiwCxi8S8zEDvyoUcYautkWksDXX3Dk/FUlkg1 0i58640L7QhrM5Hh2uQfszMYz9j8lr/62DyoVQU1qJtKVVee2HtL7MbBOuAlTOZQ+q snA/usGG4aRos8ap3inQ6KRm6eZVWLXhwbjJBqFg= From: "vanyacpp at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109986] missing fold (~a | b) ^ a => ~(a & b) Date: Fri, 26 May 2023 11:57:56 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vanyacpp at gmail dot com 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109986 --- Comment #1 from Ivan Sorokin --- (In reply to Ivan Sorokin from comment #0) > int foo(int a, int b) > { > return (~a | b) ^ a; > } >=20 > This can be optimized to `return ~(a | b);`. This transformation is done = by > LLVM, but not by GCC. Correction: it can be optimized to `return ~(a & b);`.=