From: Michael Meissner <meissner@linux.ibm.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,
"Joseph S. Myers" <joseph@codesourcery.com>,
Jeff Law <jeffreyalaw@gmail.com>,
gcc-patches@gcc.gnu.org, FX <fxcoudert@gmail.com>
Subject: Re: [PATCH] Implement __builtin_issignaling
Date: Thu, 25 Aug 2022 15:23:12 -0400 [thread overview]
Message-ID: <YwfMIHxFdvU8Uw8S@toto.the-meissners.org> (raw)
In-Reply-To: <Yvob8gMilv36WN4T@tucnak>
On Mon, Aug 15, 2022 at 12:12:02PM +0200, Jakub Jelinek via Gcc-patches wrote:
> Hi!
>
> The following patch implements a new builtin, __builtin_issignaling,
> which can be used to implement the ISO/IEC TS 18661-1 issignaling
> macro.
I haven't looked in detail at the patch, but from the description I think it
needs a way for machine dependent parts to optimize this for a given mode when
various switches are used.
For example on the PowerPC (and at least older AMD processors) it can often
times be expensive to move data from a floating point register to a GPR
register to do the masking operation. I implemented special purpose
recognizers a few years ago to speed up the SFmode math library to recognize
when the glibc tests were being done.
If the machine has a faster way to implement it, it should be allowed to do
this.
On some of the PowerPC's, I might want to generate code like (note, I might
have some of the tests backwards, but the idea is test if the value is a NaN,
and if it is a NaN, look at the signalling bit. Otherwise return 0:
if (__builtin_isnan (x)) {
long long mantissa = <extract mantissa>
return ~((mantissa >> 52) & 1);
} else {
return 0;
}
That way it doesn't have to do a direct move to a GPR register to do the
extraction in general.
For SFmode/DFmode, you should be able to optimize it to something like to avoid
any explicit jumps on a power10 (note, I may have some of the tests/shifts
wrong, but that is the general method you could use):
static int inline
is_signalling_nan (double value)
{
int exponent = __builtin_vec_scalar_extract_exp (value);
long long mantissa = __builtin_vec_scalar_extract_sig (value);
return (mantissa >> 52) & (exponent == 0);
}
--
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: meissner@linux.ibm.com
next prev parent reply other threads:[~2022-08-25 19:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-15 10:12 Jakub Jelinek
2022-08-15 11:24 ` Richard Biener
2022-08-15 11:47 ` Jakub Jelinek
2022-08-15 12:04 ` Andreas Schwab
2022-08-15 12:07 ` Richard Biener
2022-08-15 13:06 ` Jakub Jelinek
2022-08-16 11:33 ` Jakub Jelinek
2022-08-16 11:41 ` Richard Biener
2022-08-16 11:57 ` Jakub Jelinek
2022-08-16 12:04 ` Richard Biener
2022-08-23 7:58 ` Patch ping (Re: [PATCH] Implement __builtin_issignaling) Jakub Jelinek
2022-08-23 18:23 ` Joseph Myers
2022-08-23 19:21 ` [PATCH] v2: Implement __builtin_issignaling Jakub Jelinek
2022-08-15 16:14 ` [PATCH] " FX
2022-08-15 16:23 ` Jakub Jelinek
2022-08-15 20:52 ` Uros Bizjak
2022-08-25 19:23 ` Michael Meissner [this message]
2022-08-25 19:56 ` Jakub Jelinek
2022-08-26 17:25 ` Michael Meissner
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=YwfMIHxFdvU8Uw8S@toto.the-meissners.org \
--to=meissner@linux.ibm.com \
--cc=fxcoudert@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jeffreyalaw@gmail.com \
--cc=joseph@codesourcery.com \
--cc=rguenther@suse.de \
/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).