From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BA48E3857C66; Thu, 25 Nov 2021 02:44:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA48E3857C66 From: "tnfchris at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103417] [12 Regression] wrong code at -O1 and above on x86_64-linux-gnu since r12-5489 Date: Thu, 25 Nov 2021 02:44:59 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: tnfchris at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2021 02:44:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103417 --- Comment #5 from Tamar Christina --- (In reply to Jakub Jelinek from comment #4) > Created attachment 51870 [details] > gcc12-pr103417.patch >=20 > Untested fix. Handling GE in that simplification is clearly bogus, we > should just fold it to true elsewhere, not bother with it (it doesn't han= dle > LT either, > which should also fold to false elsewhere). Indeed, that one is wrong.. > Handling LE and GT there isn't wrong, but makes no sense. Elsewhere we > canonicalize x > 0U into x !=3D 0U and x <=3D 0U into x =3D=3D 0U and for= signed it > was handling only EQ and NE already before. Well, the intention is to simplify the bitmask. Most vector ISAs can create= the simple bitmask much easier than the complex one. i.e. 0xFFFFFF00 is much ha= rder to create than 0xFF. for scalar yes it doesn't matter much. but e.g. for (int i =3D 0; i < (n & -16); i++) x[i] =3D (x[i]&(~255)) <=3D 0U; generates worse code when the mask 0xFFFFFF00 is to be used. The patch is mainly addressing vector code but we added scalar for uniformity. So I would like LE and GT to stay, at the very least for vector where it ma= kes a difference. It's not something we can fix in the backend because we can't differentiate between signed and unsigned.=