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

>From c4b59887920537008f42dc8baef703f0c24a8111 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Fri, 12 Dec 2025 15:06:53 +0100
Subject: [PATCH 01/18] [LangRef] Clarify specification for float min/max
 operations

This implements some clarifications for the specification of floating
point min/max operations based on the discussion in
https://discourse.llvm.org/t/rfc-a-consistent-set-of-semantics-for-the-floating-point-minimum-and-maximum-operations/89006.

The key changes are:

 * Explicitly specify minnum and maxnum with an sNaN operand as
   non-deterministically either returning NaN or treating sNaN
   as qNaN. This was implied by our general NaN semantics, but is
   important to call out here due to the special behavior of sNaN.
 * Explicitly specify the same non-determinism for the minnum/maxnum
   based vector reductions as well.
 * Explicitly specify the meaning of nsz on float min/max ops. In
   particular, clarify that unlike normal nsz semantics, it does
   not allow introducing a zero with a different sign out of thin
   air.
 * Remove the semantics comparison section. I tried to adjust this,
   but there's just so many caveats in here that it's hard to create
   something that is both concise and correct.
---
 llvm/docs/LangRef.rst | 218 +++++++++++++++---------------------------
 1 file changed, 78 insertions(+), 140 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 041a526b6729f..7ad4f81531e1d 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17305,96 +17305,6 @@ 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:
-
-'``llvm.min.*``' Intrinsics Comparation
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Standard:
-"""""""""
-
-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:
-
-.. list-table::
-   :header-rows: 2
-
-   * - ``ISO C``
-     - fmin/fmax
-     - fmininum/fmaximum
-     - fminimum_num/fmaximum_num
-
-   * - ``IEEE754``
-     - minNum/maxNum (2008)
-     - minimum/maximum (2019)
-     - minimumNumber/maximumNumber (2019)
-
-   * - ``+0.0 vs -0.0``
-     - either one
-     - +0.0 > -0.0
-     - +0.0 > -0.0
-
-   * - ``NUM vs sNaN``
-     - qNaN, invalid exception
-     - qNaN, invalid exception
-     - NUM, invalid exception
-
-   * - ``qNaN vs sNaN``
-     - qNaN, invalid exception
-     - qNaN, invalid exception
-     - qNaN, invalid exception
-
-   * - ``NUM vs qNaN``
-     - NUM, no exception
-     - qNaN, no exception
-     - NUM, no exception
-
-LLVM Implementation:
-""""""""""""""""""""
-
-LLVM implements all ISO C flavors as listed in this table, except in the
-default floating-point environment exceptions are ignored. The constrained
-versions of the intrinsics respect the exception behavior.
-
-.. list-table::
-   :header-rows: 1
-   :widths: 16 28 28 28
-
-   * - Operation
-     - minnum/maxnum
-     - minimum/maximum
-     - minimumnum/maximumnum
-
-   * - ``NUM vs qNaN``
-     - NUM, no exception
-     - qNaN, no exception
-     - NUM, no exception
-
-   * - ``NUM vs sNaN``
-     - qNaN, invalid exception
-     - qNaN, invalid exception
-     - NUM, invalid exception
-
-   * - ``qNaN vs sNaN``
-     - qNaN, invalid exception
-     - qNaN, invalid exception
-     - qNaN, invalid exception
-
-   * - ``sNaN vs sNaN``
-     - qNaN, invalid exception
-     - qNaN, invalid exception
-     - qNaN, invalid exception
-
-   * - ``+0.0 vs -0.0``
-     - +0.0(max)/-0.0(min)
-     - +0.0(max)/-0.0(min)
-     - +0.0(max)/-0.0(min)
-
-   * - ``NUM vs NUM``
-     - larger(max)/smaller(min)
-     - larger(max)/smaller(min)
-     - larger(max)/smaller(min)
-
 .. _i_minnum:
 
 '``llvm.minnum.*``' Intrinsic
@@ -17430,30 +17340,26 @@ type.
 
 Semantics:
 """"""""""
-Follows the semantics of minNum in IEEE-754-2008, except that -0.0 < +0.0 for 
the purposes
-of this intrinsic. As for signaling NaNs, per the minNum semantics, if either 
operand is sNaN,
-the result is qNaN. This matches the recommended behavior for the libm
-function ``fmin``, although not all implementations have implemented these 
recommended behaviors.
 
-If either operand is a qNaN, returns the other non-NaN operand. Returns NaN 
only if both operands are
-NaN or if either operand is sNaN. Note that arithmetic on an sNaN doesn't 
consistently produce a qNaN,
-so arithmetic feeding into a minnum can produce inconsistent results. For 
example,
-``minnum(fadd(sNaN, -0.0), 1.0)`` can produce qNaN or 1.0 depending on whether 
``fadd`` is folded.
+If both operands are qNaNs, returns a :ref:`NaN <floatnan>`. If one operand is
+qNaN and another operand is a number, returns the number. If both operands are
+numbers, returns the lesser of the two arguments. -0.0 is considered to be less
+than +0.0 for this intrinsic.
 
-IEEE-754-2008 defines minNum, and it was removed in IEEE-754-2019. As the 
replacement, IEEE-754-2019
-defines :ref:`minimumNumber <i_minimumnum>`.
+If an operand is a signaling NaN, then the intrinsic will non-deterministically
+either:
 
-If the intrinsic is marked with the nsz attribute, then the effect is as in 
the definition in C
-and IEEE-754-2008: the result of ``minnum(-0.0, +0.0)`` may be either -0.0 or 
+0.0.
+ * Return a :ref:`NaN <floatnan>`.
+ * Or treat the signaling NaN as a quiet NaN. In this case the intrinsic will
+   behave the same as ``llvm.minimumnum``.
 
