From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B6B703858D28; Mon, 28 Aug 2023 21:08:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6B703858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693256881; bh=RJIRaNMM3Sfvheg7nQGSoZvkGldtYN8MCCXjYliE14A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jdROTD9m3H3iU6N1hl/VP/zI9jQtaqBCvFbaMzap89eozl/hqVsQw/t/mve4rFxxU YCVQ+yS7PelLCAlhukRByyyuE/Nr3hoELL+djAA0GoA8FHwKPL2MBg5XvTxyjeZyGn C6OSIVGPHWYrAM5KriPpx/oKEouyKrPfivutnhOM= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95185] Failure to optimize specific kind of sign comparison check Date: Mon, 28 Aug 2023 21:08:01 +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: easyhack, missed-optimization X-Bugzilla-Severity: normal 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: assigned_to bug_status 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=3D95185 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot = gnu.org Status|NEW |ASSIGNED --- Comment #7 from Andrew Pinski --- (In reply to Andrew Pinski from comment #5) >=20 > Something like: > Prefer ^ over =3D=3D > ``` > (for cmp > (for cmpN > (for neeq > (simplify > (neeq:c (cmp @0 @1) @3 > (if (cmpN =3D=3D inverseof(cmp, TREE_TYPE (type)) > (bit_xor (cmpN @0 @1) @3) > ) > ) > ))) > ``` Actually we can just do: ``` /* For CMP =3D=3D b, prefer CMP` ^ b. */ (for neeq (ne eq) (for cmp (tcc_comparison) (simplify (neeq:c (cmp@0 @1 @2) @3) (bit_xor (bit_not! @0) @3) ) ) ) ``` Since we already have folding of (bit_not cmp) in another place.=