[llvm] LangRef: Clarify nsz on min/max operations for +0.0 vs -0.0 (PR #137567)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 23:54:30 PDT 2025


================
@@ -3914,6 +3914,10 @@ following flags to enable otherwise unsafe floating-point transformations.
    No Signed Zeros - Allow optimizations to treat the sign of a zero
    argument or zero result as insignificant. This does not imply that -0.0
    is poison and/or guaranteed to not exist in the operation.
+   Don't require +0.0>-0.0 for min/max operations - Allow optimizations of the
+   min/max operation not to treat +0.0>-0.0. Note the result should be either of
+   the operands. (max|min)(-0.0, -0.0) should never return +0.0, and vice versa.
+   Note: floating compare operations always imply -0.0 == +0.0.
----------------
arsenm wrote:

I've viewed it as more of a "may drop 0 signs but may not introduce them", but I think the uses need auditing to see if this is how it really works 

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


More information about the llvm-commits mailing list