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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 14:52:11 PST 2024


================
@@ -16574,21 +16574,35 @@ 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 if either operand is sNaN.
+
+This behavior is more strict than the definition in C and IEEE 754, where either zero may be returned.
+To achieve the same permissiveness, the backend may implement the nsz attribute, and one may use the nsz
+attribute on the intrinsic call.
----------------
arsenm wrote:

Use the nsz attribute

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


More information about the llvm-commits mailing list