[clang] [llvm] [LangRef] Clarify specification for float min/max operations (PR #172012)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 7 08:10:17 PST 2026
================
@@ -17305,95 +17305,44 @@ The returned value is completely identical to the input except for the sign bit;
in particular, if the input is a NaN, then the quiet/signaling bit and payload
are perfectly preserved.
-.. _i_fminmax_family:
+Floating-point min/max intrinsics comparison
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-'``llvm.min.*``' Intrinsics Comparation
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LLVM supports three pairs of floating-point min/max intrinsics, which differ
+in their handling of :ref:`NaN values <floatnan>`:
-Standard:
-"""""""""
+ * ``llvm.minimum`` and ``llvm.maximum``: Return NaN if one the arguments is
+ NaN.
+ * ``llvm.minimumnum`` and ``llvm.maximumnum``: Return the other argument if
+ one of the arguments is NaN.
+ * ``llvm.minnum`` and ``llvm.maxnum``: For quiet NaNs behaves like
+ minimumnum/maximumnum. For signaling NaNs, non-deterministically returns
+ NaN or the other operand.
-IEEE754 and ISO C define some min/max operations, and they have some differences
-on working with qNaN/sNaN and +0.0/-0.0. Here is the list:
+Additionally, each of these intrinsics supports two behaviors for signed zeroes.
+By default, -0.0 is considered smaller than +0.0. If the ``nsz`` flag is
+specified, the order is non-deterministic.
----------------
nikic wrote:
Done.
https://github.com/llvm/llvm-project/pull/172012
More information about the cfe-commits
mailing list