summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <efriedma@codeaurora.org>2018-06-08 21:33:33 +0000
committerEli Friedman <efriedma@codeaurora.org>2018-06-08 21:33:33 +0000
commitc065bb29531dd716256b0bc43f5fead262cae27a (patch)
treec6acfca97f1bce5a3ee75088f0f67afa6fb3b965
parent2c7a81b2f8c5e65d61a06a815c48cc9e4a47f807 (diff)
downloadbcm5719-llvm-c065bb29531dd716256b0bc43f5fead262cae27a.tar.gz
bcm5719-llvm-c065bb29531dd716256b0bc43f5fead262cae27a.zip
[LangRef] fptosi and fptoui return poison on overflow.
I think we assume poison, not undef, for certain transforms we currently do. In any case, we should clarify the language here. (This sort of conversion is undefined behavior according to the C and C++ standards. And in practice, hardware implementations handle overflow inconsistently, so it would be difficult to define the result here.) Differential Revision: https://reviews.llvm.org/D47851 llvm-svn: 334326
-rw-r--r--llvm/docs/LangRef.rst14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 12490e91ecd..3d252e39f17 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -3275,13 +3275,15 @@ The following is the syntax for constant expressions:
integer constant. TYPE must be a scalar or vector integer type. CST
must be of scalar or vector floating-point type. Both CST and TYPE
must be scalars, or vectors of the same number of elements. If the
- value won't fit in the integer type, the results are undefined.
+ value won't fit in the integer type, the result is a
+ :ref:`poison value <poisonvalues>`.
``fptosi (CST to TYPE)``
Convert a floating-point constant to the corresponding signed
integer constant. TYPE must be a scalar or vector integer type. CST
must be of scalar or vector floating-point type. Both CST and TYPE
must be scalars, or vectors of the same number of elements. If the
- value won't fit in the integer type, the results are undefined.
+ value won't fit in the integer type, the result is a
+ :ref:`poison value <poisonvalues>`.
``uitofp (CST to TYPE)``
Convert an unsigned integer constant to the corresponding
floating-point constant. TYPE must be a scalar or vector floating-point
@@ -8765,8 +8767,8 @@ Semantics:
The '``fptoui``' instruction converts its :ref:`floating-point
<t_floating>` operand into the nearest (rounding towards zero)
-unsigned integer value. If the value cannot fit in ``ty2``, the results
-are undefined.
+unsigned integer value. If the value cannot fit in ``ty2``, the result
+is a :ref:`poison value <poisonvalues>`.
Example:
""""""""
@@ -8807,8 +8809,8 @@ Semantics:
The '``fptosi``' instruction converts its :ref:`floating-point
<t_floating>` operand into the nearest (rounding towards zero)
-signed integer value. If the value cannot fit in ``ty2``, the results
-are undefined.
+signed integer value. If the value cannot fit in ``ty2``, the result
+is a :ref:`poison value <poisonvalues>`.
Example:
""""""""
OpenPOWER on IntegriCloud