From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9C45F385840F; Fri, 12 Nov 2021 23:35:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C45F385840F From: "joseph at codesourcery dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/103193] gcc for x86_64: wrong code generation: ucomiss instead of comiss Date: Fri, 12 Nov 2021 23:35:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: joseph at codesourcery dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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 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: Fri, 12 Nov 2021 23:35:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103193 --- Comment #5 from joseph at codesourcery dot com --- On Fri, 12 Nov 2021, rguenth at gcc dot gnu.org via Gcc-bugs wrote: > /* Simplify comparison of something with itself. For IEEE > floating-point, we can only do some of these simplifications. */ > (for cmp (eq ge le) > (simplify > (cmp @0 @0) > (if (! FLOAT_TYPE_P (TREE_TYPE (@0)) > || ! HONOR_NANS (@0)) > { constant_boolean_node (true, type); } > (if (cmp !=3D EQ_EXPR) > (eq @0 @0))))) >=20 > does this. The folding to =3D=3D happens unconditionally. As I understa= nd you > the condition that applies to the constant folding should apply to the > folding to EQ as well, which means we effectively need to remove the > canonicalization to EQ (since when it would be valid we can fold to const= ant > true)? It's invalid with -ftrapping-math because it loses an exception. With=20 -fno-trapping-math, but NaNs supported, you can convert to EQ but can't=20 fold to constant true.=