Skip to content

Commit ed73d4a

Browse files
committed
[FPEnv] Document that constrained FP intrinsics cannot be mixed with non-constrained
Reviewed by: andrew.w.kaylor, cameron.mcinally, uweigand Approved by: andrew.w.kaylor Differential Revision: https://reviews.llvm.org/D67360 llvm-svn: 371888
1 parent d93e136 commit ed73d4a

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

llvm/docs/LangRef.rst

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15064,12 +15064,21 @@ Constrained FP intrinsics are used to support non-default rounding modes and
1506415064
accurately preserve exception behavior without compromising LLVM's ability to
1506515065
optimize FP code when the default behavior is used.
1506615066

15067-
Each of these intrinsics corresponds to a normal floating-point operation. The
15068-
first two arguments and the return value are the same as the corresponding FP
15067+
If any FP operation in a function is constrained then they all must be
15068+
constrained. This is required for correct LLVM IR. Optimizations that
15069+
move code around can create miscompiles if mixing of constrained and normal
15070+
operations is done. The correct way to mix constrained and less constrained
15071+
operations is to use the rounding mode and exception handling metadata to
15072+
mark constrained intrinsics as having LLVM's default behavior.
15073+
15074+
Each of these intrinsics corresponds to a normal floating-point operation. The
15075+
data arguments and the return value are the same as the corresponding FP
1506915076
operation.
1507015077

15071-
The third argument is a metadata argument specifying the rounding mode to be
15072-
assumed. This argument must be one of the following strings:
15078+
The rounding mode argument is a metadata string specifying what
15079+
assumptions, if any, the optimizer can make when transforming constant
15080+
values. Some constrained FP intrinsics omit this argument. If required
15081+
by the intrinsic, this argument must be one of the following strings:
1507315082

1507415083
::
1507515084

@@ -15099,9 +15108,9 @@ the specified rounding mode, but this is not guaranteed. Using a specific
1509915108
non-dynamic rounding mode which does not match the actual rounding mode at
1510015109
runtime results in undefined behavior.
1510115110

15102-
The fourth argument to the constrained floating-point intrinsics specifies the
15103-
required exception behavior. This argument must be one of the following
15104-
strings:
15111+
The exception behavior argument is a metadata string describing the floating
15112+
point exception semantics that required for the intrinsic. This argument
15113+
must be one of the following strings:
1510515114

1510615115
::
1510715116

0 commit comments

Comments
 (0)