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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 7 02:02:17 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.
----------------
arsenm wrote:

I think this is fine. As I've mentioned elsewhere, given this is the one instance where IEEE has a defined fuzzy 0 sign behavior, we should conform the definition of NSZ to match.

I've been trying to think of an example where this is a hazard other combines not specifically handling the min/max as an input need to be aware of, but so far I haven't been able to come up with one.

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


More information about the llvm-commits mailing list