[llvm] [LangRef] Clarify the behavior of select with FP poison-generating flags (PR #137131)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 24 01:09:47 PDT 2025
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137131
>From bf12fa74839be2e4cb915a97593b55aae4c72891 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Thu, 24 Apr 2025 15:43:04 +0800
Subject: [PATCH 1/2] [LangRef] Clarify the behavior of select with FP
poison-generating flags
---
llvm/docs/LangRef.rst | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 9e78f317bd9ea..fe8eb411612b5 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -12895,12 +12895,16 @@ vectors of the same size, and the selection is done element by element.
If the condition is an i1 and the value arguments are vectors of the
same size, then an entire vector is selected.
+Note that violations of poison-generating flags for both arms may not result in poison return values.
+For simplicity, if :ref:`fast-math flags <fastmath>` are present, they are only applied to the result, not both arms.
+
Example:
""""""""
.. code-block:: llvm
- %X = select i1 true, i8 17, i8 42 ; yields i8:17
+ %X = select i1 true, i8 17, i8 42 ; yields i8:17
+ %Y = select nnan i1 true, float 0.0, float NaN ; yields float:0.0
.. _i_freeze:
>From ed85a5a04e9995fa1c3ebd311d38c234baa6def9 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Thu, 24 Apr 2025 16:09:21 +0800
Subject: [PATCH 2/2] [LangRef] Rephrase the 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 fe8eb411612b5..72ef35604ef06 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -12880,7 +12880,10 @@ class <t_firstclass>` type.
:ref:`fast-math flags <fastmath>`. These are optimization hints to enable
otherwise unsafe floating-point optimizations. Fast-math flags are only valid
for selects that return :ref:`supported floating-point types
- <fastmath_return_types>`.
+ <fastmath_return_types>`. Note that the violation of poison-generating flags on
+ non-selected arm may not result in :ref:`poison <poisonvalues>` return value.
+ For simplicity, if :ref:`fast-math flags <fastmath>` are present, they are only
+ applied to the result, not both arms.
Semantics:
""""""""""
@@ -12895,9 +12898,6 @@ vectors of the same size, and the selection is done element by element.
If the condition is an i1 and the value arguments are vectors of the
same size, then an entire vector is selected.
-Note that violations of poison-generating flags for both arms may not result in poison return values.
-For simplicity, if :ref:`fast-math flags <fastmath>` are present, they are only applied to the result, not both arms.
-
Example:
""""""""
More information about the llvm-commits
mailing list