[PATCH] D11866: transform fmin/fmax calls when possible (PR24314)

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 10:22:30 PDT 2015


Hi,

Right; and the C definition comes direct from the IEEE definition of
maxnum/minnum which has that get-out clause. So your code should probably
set nsz unconditionally, and nnan only if -ffast-math is set.

James

On Sat, 8 Aug 2015 at 22:04 Sanjay Patel via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> spatel added a comment.
>
> In http://reviews.llvm.org/D11866#219873, @jmolloy wrote:
>
> > Generally this looks fine, but you should be adding the nnan and nsz
> attributes to the fcmp instruction via the IRBuilder for value tracking to
> pick up the relaxedness.
>
>
> Thanks, James! I wasn't paying close enough attention - didn't realize
> fcmp now had FMF. Certainly, I'll get this fixed up.
>
> Is it the C definition of fmax / fmin that lets us add the nsz flag? Ie,
> no external relaxation flags are needed because:
> "Ideally, fmax would be sensitive to the sign of zero, for example
> fmax(−0. 0, +0. 0) would return +0; however, implementation in software
> might be impractical."
>
>
> http://reviews.llvm.org/D11866
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150809/33fbc26d/attachment.html>


More information about the llvm-commits mailing list