Skip to content

[LangRef] Clarify the behavior of select with FP poison-generating flags #137131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions llvm/docs/LangRef.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 presence of value which would otherwise result
in poison does not cause the result to be poison if the value is on the non-selected arm.
If :ref:`fast-math flags <fastmath>` are present, they are only applied to the result,
not both arms.

Semantics:
""""""""""
Expand All @@ -12900,7 +12903,9 @@ 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
%Z = select nnan i1 false, float 0.0, float NaN ; yields float:poison


.. _i_freeze:
Expand Down
Loading