-Some architectures, such as ARMv8 (FMINNM), LoongArch (fmin), MIPSr6 
(min.fmt), PowerPC/VSX (xsmindp),
-have instructions that match these semantics exactly; thus it is quite simple 
for these architectures.
-Some architectures have similar ones while they are not exact equivalent. Such 
as x86 implements ``MINPS``,
-which implements the semantics of C code ``a<b?a:b``: NUM vs qNaN always 
return qNaN. ``MINPS`` can be used
-if ``nsz`` and ``nnan`` are given.
+If the ``nsz`` flag is specified, ``llvm.minnum`` 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.
 
-For existing libc implementations, the behaviors of fmin may be quite 
different on sNaN and signed zero behaviors,
-even in the same release of a single libm implementation.
+When used with the ``nsz`` flag, this intrinsics follows the semantics of
+``fmin`` in C.
 
 .. _i_maxnum:
 
@@ -17490,30 +17396,26 @@ type.
 
 Semantics:
 """"""""""
-Follows the semantics of maxNum in IEEE-754-2008, except that -0.0 < +0.0 for 
the purposes
-of this intrinsic. As for signaling NaNs, per the maxNum semantics, if either 
operand is sNaN,
-the result is qNaN. This matches the recommended behavior for the libm
-function ``fmax``, although not all implementations have implemented these 
recommended behaviors.
 
-If either operand is a qNaN, returns the other non-NaN operand. Returns NaN 
only if both operands are
-NaN or if either operand is sNaN. Note that arithmetic on an sNaN doesn't 
consistently produce a qNaN,
-so arithmetic feeding into a maxnum can produce inconsistent results. For 
example,
-``maxnum(fadd(sNaN, -0.0), 1.0)`` can produce qNaN or 1.0 depending on whether 
``fadd`` is folded.
+If both operands are qNaNs, returns a :ref:`NaN <floatnan>`. If one operand is
+qNaN and another operand is a number, returns the number. If both operands are
+numbers, returns the greater of the two arguments. -0.0 is considered to be
+less than +0.0 for this intrinsic.
 
-IEEE-754-2008 defines maxNum, and it was removed in IEEE-754-2019. As the 
replacement, IEEE-754-2019
-defines :ref:`maximumNumber <i_maximumnum>`.
+If an operand is a signaling NaN, then the intrinsic will non-deterministically
+either:
 
-If the intrinsic is marked with the nsz attribute, then the effect is as in 
the definition in C
-and IEEE-754-2008: the result of maxnum(-0.0, +0.0) may be either -0.0 or +0.0.
+ * Return a :ref:`NaN <floatnan>`.
+ * Or treat the signaling NaN as a quiet NaN. In this case the intrinsic will
+   behave the same as ``llvm.maximumnum``.
 
-Some architectures, such as ARMv8 (FMAXNM), LoongArch (fmax), MIPSr6 
(max.fmt), PowerPC/VSX (xsmaxdp),
-have instructions that match these semantics exactly; thus it is quite simple 
for these architectures.
-Some architectures have similar ones while they are not exact equivalent. Such 
as x86 implements ``MAXPS``,
-which implements the semantics of C code ``a>b?a:b``: NUM vs qNaN always 
return qNaN. ``MAXPS`` can be used
-if ``nsz`` and ``nnan`` are given.
+If the ``nsz`` flag is specified, ``llvm.maxnum`` 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.
 
-For existing libc implementations, the behaviors of fmin may be quite 
different on sNaN and signed zero behaviors,
-even in the same release of a single libm implementation.
+When used with the ``nsz`` flag, this intrinsics follows the semantics of
+``fmax`` in C.
 
 .. _i_minimum:
 
@@ -17555,6 +17457,11 @@ of the two arguments. -0.0 is considered to be less 
than +0.0 for this
 intrinsic. Note that these are the semantics specified in the draft of
 IEEE 754-2019.
 
+If the ``nsz`` flag is specified, ``llvm.maximum`` 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.
+
 .. _i_maximum:
 
 '``llvm.maximum.*``' Intrinsic
@@ -17595,6 +17502,11 @@ of the two arguments. -0.0 is considered to be less 
than +0.0 for this
 intrinsic. Note that these are the semantics specified in the draft of
 IEEE 754-2019.
 
+If the ``nsz`` flag is specified, ``llvm.maximum`` 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.
+
 .. _i_minimumnum:
 
 '``llvm.minimumnum.*``' Intrinsic
@@ -17636,12 +17548,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
+sNaN the same way as qNaN. ``llvm.minnum`` will instead non-deterministically
+either act like ``llvm.minimumnum`` or return a :ref:`NaN <floatnan>`.
 
 .. _i_maximumnum:
 
@@ -17685,12 +17602,17 @@ another operand is a number, return the number.  
Otherwise returns the
 greater of the two arguments. -0.0 is considered to be less than +0.0
 for this intrinsic.
 
+If the ``nsz`` flag is specified, ``llvm.maximumnum`` 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 maximumNumber specified in
 IEEE-754-2019  with the usual :ref:`signaling NaN <floatnan>` exception.
 
-It has some differences with '``llvm.maxnum.*``':
-1)'``llvm.maxnum.*``' will return qNaN if either operand is sNaN.
-2)'``llvm.maxnum*``' may return either one if we compare +0.0 vs -0.0.
+This intrinsic differs from ``llvm.maxnum`` in that it is guaranteed to treat
+sNaN the same way as qNaN. ``llvm.maxnum`` will instead non-deterministically
+either act like ``llvm.maximumnum`` or return a :ref:`NaN <floatnan>`.
 
 .. _int_copysign:
 
@@ -20445,9 +20367,17 @@ The '``llvm.vector.reduce.fmax.*``' intrinsics do a 
floating-point
 ``MAX`` reduction of a vector, returning the result as a scalar. The return 
type
 matches the element-type of the vector input.
 
-This instruction has the same comparison semantics as the '``llvm.maxnum.*``'
-intrinsic.  If the intrinsic call has the ``nnan`` fast-math flag, then the
-operation can assume that NaNs are not present in the input vector.
+This instruction has the same comparison and ``nsz`` semantics as the
+'``llvm.maxnum.*``' intrinsic.
+
+If any of the vector elements is a signaling NaN, the intrinsic will
+non-deterministically either:
+
+ * Return a :ref:`NaN <floatnan>`.
+ * Treat the signaling NaN as a quiet NaN.
+
+If the intrinsic call has the ``nnan`` fast-math flag, then the operation can
+assume that NaNs are not present in the input vector.
 
 Arguments:
 """"""""""
@@ -20474,9 +20404,17 @@ The '``llvm.vector.reduce.fmin.*``' intrinsics do a 
floating-point
 ``MIN`` reduction of a vector, returning the result as a scalar. The return 
type
 matches the element-type of the vector input.
 
-This instruction has the same comparison semantics as the '``llvm.minnum.*``'
-intrinsic. If the intrinsic call has the ``nnan`` fast-math flag, then the
-operation can assume that NaNs are not present in the input vector.
+This instruction has the same comparison and ``nsz`` semantics as the
+'``llvm.minnum.*``' intrinsic.
+
+If any of the vector elements is a signaling NaN, the intrinsic will
+non-deterministically either:
+
+ * Return a :ref:`NaN <floatnan>`.
+ * Treat the signaling NaN as a quiet NaN.
+
+If the intrinsic call has the ``nnan`` fast-math flag, then the operation can
+assume that NaNs are not present in the input vector.
 
 Arguments:
 """"""""""

>From efdceb03e2fa427353dd4fea2498149a1fe2c258 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Fri, 12 Dec 2025 16:35:07 +0100
Subject: [PATCH 02/18] Drop redundant nnan sentences

---
 llvm/docs/LangRef.rst | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 7ad4f81531e1d..9fdb63d23c18c 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -20376,9 +20376,6 @@ non-deterministically either:
  * Return a :ref:`NaN <floatnan>`.
  * Treat the signaling NaN as a quiet NaN.
 
-If the intrinsic call has the ``nnan`` fast-math flag, then the operation can
-assume that NaNs are not present in the input vector.
-
 Arguments:
 """"""""""
 The argument to this intrinsic must be a vector of floating-point values.
@@ -20413,9 +20410,6 @@ non-deterministically either:
  * Return a :ref:`NaN <floatnan>`.
  * Treat the signaling NaN as a quiet NaN.
 
-If the intrinsic call has the ``nnan`` fast-math flag, then the operation can
-assume that NaNs are not present in the input vector.
-
 Arguments:
 """"""""""
 The argument to this intrinsic must be a vector of floating-point values.

>From 7ed8a9be568d2656764bd6fb99df508872e3cb5f Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Tue, 16 Dec 2025 15:32:58 +0100
Subject: [PATCH 03/18] Add mention of sNaN exception, remove mention of draft

---
 llvm/docs/LangRef.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 9fdb63d23c18c..4152879a80a4a 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17454,8 +17454,8 @@ Semantics:
 """"""""""
 If either operand is a NaN, returns NaN. Otherwise returns the lesser
 of the two arguments. -0.0 is considered to be less than +0.0 for this
-intrinsic. Note that these are the semantics specified in the draft of
-IEEE 754-2019.
+intrinsic. Note that these are the semantics of minimum specified in
+IEEE 754-2019, with the usual :ref:`signaling NaN <floatnan>` exception.
 
 If the ``nsz`` flag is specified, ``llvm.maximum`` with one +0.0 and one
 -0.0 operand may non-deterministically return either operand. Contrary to 
normal
@@ -17499,8 +17499,8 @@ Semantics:
 """"""""""
 If either operand is a NaN, returns NaN. Otherwise returns the greater
 of the two arguments. -0.0 is considered to be less than +0.0 for this
-intrinsic. Note that these are the semantics specified in the draft of
-IEEE 754-2019.
+intrinsic. Note that these are the semantics of maximum specified in
+IEEE 754-2019, with the usual :ref:`signaling NaN <floatnan>` exception.
 
 If the ``nsz`` flag is specified, ``llvm.maximum`` with one +0.0 and one
 -0.0 operand may non-deterministically return either operand. Contrary to 
normal

>From 87b8ebd12a249800bf4c7969c280c8acb84b4302 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Tue, 16 Dec 2025 15:37:16 +0100
Subject: [PATCH 04/18] Make the relationship to minimumnum a separate point

---
 llvm/docs/LangRef.rst | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 4152879a80a4a..023fa664e1e4c 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17350,8 +17350,7 @@ If an operand is a signaling NaN, then the intrinsic 
will non-deterministically
 either:
 
  * Return a :ref:`NaN <floatnan>`.
- * Or treat the signaling NaN as a quiet NaN. In this case the intrinsic will
-   behave the same as ``llvm.minimumnum``.
+ * Or treat the signaling NaN as a quiet NaN.
 
 If the ``nsz`` flag is specified, ``llvm.minnum`` with one +0.0 and one
 -0.0 operand may non-deterministically return either operand. Contrary to 
normal
@@ -17361,6 +17360,9 @@ have the same sign.
 When used with the ``nsz`` flag, this intrinsics follows the semantics of
 ``fmin`` in C.
 
+The ``llvm.minnum`` intrinsic can be refined into ``llvm.minimumnum``, as the
+latter exhibits a subset of behaviors of the former.
+
 .. _i_maxnum:
 
 '``llvm.maxnum.*``' Intrinsic
@@ -17406,8 +17408,7 @@ If an operand is a signaling NaN, then the intrinsic 
will non-deterministically
 either:
 
  * Return a :ref:`NaN <floatnan>`.
- * Or treat the signaling NaN as a quiet NaN. In this case the intrinsic will
-   behave the same as ``llvm.maximumnum``.
+ * Or treat the signaling NaN as a quiet NaN.
 
 If the ``nsz`` flag is specified, ``llvm.maxnum`` with one +0.0 and one
 -0.0 operand may non-deterministically return either operand. Contrary to 
normal
@@ -17417,6 +17418,9 @@ have the same sign.
 When used with the ``nsz`` flag, this intrinsics follows the semantics of
 ``fmax`` in C.
 
+The ``llvm.maxnum`` intrinsic can be refined into ``llvm.maximumnum``, as the
+latter exhibits a subset of behaviors of the former.
+
 .. _i_minimum:
 
 '``llvm.minimum.*``' Intrinsic

>From 4986f87549cb4dec2aaf076419d92e53e40658e1 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Tue, 16 Dec 2025 15:38:58 +0100
Subject: [PATCH 05/18] Reference floatnan for consistency

---
 llvm/docs/LangRef.rst | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 023fa664e1e4c..1388dc7ece20a 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17456,9 +17456,9 @@ type.
 
 Semantics:
 """"""""""
