From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 665BB3858288; Tue, 17 Oct 2023 16:04:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 665BB3858288 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697558659; bh=Ti2CfxlqacaM0AN48qPgFS/uYMNOv5BgR/urvpK70jg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WfFTq10lSmT5a0kzkGzNTUK92c4AIzA0sDlZz/LNBf9B3QZdaTQpViPQbCk9D6g31 I+R1EvUScqO/QCWJy4YloQV3Fcm3QiCXFxzsRd1nakibtv9HWOJcAo9AmJBJb5xUdE 90byhbjOY7Z3+1A3tUCZKBOx3NkfUJPF7sTTy+zU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111432] `bool & (a|1)` is not optimized to just `bool` Date: Tue, 17 Oct 2023 16:04:19 +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=3D111432 --- Comment #3 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:b18d1cabe2f9cccc0cad697e1e0bfd2abebb85f9 commit r14-4686-gb18d1cabe2f9cccc0cad697e1e0bfd2abebb85f9 Author: Andrew Pinski Date: Fri Oct 13 13:27:18 2023 -0700 MATCH: [PR111432] Simplify `a & (x | CST)` to a when we know that (a & ~CST) =3D=3D 0 This adds the simplification `a & (x | CST)` to a when we know that `(a & ~CST) =3D=3D 0`. In a similar fashion as `a & CST` is handle. I looked into handling `a | (x & CST)` but that I don't see any decent simplifications happening. OK? Bootstrapped and tested on x86_linux-gnu with no regressions. PR tree-optimization/111432 gcc/ChangeLog: * match.pd (`a & (x | CST)`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/bitops-7.c: New test.=