[llvm] LangRef: Clarify llvm.minnum and llvm.maxnum about sNaN (PR #112852)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 10:26:01 PDT 2024


================
@@ -16464,21 +16464,32 @@ type.
 
 Semantics:
 """"""""""
+Follows the IEEE-754 semantics for minNum, except that -0.0 < +0.0 for the purposes
+of this intrinsic. As for signaling NaNs, per the IEEE-754 semantics, if either operand
+is an sNaN, the result is always a qNaN. This matches the recommended behavior for the libm
+function fmin, although not all implementations have implemented these recommended behaviors.
+
+If either operand is a qNaN, returns the other non-NaN operand. Returns
+NaN only if both operands are NaN or either operand is sNaN.
 
-Follows the IEEE-754 semantics for minNum, except for handling of
-signaling NaNs. This match's the behavior of libm's fmin.
+If the operands compare equal, returns either one of the operands.
----------------
jcranmer-intel wrote:

I'd delete this line, because the only time this happens are for -0/+0 (which is handled specially), decimal cohorts (which aren't supported by LLVM), or noncanonical values (which need their own discussion).

https://github.com/llvm/llvm-project/pull/112852


More information about the llvm-commits mailing list