public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: FX <fxcoudert@gmail.com>
Cc: GCC Mailing List <gcc@gcc.gnu.org>, <fortran@gcc.gnu.org>
Subject: Re: Need for __builtin_issignaling()
Date: Thu, 30 Dec 2021 18:42:15 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2112301832320.2246536@digraph.polyomino.org.uk> (raw)
In-Reply-To: <8ABA7142-4AF1-4857-89AA-40471703F95A@gmail.com>

On Wed, 29 Dec 2021, FX via Gcc wrote:

> Is it particularly hard to do? I came across a post in the list archives 
> from Joseph, who said it would be good to have. I’d be willing to try 
> and put something together, unless you think it’s a big project. Any 
> pointers as to how to start would be appreciated.

Start by looking at Tamar Christina's patch for bugs 77925, 77926, 66462, 
which got reverted because of problems it caused.  In particular, see my 
comment 18 in bug 66462 pointing to some of the reports of issues, and 
look at the relevant discussion in June 2017.  I think the following 
comment 19 is incorrect (when it refers to June and November, those are 
June 2017 and November 2016, so the November version is an *older* one, 
but that comments is under the apprehension that it was a newer one).

There's no need to use that patch as a starting point, but it may well be 
helpful to do so, or at least to get ideas from it.  It didn't add 
__builtin_issignaling, but did add implementations of other related 
built-in functions based on bit-manipulation, and __builtin_issignaling 
would need to be implemented based on such bit-manipulation.

Apart from avoiding the bugs in that patch, for __builtin_issignaling 
there isn't any other implementation approach to fall back on, and there 
isn't any defined external-linkage function to fall back on either.  So 
it's strongly desirable to have a built-in function that works (is 
expanded inline) for *all* floating-point formats supported by GCC, not 
just some.  (For formats not supporting signaling NaNs, it can trivially 
return 0 after evaluating the argument for its side effects.)  Note that 
supporting all formats includes working for formats where integer 
arithmetic on a same-size integer isn't supported (TFmode on 32-bit 
architectures where there isn't TImode integer arithmetic, in particular), 
so you need to be careful about working correctly in that case.

-- 
Joseph S. Myers
joseph@codesourcery.com

      reply	other threads:[~2021-12-30 18:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29 14:25 FX
2021-12-30 18:42 ` Joseph Myers [this message]

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=alpine.DEB.2.22.394.2112301832320.2246536@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=fxcoudert@gmail.com \
    --cc=gcc@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).