From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BBCCB385800C; Wed, 23 Aug 2023 04:45:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBCCB385800C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692765930; bh=58t1ozYL6s0kSp3u6VLuK0+Fo/duFysb3AxWyoqQ5IE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Qx2+uTWeZgvDB8sd48QawpZh6E9/RrGiO5IlRDeTR5fTTmTjfgIMR/we8RZReAI0F 8MsyqoosGMqY0o6ms5X5tBvoiegzVZJgJO5KQ77NLxDsBbRmnbvxvyUcRl6p/yOZGd DspRB3EnM++bMDnrjcvFEClASSUIjOmKz0ysOpkQ= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103660] Sub-optimal code with relational operators Date: Wed, 23 Aug 2023 04:45:30 +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: 12.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=3D103660 --- Comment #3 from Andrew Pinski --- (In reply to Andrew Pinski from comment #2) > Actually: > ``` > (for (op plus bit_ior bit_xor) > (simplify > (op (cond @0 @1 integer_zero_p) > (cond @2 @3 integer_zero_p)) > (with { bool wascmp; } > (if (bitwise_inverted_equal_p (@0, @2, wascmp)) > (cond @0 @1 @3) > ) > ) > ) > ) > ``` > Should fix this. >=20 > Well that replaces the pattern that was added in r13-4620-g4d9db4bdd458 a= nd > extends it to for plus and bit_xor. Note I think the patterns added in that revision were incorrect: + (cond (cmp@0 @01 @02) @3 zerop) + (cond (icmp@4 @01 @02) @5 zerop)) allows for @1 and @2 (which by the way 01 and 02 is; just using base 8 rath= er than base 10).=