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

Joshua Cranmer via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 13 11:51:16 PST 2026


================
@@ -17636,12 +17605,16 @@ 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.
----------------
jcranmer-intel wrote:

I'm not entirely certain it's contrary to our actual normal `nsz` semantics (at least as far as we intend them to be, not as far as it's currently described in the document). The intent is that `nsz` isn't going to materialize a -0.0 out of absolutely nowhere, but it would take a deep dive of all of the transforms we want to enable with `nsz` to understand what the precise conditions are.

I think it's worth calling out the expectations of `nsz` here in any case, as we want `nsz` on the min/max algorithms to specifically indicate "we don't care about the ordering of -0.0 vis-a-vis +0.0" and we want frontends to be able to rely on that behavior, so I'm not going to object to the wording.

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


More information about the cfe-commits mailing list