[PATCH] D62158: [InstCombine] canonicalize minnum/maxnum with 'nnan' to fcmp+select

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 11:27:08 PDT 2019


lebedev.ri marked an inline comment as done.
lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:2310
+        (IID == Intrinsic::minnum || IID == Intrinsic::maxnum)) {
+      // Minnum/maxnum have unspecified behavior comparing (+/-)0.0, so set nsz.
+      BuilderTy::FastMathFlagGuard Guard(Builder);
----------------
cameron.mcinally wrote:
> FYI that a draft of IEEE-754 2018 defines the (+/-)0.0 case:
> 
> ```
> minimumNumber(x, y) is x if x < y, y if y < x, and the number if one operand is a number and the other is a NaN. For this operation, −0 compares less than +0. If x = y and signs are the same it is either x or y. If both operands are NaNs, a quiet NaN is returned, according to 6.2. If either operand is a signaling NaN, an invalid operation exception is signaled, but unless both operands
> are NaNs, the signaling NaN is otherwise ignored and not converted to a quiet NaN as stated in 6.2 for other operations.
> ```
> 
> 
LLVM internals mostly follow LLVM LangRef, which currently does not state that;
i guess you'd first want to clarify LangRef.
https://llvm.org/docs/LangRef.html#llvm-maxnum-intrinsic


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

https://reviews.llvm.org/D62158





More information about the llvm-commits mailing list