public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub 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: Wed, 28 Feb 2024 09:51:44 +0000	[thread overview]
Message-ID: <bug-94083-4-g2ethqnBNp@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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jsm28 at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Shall __builtin_isinf (x) or __builtin_isinf_sign (x) raise exception if x is a
sNaN?
Or never? Or it can but doesn't have to?
glibc's
        int64_t hx,lx;
        GET_LDOUBLE_WORDS64(hx,lx,x);
        lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL;
        lx |= -lx;
        return ~(lx >> 63) & (hx >> 62);
doesn't, but I think when we lower __builtin_isinf to fabs (x) (which should
just clear the sign bit, not raise exception) u<= <max_representable_finite>,
it would.
If we wouldn't need to raise exception, I think fastest would be to pattern
recognize the fabs (x) <= <max_representable> and emit there the (lx | ((hx &
0x7fffffffffffffffLL) ^ 0x7fff000000000000LL)) != 0.
But __builtin_islessequal (__builtin_fabsf128 (x), __builtin_nextafterf128
(__builtin_inff128 (), 0.0f128)) I think should raise exception and those 2
will be indistinguishable, so maybe just recognize that case during expansion
if 2 libcalls would be needed and emit the equality comparison instead.
Or do both depending on if -fsignaling-nans is specified or not?

  parent reply	other threads:[~2024-02-28  9:51 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
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 [this message]
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-g2ethqnBNp@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: link
Be 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).