-If either operand is a NaN, returns NaN. Otherwise returns the lesser
-of the two arguments. -0.0 is considered to be less than +0.0 for this
-intrinsic. Note that these are the semantics of minimum specified in
+If either operand is a NaN, returns a :ref:`NaN <floatnan>`. Otherwise returns
+the lesser of the two arguments. -0.0 is considered to be less than +0.0 for
+this intrinsic. Note that these are the semantics of minimum specified in
 IEEE 754-2019, with the usual :ref:`signaling NaN <floatnan>` exception.
 
 If the ``nsz`` flag is specified, ``llvm.maximum`` with one +0.0 and one
@@ -17501,9 +17501,9 @@ type.
 
 Semantics:
 """"""""""
-If either operand is a NaN, returns NaN. Otherwise returns the greater
-of the two arguments. -0.0 is considered to be less than +0.0 for this
-intrinsic. Note that these are the semantics of maximum specified in
+If either operand is a NaN, returns a :ref:`NaN <floatnan>`. Otherwise returns
+the greater of the two arguments. -0.0 is considered to be less than +0.0 for
+this intrinsic. Note that these are the semantics of maximum specified in
 IEEE 754-2019, with the usual :ref:`signaling NaN <floatnan>` exception.
 
 If the ``nsz`` flag is specified, ``llvm.maximum`` with one +0.0 and one

>From 27ac3934d2d24288a35ba4cbddfe9f7db769b684 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Tue, 16 Dec 2025 15:41:55 +0100
Subject: [PATCH 06/18] Don't repeat minnum semantics in minimumnum docs

---
 llvm/docs/LangRef.rst | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 1388dc7ece20a..405570428b84d 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17560,9 +17560,8 @@ 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.
 
-This intrinsic differs from ``llvm.minnum`` in that it is guaranteed to treat
-sNaN the same way as qNaN. ``llvm.minnum`` will instead non-deterministically
-either act like ``llvm.minimumnum`` or return a :ref:`NaN <floatnan>`.
+This intrinsic behaves the same as ``llvm.minnum`` other than its treatment of
+sNaN inputs.
 
 .. _i_maximumnum:
 
@@ -17614,9 +17613,8 @@ have the same sign.
 Note that these are the semantics of maximumNumber specified in
 IEEE-754-2019  with the usual :ref:`signaling NaN <floatnan>` exception.
 
-This intrinsic differs from ``llvm.maxnum`` in that it is guaranteed to treat
-sNaN the same way as qNaN. ``llvm.maxnum`` will instead non-deterministically
-either act like ``llvm.maximumnum`` or return a :ref:`NaN <floatnan>`.
+This intrinsic behaves the same as ``llvm.maxnum`` other than its treatment of
+sNaN inputs.
 
 .. _int_copysign:
 

>From d9ce6e18ac26edcd86ed2c38825b4a5ba0e950c3 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Tue, 16 Dec 2025 15:46:25 +0100
Subject: [PATCH 07/18] Mention IEEE 754-2008 maxNum

---
 llvm/docs/LangRef.rst | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 405570428b84d..ff481521ebb77 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17358,7 +17358,8 @@ If the ``nsz`` flag is specified, ``llvm.minnum`` with 
one +0.0 and one
 have the same sign.
 
 When used with the ``nsz`` flag, this intrinsics follows the semantics of
-``fmin`` in C.
+``fmin`` in C and ``maxNum`` in IEEE 754-2008 with the usual
+:ref:`signaling NaN <floatnan>` exception.
 
 The ``llvm.minnum`` intrinsic can be refined into ``llvm.minimumnum``, as the
 latter exhibits a subset of behaviors of the former.
@@ -17416,7 +17417,8 @@ If the ``nsz`` flag is specified, ``llvm.maxnum`` with 
one +0.0 and one
 have the same sign.
 
 When used with the ``nsz`` flag, this intrinsics follows the semantics of
-``fmax`` in C.
+``fmax`` in C and ``maxNum`` in IEEE 754-2008 with the usual
+:ref:`signaling NaN <floatnan>` exception.
 
 The ``llvm.maxnum`` intrinsic can be refined into ``llvm.maximumnum``, as the
 latter exhibits a subset of behaviors of the former.

>From af7778603907a96dbde841cf25317d3c9cb62ad7 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Tue, 16 Dec 2025 16:31:46 +0100
Subject: [PATCH 08/18] Remove signed zero ordering requirement for
 minnum/maxnum

---
 llvm/docs/LangRef.rst | 36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index ff481521ebb77..aca95ff9bf6d4 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17343,8 +17343,8 @@ Semantics:
 
 If both operands are qNaNs, returns a :ref:`NaN <floatnan>`. If one operand is
 qNaN and another operand is a number, returns the number. If both operands are
-numbers, returns the lesser of the two arguments. -0.0 is considered to be less
-than +0.0 for this intrinsic.
+numbers, returns the lesser of the two arguments. If both operands compare 
equal
+(for example +0.0 and -0.0), non-deterministially returns either operand.
 
 If an operand is a signaling NaN, then the intrinsic will non-deterministically
 either:
@@ -17352,14 +17352,8 @@ either:
  * Return a :ref:`NaN <floatnan>`.
  * Or treat the signaling NaN as a quiet NaN.
 
-If the ``nsz`` flag is specified, ``llvm.minnum`` 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.
-
-When used with the ``nsz`` flag, this intrinsics follows the semantics of
-``fmin`` in C and ``maxNum`` in IEEE 754-2008 with the usual
-:ref:`signaling NaN <floatnan>` exception.
+This intrinsics follows the semantics of ``fmin`` in C and ``maxNum`` in
+IEEE 754-2008 with the usual :ref:`signaling NaN <floatnan>` exception.
 
 The ``llvm.minnum`` intrinsic can be refined into ``llvm.minimumnum``, as the
 latter exhibits a subset of behaviors of the former.
@@ -17402,8 +17396,8 @@ Semantics:
 
 If both operands are qNaNs, returns a :ref:`NaN <floatnan>`. If one operand is
 qNaN and another operand is a number, returns the number. If both operands are
-numbers, returns the greater of the two arguments. -0.0 is considered to be
-less than +0.0 for this intrinsic.
+numbers, returns the greater of the two arguments. If both operands compare
+equal (for example +0.0 and -0.0), non-deterministically returns either 
operand.
 
 If an operand is a signaling NaN, then the intrinsic will non-deterministically
 either:
@@ -17411,14 +17405,8 @@ either:
  * Return a :ref:`NaN <floatnan>`.
  * Or treat the signaling NaN as a quiet NaN.
 
-If the ``nsz`` flag is specified, ``llvm.maxnum`` 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.
-
-When used with the ``nsz`` flag, this intrinsics follows the semantics of
-``fmax`` in C and ``maxNum`` in IEEE 754-2008 with the usual
-:ref:`signaling NaN <floatnan>` exception.
+This intrinsics follows the semantics of ``fmax`` in C and ``maxNum`` in
+IEEE 754-2008 with the usual :ref:`signaling NaN <floatnan>` exception.
 
 The ``llvm.maxnum`` intrinsic can be refined into ``llvm.maximumnum``, as the
 latter exhibits a subset of behaviors of the former.
@@ -20371,8 +20359,8 @@ The '``llvm.vector.reduce.fmax.*``' intrinsics do a 
floating-point
 ``MAX`` reduction of a vector, returning the result as a scalar. The return 
type
 matches the element-type of the vector input.
 
-This instruction has the same comparison and ``nsz`` semantics as the
-'``llvm.maxnum.*``' intrinsic.
+This instruction has the same comparison semantics as the '``llvm.maxnum.*``'
+intrinsic.
 
 If any of the vector elements is a signaling NaN, the intrinsic will
 non-deterministically either:
@@ -20405,8 +20393,8 @@ The '``llvm.vector.reduce.fmin.*``' intrinsics do a 
floating-point
 ``MIN`` reduction of a vector, returning the result as a scalar. The return 
type
 matches the element-type of the vector input.
 
-This instruction has the same comparison and ``nsz`` semantics as the
-'``llvm.minnum.*``' intrinsic.
+This instruction has the same comparison semantics as the '``llvm.minnum.*``'
+intrinsic.
 
 If any of the vector elements is a signaling NaN, the intrinsic will
 non-deterministically either:

>From 6d23cc2ce5dee3d78afa1b02a934e3d525c9e5cd Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Wed, 17 Dec 2025 18:17:19 +0100
Subject: [PATCH 09/18] Revert "Remove signed zero ordering requirement for
 minnum/maxnum"

This reverts commit 6465f194c9dcb24442a827dacc8a11f8f89d995f.
---
 llvm/docs/LangRef.rst | 36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index aca95ff9bf6d4..ff481521ebb77 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17343,8 +17343,8 @@ Semantics:
 
 If both operands are qNaNs, returns a :ref:`NaN <floatnan>`. If one operand is
 qNaN and another operand is a number, returns the number. If both operands are
-numbers, returns the lesser of the two arguments. If both operands compare 
equal
-(for example +0.0 and -0.0), non-deterministially returns either operand.
+numbers, returns the lesser of the two arguments. -0.0 is considered to be less
+than +0.0 for this intrinsic.
 
 If an operand is a signaling NaN, then the intrinsic will non-deterministically
 either:
@@ -17352,8 +17352,14 @@ either:
  * Return a :ref:`NaN <floatnan>`.
  * Or treat the signaling NaN as a quiet NaN.
 
-This intrinsics follows the semantics of ``fmin`` in C and ``maxNum`` in
-IEEE 754-2008 with the usual :ref:`signaling NaN <floatnan>` exception.
+If the ``nsz`` flag is specified, ``llvm.minnum`` 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.
+
+When used with the ``nsz`` flag, this intrinsics follows the semantics of
+``fmin`` in C and ``maxNum`` in IEEE 754-2008 with the usual
+:ref:`signaling NaN <floatnan>` exception.
 
 The ``llvm.minnum`` intrinsic can be refined into ``llvm.minimumnum``, as the
 latter exhibits a subset of behaviors of the former.
@@ -17396,8 +17402,8 @@ Semantics:
 
 If both operands are qNaNs, returns a :ref:`NaN <floatnan>`. If one operand is
 qNaN and another operand is a number, returns the number. If both operands are
-numbers, returns the greater of the two arguments. If both operands compare
-equal (for example +0.0 and -0.0), non-deterministically returns either 
operand.
+numbers, returns the greater of the two arguments. -0.0 is considered to be
+less than +0.0 for this intrinsic.
 
 If an operand is a signaling NaN, then the intrinsic will non-deterministically
 either:
@@ -17405,8 +17411,14 @@ either:
  * Return a :ref:`NaN <floatnan>`.
  * Or treat the signaling NaN as a quiet NaN.
 
-This intrinsics follows the semantics of ``fmax`` in C and ``maxNum`` in
-IEEE 754-2008 with the usual :ref:`signaling NaN <floatnan>` exception.
+If the ``nsz`` flag is specified, ``llvm.maxnum`` 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.
+
+When used with the ``nsz`` flag, this intrinsics follows the semantics of
+``fmax`` in C and ``maxNum`` in IEEE 754-2008 with the usual
+:ref:`signaling NaN <floatnan>` exception.
 
 The ``llvm.maxnum`` intrinsic can be refined into ``llvm.maximumnum``, as the
 latter exhibits a subset of behaviors of the former.
@@ -20359,8 +20371,8 @@ The '``llvm.vector.reduce.fmax.*``' intrinsics do a 
floating-point
 ``MAX`` reduction of a vector, returning the result as a scalar. The return 
type
 matches the element-type of the vector input.
 
-This instruction has the same comparison semantics as the '``llvm.maxnum.*``'
-intrinsic.
+This instruction has the same comparison and ``nsz`` semantics as the
+'``llvm.maxnum.*``' intrinsic.
 
 If any of the vector elements is a signaling NaN, the intrinsic will
 non-deterministically either:
@@ -20393,8 +20405,8 @@ The '``llvm.vector.reduce.fmin.*``' intrinsics do a 
floating-point
 ``MIN`` reduction of a vector, returning the result as a scalar. The return 
type
 matches the element-type of the vector input.
 
-This instruction has the same comparison semantics as the '``llvm.minnum.*``'
-intrinsic.
+This instruction has the same comparison and ``nsz`` semantics as the
+'``llvm.minnum.*``' intrinsic.
 
 If any of the vector elements is a signaling NaN, the intrinsic will
 non-deterministically either:

>From 2405da3666d9610bb371e090dd489294258fc4d0 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Wed, 17 Dec 2025 18:28:29 +0100
Subject: [PATCH 10/18] Add warning that zero ordering is not implemented

---
 llvm/docs/LangRef.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index ff481521ebb77..61ae2f8b06439 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17364,6 +17364,12 @@ When used with the ``nsz`` flag, this intrinsics 
follows the semantics of
 The ``llvm.minnum`` intrinsic can be refined into ``llvm.minimumnum``, as the
 latter exhibits a subset of behaviors of the former.
 
+.. warning::
+
+  If the intrinsic is used without nsz, not all backends currently respect the
+  specified signed zero ordering. Do not rely on it until this warning has
+  been removed.
+
 .. _i_maxnum:
 
 '``llvm.maxnum.*``' Intrinsic
@@ -17423,6 +17429,12 @@ When used with the ``nsz`` flag, this intrinsics 
follows the semantics of
 The ``llvm.maxnum`` intrinsic can be refined into ``llvm.maximumnum``, as the
 latter exhibits a subset of behaviors of the former.
 
+.. warning::
+
+  If the intrinsic is used without nsz, not all backends currently respect the
+  specified signed zero ordering. Do not rely on it until this warning has
+  been removed.
+
 .. _i_minimum:
 
 '``llvm.minimum.*``' Intrinsic

>From 0f5aa2af8a9ac8450344ccf480d5f79dee6cf7e0 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Tue, 6 Jan 2026 16:12:28 +0100
Subject: [PATCH 11/18] Bring back comparison section

---
 llvm/docs/LangRef.rst | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 61ae2f8b06439..32e955018ed76 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17305,6 +17305,45 @@ 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.
 
+Floating-point min/max intrinsics comparison
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+LLVM supports three pairs of floating-point min/max intrinsics, which differ
+in their handling of :ref:`NaN values <floatnan>`:
+
+ * ``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.
+
+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.
+
+The mapping between the LLVM intrinsics, C functions and IEEE-754 functions is
+as follows (up to divergences permitted by the usual `NaN rules <floatnan>`):
+
+.. list-table::
+   :header-rows: 1
+
+   * - LLVM intrinsic
+     - llvm.minnum with nsz flag
+     - llvm.minimum
+     - llvm.minimumnum
+
+   * - C function
+     - fmin
+     - fminimum
+     - fminimum_num
+
+   * - IEEE-754 function
+     - minNum (2008)
+     - minimum (2019)
+     - minimumNumber (2019)
+
 .. _i_minnum:
 
 '``llvm.minnum.*``' Intrinsic

>From c209ffd8c2d154cd2f373510a609900edd0335c2 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Wed, 7 Jan 2026 10:36:50 +0100
Subject: [PATCH 12/18] Fix intrinsics -> intrinsic typo

---
 llvm/docs/LangRef.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 32e955018ed76..07fc17a39fadd 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17396,7 +17396,7 @@ If the ``nsz`` flag is specified, ``llvm.minnum`` with 
one +0.0 and one
 ``nsz`` semantics, if both operands have the same sign, the result must also
 have the same sign.
 
-When used with the ``nsz`` flag, this intrinsics follows the semantics of
+When used with the ``nsz`` flag, this intrinsic follows the semantics of
 ``fmin`` in C and ``maxNum`` in IEEE 754-2008 with the usual
 :ref:`signaling NaN <floatnan>` exception.
 
@@ -17461,7 +17461,7 @@ If the ``nsz`` flag is specified, ``llvm.maxnum`` with 
one +0.0 and one
 ``nsz`` semantics, if both operands have the same sign, the result must also
 have the same sign.
 
-When used with the ``nsz`` flag, this intrinsics follows the semantics of
+When used with the ``nsz`` flag, this intrinsic follows the semantics of
 ``fmax`` in C and ``maxNum`` in IEEE 754-2008 with the usual
 :ref:`signaling NaN <floatnan>` exception.
 

>From cded10c023b34df1c37ae60a2819f7640088ff25 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Wed, 7 Jan 2026 10:44:03 +0100
Subject: [PATCH 13/18] tweak snan exception wording

---
 llvm/docs/LangRef.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 07fc17a39fadd..f02a886bab5f6 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17397,8 +17397,8 @@ If the ``nsz`` flag is specified, ``llvm.minnum`` with 
one +0.0 and one
 have the same sign.
 
 When used with the ``nsz`` flag, this intrinsic follows the semantics of
-``fmin`` in C and ``maxNum`` in IEEE 754-2008 with the usual
-:ref:`signaling NaN <floatnan>` exception.
+``fmin`` in C and ``minNum`` in IEEE 754-2008, except for signaling NaN inputs,
+which follow :ref:`LLVM's usual signaling NaN behavior <floatnan>` instead.
 
 The ``llvm.minnum`` intrinsic can be refined into ``llvm.minimumnum``, as the
 latter exhibits a subset of behaviors of the former.
@@ -17462,8 +17462,8 @@ If the ``nsz`` flag is specified, ``llvm.maxnum`` with 
one +0.0 and one
 have the same sign.
 
 When used with the ``nsz`` flag, this intrinsic follows the semantics of
-``fmax`` in C and ``maxNum`` in IEEE 754-2008 with the usual
-:ref:`signaling NaN <floatnan>` exception.
+``fmax`` in C and ``maxNum`` in IEEE 754-2008, except for signaling NaN inputs,
+which follow :ref:`LLVM's usual signaling NaN behavior <floatnan>` instead.
 
 The ``llvm.maxnum`` intrinsic can be refined into ``llvm.maximumnum``, as the
 latter exhibits a subset of behaviors of the former.

>From 18622c4be38cabce0154b5f1e38909806fd7993a Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Wed, 7 Jan 2026 10:46:38 +0100
Subject: [PATCH 14/18] Consistent style for the C / IEEE comparison

---
 llvm/docs/LangRef.rst | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index f02a886bab5f6..9e8f9d938eda7 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17511,8 +17511,11 @@ Semantics:
 """"""""""
 If either operand is a NaN, returns a :ref:`NaN <floatnan>`. Otherwise returns
 the lesser of the two arguments. -0.0 is considered to be less than +0.0 for
