[llvm] a253a2a - [SDAG] fold fsub -0.0, undef to undef rather than NaN

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 07:04:18 PST 2020


On Mon, Feb 24, 2020 at 10:44 AM Nuno Lopes <nuno.lopes at ist.utl.pt> wrote:

> > ----------------------------------------
> > Name: t1
> >  %r = fsub half 4.000000, undef
> >  ret %r
> > =>
> >  ret undef
> >  %r = fsub half 4.000000, undef
> >
> > ERROR: Value mismatch
> >
> > Example:
> > half %r = NaN   [based on undef value]
> > Source value: NaN
> > Target value: #x8500 (-0.000076293945?)
> >
> >
> > @Nuno: is this a bug in alive?
>
> What Alive is trying to say is that there's no value x that makes "4.0 -
> x" yield the number 0x8500.
> I think Alive is correct here. FP operations usually can't produce the
> whole range of bit-patterns.
>

That was my conclusion from the review discussion and what I was hinting at
in the commit message.

So this Alive example that includes "nnan" is incorrect IIUC:

%r = fsub nnan half 4.000000, undef
 ret %r
=>
 ret undef

Optimization is correct!

...because the "nnan" does not change the fact that we can't produce the
entire range of FP bit-patterns.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200225/fd02032b/attachment.html>


More information about the llvm-commits mailing list