public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Marc Glisse via Gcc <gcc@gcc.gnu.org>
Cc: Marc Glisse <marc.glisse@inria.fr>,
	Jakub Jelinek <jakub@redhat.com>,
	FX via Fortran <fortran@gcc.gnu.org>, FX <fxcoudert@gmail.com>
Subject: Re: Floating-point comparisons in the middle-end
Date: Thu, 1 Sep 2022 16:22:10 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2209011620190.550568@digraph.polyomino.org.uk> (raw)
In-Reply-To: <e6060be6-2521-d581-309e-85aab3d79748@inria.fr>

On Thu, 1 Sep 2022, Marc Glisse via Gcc wrote:

> On Thu, 1 Sep 2022, Joseph Myers wrote:
> 
> > On Thu, 1 Sep 2022, FX via Gcc wrote:
> > 
> > > A tentative patch is attached, it seems to work well on simple examples,
> > > but for test coverage the hard part is going to be that the comparisons
> > > seem to be optimised away very easily into their non-signaling versions.
> > > Basically, if I do:
> > 
> > Presumably that can be reproduced without depending on the new built-in
> > function?  In which case it's an existing bug somewhere in the optimizers.
> 
>  (simplify
>   (cmp @0 REAL_CST@1)
> [...]
>    (if (REAL_VALUE_ISNAN (TREE_REAL_CST (@1))
>         && !tree_expr_signaling_nan_p (@1)
>         && !tree_expr_maybe_signaling_nan_p (@0))
>     { constant_boolean_node (cmp == NE_EXPR, type); })
> 
> only tries to preserve a comparison with sNaN, but not with qNaN. There are

So that needs to take more care about what comparison operations are 
involved.  Since such an optimization is fine for quiet comparisons such 
as ==, != or isless, but not for signaling comparisons such as < <= > >= 
(subject to any question of splitting up -ftrapping-math into more 
fine-grained options allowing different transformations).

-- 
Joseph S. Myers
joseph@codesourcery.com

  reply	other threads:[~2022-09-01 16:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01  8:04 FX
2022-09-01  8:19 ` Jakub Jelinek
2022-09-01  9:04   ` FX
2022-09-01  9:23     ` Jakub Jelinek
2022-09-01 10:06       ` FX
2022-09-01 15:21         ` Joseph Myers
2022-09-01 15:57           ` Marc Glisse
2022-09-01 16:22             ` Joseph Myers [this message]
2022-09-01 16:24           ` FX
2022-09-01 16:44             ` Joseph Myers
2022-09-01 18:15               ` FX
2022-09-01 14:32   ` Segher Boessenkool
2022-09-01 15:19 ` Joseph Myers
2022-09-01 18:38   ` FX
2022-09-01 19:13     ` Joseph Myers
2022-09-01 18:47   ` FX
2022-09-01 19:16     ` 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=alpine.DEB.2.22.394.2209011620190.550568@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=fxcoudert@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=marc.glisse@inria.fr \
    /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).