mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: FE Exception triggered by comparison
Date: Wed, 27 Feb 2019 22:03:40 +0100	[thread overview]
Message-ID: <20190227210340.GI21289@port70.net> (raw)
In-Reply-To: <20190227203503.GX23599@brightrain.aerifal.cx>

* Rich Felker <dalias@libc.org> [2019-02-27 15:35:03 -0500]:
> On Wed, Feb 27, 2019 at 09:16:09PM +0100, Szabolcs Nagy wrote:
> > * Alexander Monakov <amonakov@ispras.ru> [2019-02-27 22:48:02 +0300]:
> > > On Wed, 27 Feb 2019, Rich Felker wrote:
> > > > Ideally the compiler would be able to recognize portable (within IEEE)
> > > > patterns for floating point representation examination and optimize
> > > > them if there's a more efficient way to be able to do it for a
> > > > particular machine.
> > > 
> > > There's a difference for sNaN operands: the bit-test version obviously
> > > is not going to raise "invalid", while comparing the fpu register with
> > > itself will.  So I'm afraid the compiler wouldn't do that for x86 (but
> > > could for targets where an suitable instruction is available).
> > 
> > using -fsignaling-nan is extremely rare, by default the transformation
> > is valid (but maybe tricky anyway).
> 
> I'm not sure if I'd call transforming non-floating-point
> bit-manipulation code into a floating point instruction that alters
> exception flags "valid" regardless of the -fsignaling-nan state. It's
> one thing to say "this program isn't using and doesn't care about
> signaling nans [as floating point values]"; it's completely different
> to say "you can optimize integer operations as floating point without
> regard for how that affects fenv".

ok i assumed gcc would also detect that the source of those bits
are from an fp value, but that may be too much to ask (and may
still have the same safety issue if the fp value is not from
normal fp computations).



      reply	other threads:[~2019-02-27 21:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-24 13:28 Damian McGuckin
2019-02-24 17:12 ` Markus Wichmann
2019-02-24 19:25 ` Szabolcs Nagy
2019-02-24 20:04   ` Jens Gustedt
2019-02-24 21:50     ` Damian McGuckin
2019-02-25  5:21       ` Damian McGuckin
2019-02-25 15:51       ` Markus Wichmann
2019-02-26  3:55         ` Damian McGuckin
2019-02-27 14:14           ` Alexander Monakov
2019-02-27 15:38             ` Damian McGuckin
2019-02-27 16:00               ` Alexander Monakov
2019-02-27 16:09                 ` Damian McGuckin
2019-02-27 16:14                   ` Markus Wichmann
2019-02-27 16:20                     ` Damian McGuckin
2019-02-28  1:07                     ` Damian McGuckin
2019-02-28  1:27                       ` Rich Felker
2019-02-28  2:28                         ` Damian McGuckin
2019-02-27 16:32                   ` Alexander Monakov
2019-02-27 16:42                     ` Rich Felker
2019-02-27 17:08                       ` Szabolcs Nagy
2019-02-27 17:14                       ` Alexander Monakov
2019-02-27 17:26                         ` Rich Felker
2019-02-27 19:36                           ` Szabolcs Nagy
2019-02-27 19:48                           ` Alexander Monakov
2019-02-27 20:16                             ` Szabolcs Nagy
2019-02-27 20:35                               ` Rich Felker
2019-02-27 21:03                                 ` Szabolcs Nagy [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=20190227210340.GI21289@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).