From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1652E3857C70; Sat, 7 Nov 2020 21:22:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1652E3857C70 From: "wilson at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/94083] inefficient soft-float x!=Inf code Date: Sat, 07 Nov 2020 21:22:16 +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: 9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: wilson at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: Sat, 07 Nov 2020 21:22:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94083 The original bug report was apparently lost in the sourceware/gcc migration back in the spring and I didn't notice until now. This testcase int foo(void) { volatile float f, g; int n; f =3D __builtin_huge_valf(); g =3D __builtin_huge_valf(); n +=3D 1 - (f !=3D __builtin_huge_valf()); return n; } compiled for soft-float with -O2, and looking at the original tree dump I s= ee f =3D Inf; g =3D Inf; SAVE_EXPR ;, n =3D SAVE_EX PR + n;; So the C front end converted the f !=3D Inf compare to a f u<=3D compare, but the problem here is that the !=3D operation is a single libcall, but u<=3D is two libcalls. So code that sho= uld have a single soft-float libcall ends up with two. First a call to __unord= sf2, then a compare and branch, and then a call to __lesf2. This is a de-optimization. Perhaps we can convert the f u<=3D back to f !=3D= Inf in the optimization to get a single libcall. Or maybe we can add unordered soft-float libcalls like ulesf2.=