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

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 04:10:57 PST 2023


sepavloff added a comment.

The property of SNaN like `SNan + 0.0 -> QNaN` is not related to exceptions and must be preserved in default environment also.

Some targets does not support SNaNs and they could use the optimization `x * 1.0 -> x`. This transformation on targets that support SNaNs is invalid in general case, as it violates requirements of IEEE-754 and do not agree with hardware behavior. Probably LLVM could support a flag that indicates if semantics of SNaN should be preserved. Until such flag is implemented, LLVM should always honor SNaNs, because ignoring SNaNs on the target that supports them is incorrect behavior, but preserving SNaN behavior on the target that do not support it is only a missed optimization.


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

https://reviews.llvm.org/D143074



More information about the llvm-commits mailing list