[PATCH] D143074: [LangRef] improve documentation of SNaN in the default FP environment

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 08:37:26 PST 2023


arsenm added a comment.

In D143074#4096926 <https://reviews.llvm.org/D143074#4096926>, @RalfJung wrote:

>> No, arithmetic operations cannot produce signaling nans. Signaling nans only come from initialization.
>
> In LLVM, arithmetic operations can produce signaling nans: `x * 1.0` can be optimized to `x`, so if `x` was a signalling NaN that will be the output of the multiplication.
> (Maybe we are using the term "produce" differently here? I meant it as "can be the output of".)

I would interpret “produce” as being the origin of the snan. Propagation of what was originally a signaling nan isn’t production

> Maybe we want a guarantee that if no input is signaling then the output is not signaling either? I am not sure if that is a guarantee LLVM provides currently.

I think this should be preserved. The one possible issue is I think the old style MIPS snan encoding probably doesn’t work in general. APFloat assumes the newer quiet bit encoding every other target uses


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143074/new/

https://reviews.llvm.org/D143074



More information about the llvm-commits mailing list