[llvm-dev] [cfe-dev] Should isnan be optimized out in fast-math mode?

James Y Knight via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 10 07:29:21 PDT 2021


On Thu, Sep 9, 2021, 8:59 PM Richard Smith via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Would it be reasonable to treat operations on Inf and NaN values as UB in
> this mode only if the same operation on a signaling NaN might signal?
> (Approximately, that'd mean we imagine these non-finite value encodings all
> encode sNaNs that are UB if they would signal.) That means the operations
> that ISO 60559 defines as non-computational or quiet-computational would be
> permitted to receive NaN and Inf as input and produce them as output, but
> that other computational operations would not.
>
> Per ISO 60559, the quiet-computational operations that I think are
> relevant to us are: copy, negate, abs, copySign, and conversions between
> encoding (eg, bitcast). The non-computational operations that I think are
> relevant to us are classification functions (including isNaN).
>

I'm in favor. (Perhaps unsurprisingly, as this is precisely the proposal I
made earlier, worded slightly differently. :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210910/4ca40751/attachment.html>


More information about the llvm-dev mailing list