-this intrinsic. Note that these are the semantics of minimum specified in
-IEEE 754-2019, with the usual :ref:`signaling NaN <floatnan>` exception.
+this intrinsic.
+
+This intrinsic follows the semantics of ``fminimum`` in C23 and ``minimum`` in
+IEEE 754-2019, except for signaling NaN inputs, which follow
+:ref:`LLVM's usual signaling NaN behavior <floatnan>` instead.
 
 If the ``nsz`` flag is specified, ``llvm.maximum`` with one +0.0 and one
 -0.0 operand may non-deterministically return either operand. Contrary to 
normal
@@ -17556,8 +17559,11 @@ Semantics:
 """"""""""
 If either operand is a NaN, returns a :ref:`NaN <floatnan>`. Otherwise returns
 the greater of the two arguments. -0.0 is considered to be less than +0.0 for
-this intrinsic. Note that these are the semantics of maximum specified in
-IEEE 754-2019, with the usual :ref:`signaling NaN <floatnan>` exception.
+this intrinsic.
+
+This intrinsic follows the semantics of ``fmaximum`` in C23 and ``maximum`` in
+IEEE 754-2019, except for signaling NaN inputs, which follow
+:ref:`LLVM's usual signaling NaN behavior <floatnan>` instead.
 
 If the ``nsz`` flag is specified, ``llvm.maximum`` with one +0.0 and one
 -0.0 operand may non-deterministically return either operand. Contrary to 
normal
@@ -17610,8 +17616,9 @@ If the ``nsz`` flag is specified, ``llvm.minimumnum`` 
with one +0.0 and one
 ``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.
+This intrinsic follows the semantics of ``fminimum_num`` in C23 and
+``minimumNumber`` in IEEE 754-2019, except for signaling NaN inputs, which
+follow :ref:`LLVM's usual signaling NaN behavior <floatnan>` instead.
 
 This intrinsic behaves the same as ``llvm.minnum`` other than its treatment of
 sNaN inputs.
@@ -17663,8 +17670,9 @@ If the ``nsz`` flag is specified, ``llvm.maximumnum`` 
with one +0.0 and one
 ``nsz`` semantics, if both operands have the same sign, the result must also
 have the same sign.
 
-Note that these are the semantics of maximumNumber specified in
-IEEE-754-2019  with the usual :ref:`signaling NaN <floatnan>` exception.
+This intrinsic follows the semantics of ``fmaximum_num`` in C23 and
+``maximumNumber`` in IEEE 754-2019, except for signaling NaN inputs, which
+follow :ref:`LLVM's usual signaling NaN behavior <floatnan>` instead.
 
 This intrinsic behaves the same as ``llvm.maxnum`` other than its treatment of
 sNaN inputs.

>From 64846320bf69fa5f9c745aee03f50e198c07b280 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Wed, 7 Jan 2026 10:54:23 +0100
Subject: [PATCH 15/18] Add link to tracking issue

---
 llvm/docs/LangRef.rst | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 9e8f9d938eda7..e65f6aa007c2c 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17407,7 +17407,8 @@ latter exhibits a subset of behaviors of the former.
 
   If the intrinsic is used without nsz, not all backends currently respect the
   specified signed zero ordering. Do not rely on it until this warning has
-  been removed.
+  been removed. See `issue #174730
+  <https://github.com/llvm/llvm-project/issues/174730>`_.
 
 .. _i_maxnum:
 
@@ -17472,7 +17473,8 @@ latter exhibits a subset of behaviors of the former.
 
   If the intrinsic is used without nsz, not all backends currently respect the
   specified signed zero ordering. Do not rely on it until this warning has
-  been removed.
+  been removed. See `issue #174730
+  <https://github.com/llvm/llvm-project/issues/174730>`_.
 
 .. _i_minimum:
 

>From 6d61cfd41c56a9f27dee94a0d238c5ba5feb4aa9 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Wed, 7 Jan 2026 10:55:37 +0100
Subject: [PATCH 16/18] Adjust IEEE 754 spelling

---
 llvm/docs/LangRef.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index e65f6aa007c2c..7f21b923c405c 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17323,7 +17323,7 @@ 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.
 
-The mapping between the LLVM intrinsics, C functions and IEEE-754 functions is
+The mapping between the LLVM intrinsics, C functions and IEEE 754 functions is
 as follows (up to divergences permitted by the usual `NaN rules <floatnan>`):
 
 .. list-table::
@@ -17339,7 +17339,7 @@ as follows (up to divergences permitted by the usual 
`NaN rules <floatnan>`):
      - fminimum
      - fminimum_num
 
-   * - IEEE-754 function
+   * - IEEE 754 function
      - minNum (2008)
      - minimum (2019)
      - minimumNumber (2019)

>From 29e7cee898cb143ff1c2faabb9c45d44ca8e7a67 Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Wed, 7 Jan 2026 17:03:11 +0100
Subject: [PATCH 17/18] Fix references to comparison section

---
 clang/docs/LanguageExtensions.rst | 20 ++++++++++----------
 llvm/docs/LangRef.rst             |  2 ++
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index d7963243564a1..2055def4a6e14 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -842,20 +842,20 @@ of different sizes and signs is forbidden in binary and 
ternary builtins.
  T __builtin_elementwise_max(T x, T y)          return x or y, whichever is 
larger                                     integer and floating point types
                                                 For floating point types, 
follows semantics of maxNum
                                                 in IEEE 754-2008. See `LangRef
-                                                
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                                
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                                 for the comparison.
  T __builtin_elementwise_min(T x, T y)          return x or y, whichever is 
smaller                                    integer and floating point types
                                                 For floating point types, 
follows semantics of minNum
                                                 in IEEE 754-2008. See `LangRef
-                                                
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                                
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                                 for the comparison.
  T __builtin_elementwise_maxnum(T x, T y)       return x or y, whichever is 
larger. Follows IEEE 754-2008              floating point types
                                                 semantics (maxNum) with 
+0.0>-0.0. See `LangRef
-                                                
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                                
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                                 for the comparison.
  T __builtin_elementwise_minnum(T x, T y)       return x or y, whichever is 
smaller. Follows IEEE 754-2008             floating point types
                                                 semantics (minNum) with 
+0.0>-0.0. See `LangRef
-                                                
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                                
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                                 for the comparison.
  T __builtin_elementwise_add_sat(T x, T y)      return the sum of x and y, 
clamped to the range of                     integer types
                                                 representable values for the 
signed/unsigned integer type.
@@ -863,19 +863,19 @@ of different sizes and signs is forbidden in binary and 
ternary builtins.
                                                 representable values for the 
signed/unsigned integer type.
  T __builtin_elementwise_maximum(T x, T y)      return x or y, whichever is 
larger. Follows IEEE 754-2019              floating point types
                                                 semantics, see `LangRef
-                                                
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                                
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                                 for the comparison.
  T __builtin_elementwise_minimum(T x, T y)      return x or y, whichever is 
smaller. Follows IEEE 754-2019             floating point types
                                                 semantics, see `LangRef
-                                                
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                                
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                                 for the comparison.
  T __builtin_elementwise_maximumnum(T x, T y)   return x or y, whichever is 
larger. Follows IEEE 754-2019              floating point types
                                                 semantics, see `LangRef
-                                                
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                                
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                                 for the comparison.
  T __builtin_elementwise_minimumnum(T x, T y)   return x or y, whichever is 
smaller. Follows IEEE 754-2019             floating point types
                                                 semantics, see `LangRef
-                                                
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                                
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                                 for the comparison.
 T __builtin_elementwise_fshl(T x, T y, T z)     perform a funnel shift left. 
Concatenate x and y (x is the most        integer types
                                                 significant bits of the wide 
value), the combined value is shifted
@@ -940,11 +940,11 @@ Let ``VT`` be a vector type and ``ET`` the element type 
of ``VT``.
  ET __builtin_reduce_xor(VT a)           ^                                     
                                 integer types
  ET __builtin_reduce_maximum(VT a)       return the largest element of the 
vector. Follows IEEE 754-2019        floating point types
                                          semantics, see `LangRef
-                                         
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                         
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                          for the comparison.
  ET __builtin_reduce_minimum(VT a)       return the smallest element of the 
vector. Follows IEEE 754-2019       floating point types
                                          semantics, see `LangRef
-                                         
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
+                                         
<http://llvm.org/docs/LangRef.html#i-fminmax-family>`_
                                          for the comparison.
 ======================================= 
====================================================================== 
==================================
 
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 7f21b923c405c..047e99deeb20a 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17305,6 +17305,8 @@ 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
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

>From 1d48412793bc11c74ecd9591136ed412c402416b Mon Sep 17 00:00:00 2001
From: Nikita Popov <[email protected]>
Date: Wed, 7 Jan 2026 17:08:48 +0100
Subject: [PATCH 18/18] Apply Ralf's clarification

---
 llvm/docs/LangRef.rst | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 047e99deeb20a..7d21ecfb2b607 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17321,9 +17321,10 @@ in their handling of :ref:`NaN values <floatnan>`:
    minimumnum/maximumnum. For signaling NaNs, non-deterministically returns
    NaN or the other operand.
 
-Additionally, each of these intrinsics supports two behaviors for signed 
zeroes.
+Additionally, each of these intrinsics supports two behaviors for signed zeros.
 By default, -0.0 is considered smaller than +0.0. If the ``nsz`` flag is
-specified, the order is non-deterministic.
+specified, the order is non-deterministic: If the two inputs are zeros with
+opposite sign, either input may be returned.
 
 The mapping between the LLVM intrinsics, C functions and IEEE 754 functions is
 as follows (up to divergences permitted by the usual `NaN rules <floatnan>`):

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to