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

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 10:59:49 PST 2025


================
@@ -16574,21 +16574,35 @@ type.
 
 Semantics:
 """"""""""
+Follows the semantics of minNum in IEEE-754-2008, except that -0.0 < +0.0 for the purposes
+of this intrinsic. As for signaling NaNs, per the minNum 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 stricter than minNum in IEEE-754-2008, 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.
+
----------------
jcranmer-intel wrote:

Delete this sentence? It reads weirdly, and is redundant with the next one.

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


More information about the llvm-commits mailing list