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
jos...@codesourcery.com

Reply via email to