This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patches] Re: teach simplify_rtx to simplify unordered compares
> >>>>> Jan Hubicka writes:
>
> >> This can be removed - or change the condition below.
> > It can not be, since the code in between may cause exception in the NAN case on
> > architectures not masking them by default and return wia longjmp.
> I see:
>
> But in that case the can look like (the extra args->unordered = 1 is
> not needed) :
>
> args->unordered = 1;
>
> REAL_VALUE_FROM_CONST_DOUBLE (d0, args->op0);
> REAL_VALUE_FROM_CONST_DOUBLE (d1, args->op1);
> if (!REAL_VALUE_ISNAN (d0)
> && REAL_VALUE_ISNAN (d1))
> args->unordered = 0;
>
> or even (if it's unordered, args->equal, args->op0lt and args->ob1lt
> should all be false!):
> args->unordered = 1;
>
> REAL_VALUE_FROM_CONST_DOUBLE (d0, args->op0);
> REAL_VALUE_FROM_CONST_DOUBLE (d1, args->op1);
> if (REAL_VALUE_ISNAN (d0)
> || REAL_VALUE_ISNAN (d1))
> return;
> else
> args->unordered = 0;
OK, this change is surely possible.
>
> Btw. what happens if d0 or d1 is an infinity? In that case you also
I don't have IEEE specs (they do want money) but my Athlon claims even
the Inf versus Inf comparison to be ordered.
> have an unordered comparison - therefore change the if to:
> if (!REAL_VALUE_ISNAN (d0) && !REAL_VALUE_ISNAN (d1)
> && !REAL_VALUE_ISINF (d0) && !REAL_VALUE_ISINF (d1))
>
> Andreas
> --
> Andreas Jaeger
> SuSE Labs aj@suse.de
> private aj@arthur.inka.de
> http://www.suse.de/~aj