public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>,
	 Florian Weimer <fweimer@redhat.com>,
	GCC Development <gcc@gcc.gnu.org>,
	 Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org>,
	"Carlos O'Donell" <carlos@redhat.com>,
	 "Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: unnormal Intel 80-bit long doubles and isnanl
Date: Tue, 24 Nov 2020 15:43:27 +0100	[thread overview]
Message-ID: <CAFiYyc1L3MdbPK1=KXkq5ynD7X3ZeCLur+pQjFTtAyM8odVssw@mail.gmail.com> (raw)
In-Reply-To: <66d24f5b-147e-7708-58c0-b58281ba99bf@linaro.org>

On Tue, Nov 24, 2020 at 3:20 PM Adhemerval Zanella via Gcc
<gcc@gcc.gnu.org> wrote:
>
>
>
> On 24/11/2020 10:59, Siddhesh Poyarekar wrote:
> > On 11/24/20 7:11 PM, Szabolcs Nagy wrote:
> >> ideally fpclassify (and other classification macros) would
> >> handle all representations.
> >>
> >> architecturally invalid or trap representations can be a
> >> non-standard class but i think classifying them as FP_NAN
> >> would break the least amount of code.
> >
> > That's my impression too.
> >
> >>> glibc evaluates the bit pattern of the 80-bit long double and in the
> >>> process, ignores the integer bit, i.e. bit 63.  As a result, it considers
> >>> the unnormal number as a valid long double and isnanl returns 0.
> >>
> >> i think m68k and x86 are different here.
> >>
> >>>
> >>> gcc on the other hand, simply uses the number in a floating point comparison
> >>> and uses the parity flag (which indicates an unordered compare, signalling a
> >>> NaN) to decide if the number is a NaN.  The unnormal numbers behave like
> >>> NaNs in this respect, in that they set the parity flag and with
> >>> -fsignalling-nans, would result in an invalid-operation exception.  As a
> >>> result, __builtin_isnanl returns 1 for an unnormal number.
> >>
> >> compiling isnanl to a quiet fp compare is wrong with
> >> -fsignalling-nans: classification is not supposed to
> >> signal exceptions for snan.

Can you open a bugreport for this?  Note that the option is likely
to invoke isnanl from libm ...

> > I agree, but I think that issue with __builtin_isnanl is orthogonal to the question about unnormals.  Once that is fixed in gcc, we could actually use __builtin_isnanl all the time in glibc for isnanl.
> >
> > Siddhesh
>
> Which is the currently take from gcc developers on this semantic change of
> __builtin_isnanl? Are they considering current behavior of non classifying
> the 'unnormal' as NAN the expected behavior and waiting glibc to follow
> it or are they willing to align with glibc behavior?

I think GCC should follow standards and in case they do not apply do
sth reasonable - which I think classifying those as NaN is.

Richard.

  parent reply	other threads:[~2020-11-24 14:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 10:53 Siddhesh Poyarekar
2020-11-24 13:41 ` Szabolcs Nagy
2020-11-24 13:49   ` Florian Weimer
2020-11-24 13:59   ` Siddhesh Poyarekar
2020-11-24 14:16     ` Adhemerval Zanella
2020-11-24 14:28       ` Siddhesh Poyarekar
2020-11-24 14:43       ` Richard Biener [this message]
2020-11-24 16:12         ` Siddhesh Poyarekar
2020-11-24 14:23   ` Andreas Schwab
2020-11-24 21:28 ` Joseph Myers
2020-11-25  2:47   ` Siddhesh Poyarekar
2020-11-25 19:27     ` Joseph Myers
2020-11-26  0:23       ` Siddhesh Poyarekar
2020-11-27 11:31   ` Florian Weimer
2020-11-27 11:45     ` Siddhesh Poyarekar
2020-11-27 14:29       ` Florian Weimer
2020-11-27 17:40         ` Joseph Myers

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='CAFiYyc1L3MdbPK1=KXkq5ynD7X3ZeCLur+pQjFTtAyM8odVssw@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@gotplt.org \
    --cc=szabolcs.nagy@arm.com \
    /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).