public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "wilson at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-94083-4-GGpKiMjrtQ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94083-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94083 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 = __builtin_huge_valf(); g = __builtin_huge_valf(); n += 1 - (f != __builtin_huge_valf()); return n; } compiled for soft-float with -O2, and looking at the original tree dump I see f = Inf; g = Inf; SAVE_EXPR <!(f u<= 3.4028234663852885981170418348451692544e+38)>;, n = SAVE_EX PR <!(f u<= 3.4028234663852885981170418348451692544e+38)> + n;; So the C front end converted the f != Inf compare to a f u<= <max-representable-float> compare, but the problem here is that the != operation is a single libcall, but u<= is two libcalls. So code that should have a single soft-float libcall ends up with two. First a call to __unordsf2, then a compare and branch, and then a call to __lesf2. This is a de-optimization. Perhaps we can convert the f u<= <max-representable-float> back to f != Inf in the optimization to get a single libcall. Or maybe we can add unordered soft-float libcalls like ulesf2.
next parent reply other threads:[~2020-11-07 21:22 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-94083-4@http.gcc.gnu.org/bugzilla/> 2020-11-07 21:22 ` wilson at gcc dot gnu.org [this message] 2021-08-16 21:40 ` pinskia at gcc dot gnu.org 2024-02-27 19:48 ` pinskia at gcc dot gnu.org 2024-02-27 19:49 ` pinskia at gcc dot gnu.org 2024-02-28 9:51 ` jakub at gcc dot gnu.org 2024-02-28 10:24 ` harald at gigawatt dot nl 2024-02-28 10:33 ` jakub at gcc dot gnu.org 2024-02-28 11:42 ` jsm28 at gcc dot gnu.org 2024-02-28 22:19 ` harald at gigawatt dot nl
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-94083-4-GGpKiMjrtQ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).