Skip to content

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented May 9, 2025

Make this consistent with other operations with respect to
signaling nan quieting. This was specifying that quieting is
required, which is true for IEEE. Make this consistent with other
IR operations, and signaling nan quieting is possible but optional
in the case where there are two nan inputs.

This permits directly selecting the intrinsic to the hardware
instruction in the default floating-point environment for shaders.

Make this consistent with other operations with respect to
signaling nan quieting. This was specifying that quieting is
required, which is true for IEEE. Make this consistent with other
IR operations, and signaling nan quieting is possible but optional
in the case where there are two nan inputs.

This permits directly selecting the intrinsic to the hardware
instruction in the default floating-point environment for shaders.
@arsenm arsenm added floating-point Floating-point math llvm:ir labels May 9, 2025 — with Graphite App
Copy link
Contributor Author

arsenm commented May 9, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented May 9, 2025

@llvm/pr-subscribers-llvm-ir

Author: Matt Arsenault (arsenm)

Changes

Make this consistent with other operations with respect to
signaling nan quieting. This was specifying that quieting is
required, which is true for IEEE. Make this consistent with other
IR operations, and signaling nan quieting is possible but optional
in the case where there are two nan inputs.

This permits directly selecting the intrinsic to the hardware
instruction in the default floating-point environment for shaders.


Full diff: https://github.com/llvm/llvm-project/pull/139228.diff

1 Files Affected:

  • (modified) llvm/docs/LangRef.rst (+15-10)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 7296bb84b7d95..ce45ef7720eaa 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -17183,12 +17183,14 @@ type.
 
 Semantics:
 """"""""""
-If both operands are NaNs (including sNaN), returns qNaN. If 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.
 
-Note that these are the semantics of minimumNumber specified in IEEE 754-2019.
+If both operands are NaNs (including sNaN), returns a :ref:`NaN <floatnan>`. If
+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.
+
+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.
@@ -17229,12 +17231,15 @@ type.
 
 Semantics:
 """"""""""
-If both operands are NaNs (including sNaN), returns qNaN. If one operand
-is NaN (including sNaN) and 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.
 
-Note that these are the semantics of maximumNumber specified in IEEE 754-2019.
+If both operands are NaNs (including sNaN), returns a
+:ref:`NaN <floatnan>`. If one operand is NaN (including sNaN) and
+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.
+
+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.

@arsenm arsenm marked this pull request as ready for review May 9, 2025 09:17
@wzssyqa
Copy link
Contributor

wzssyqa commented May 9, 2025

LGTM. I will update the expandFMINIMUMNUM_FMAXIMUMNUM to respect this change.

wzssyqa added a commit to wzssyqa/llvm-project that referenced this pull request May 9, 2025
New LangRef doesn't requires quieting for NaN vs NaN, aka
the result may be sNaN for sNaN vs NaN.
See: llvm#139228
@wzssyqa
Copy link
Contributor

wzssyqa commented May 15, 2025

@arsenm OK to merge?

@arsenm arsenm merged commit ab119ad into main May 15, 2025
15 checks passed
@arsenm arsenm deleted the users/arsenm/langref/fix-phasing-minimumnum-maximumnum branch May 15, 2025 07:07
wzssyqa added a commit to wzssyqa/llvm-project that referenced this pull request Jun 3, 2025
New LangRef doesn't requires quieting for NaN vs NaN, aka
the result may be sNaN for sNaN vs NaN.
See: llvm#139228
wzssyqa added a commit that referenced this pull request Jun 4, 2025
…39237)

New LangRef doesn't requires quieting for NaN vs NaN, aka the result may
be sNaN for sNaN vs NaN.
See: #139228
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Jun 4, 2025
… vs NaN (#139237)

New LangRef doesn't requires quieting for NaN vs NaN, aka the result may
be sNaN for sNaN vs NaN.
See: llvm/llvm-project#139228
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
floating-point Floating-point math llvm:ir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants