From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D24C03857705; Wed, 23 Aug 2023 02:36:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D24C03857705 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692758187; bh=E2Euq9yUiGGJSaW+sqMP0ETGg4c9gcY7enjgG2KqXeU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=om//6/czM7aMXBcWNkQdMxHLQpb+okRvHr8ng8ckrcDFYK+yPJ7WJ9q9ws6Yt7VPn N0PRgIHZIk3PLwZr8+UHEfqKY42ySYOxh8IUbI168DtBoxkWCSiojmXyKn1ucdhNad xsTJupw+B2u3hibWQrhNdx5H466gpHLyvm9L/kmw= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95408] Failure to optimize bitwise and with negated conditional using the same operand to conditional with decremented operand Date: Wed, 23 Aug 2023 02:36:27 +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: 11.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=3D95408 --- Comment #2 from Andrew Pinski --- In forwprop1 we have: _2 =3D x.0_1 <=3D 121210; _3 =3D (int) _2; _4 =3D _3 * x_5(D); _6 =3D _4 !=3D 0; since _3 is zero_one_valued we could do instead: ``` (for cmp (ne eq ) bitop (bit_and bit_ior) (simplify (cmp (mult zero_one_valued_p@0 @1) integer_zerop@2) (bitop! (convert @0) (ne @1 @2)))) ``` And we should be able to get it earlier on. Still mine and I will look into the above.=