[llvm] [LangRef] Clarify specification for float min/max operations (PR #172012)

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 10:03:26 PST 2025


================
@@ -17619,12 +17531,17 @@ one operand is NaN (including sNaN) and another operand is a number,
 return the number.  Otherwise returns the lesser of the two
 arguments. -0.0 is considered to be less than +0.0 for this intrinsic.
 
+If the ``nsz`` flag is specified, ``llvm.minimumnum`` with one +0.0 and one
+-0.0 operand may non-deterministically return either operand. Contrary to normal
+``nsz`` semantics, if both operands have the same sign, the result must also
+have the same sign.
+
 Note that these are the semantics of minimumNumber specified in
 IEEE-754-2019 with the usual :ref:`signaling NaN <floatnan>` exception.
 
-It has some differences with '``llvm.minnum.*``':
-1)'``llvm.minnum.*``' will return qNaN if either operand is sNaN.
-2)'``llvm.minnum*``' may return either one if we compare +0.0 vs -0.0.
+This intrinsic differs from ``llvm.minnum`` in that it is guaranteed to treat
----------------
jyknight wrote:

Doesn't need to re-explain what the semantics of minnum. I suggest to use the same sentence I suggested for minnum, and similarly place it in the top paragraph, "This behaves identically to llvm.minnum other than its treatment of sNaN inputs."

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


More information about the llvm-commits mailing list