diff options
Diffstat (limited to 'llvm/docs/LangRef.rst')
| -rw-r--r-- | llvm/docs/LangRef.rst | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index d2a1821efd69..371f356c80b0 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -3240,12 +3240,24 @@ as follows: as :ref:`Non-Integral Pointer Type <nointptrtype>` s. The ``0`` address space cannot be specified as non-integral. -Unless explicitly stated otherwise, on every specification that specifies -an alignment, the value of the alignment must be in the range [1,2^16) -and must be a power of two times the width of a byte. -On every specification that takes a ``<abi>:<pref>``, specifying the -``<pref>`` alignment is optional. If omitted, the preceding ``:`` -should be omitted too and ``<pref>`` will be equal to ``<abi>``. +``<abi>`` is a lower bound on what is required for a type to be considered +aligned. This is used in various places, such as: + +- The alignment for loads and stores if none is explicitly given. +- The alignment used to compute struct layout. +- The alignment used to compute allocation sizes and thus ``getelementptr`` + offsets. +- The alignment below which accesses are considered underaligned. + +``<pref>`` allows providing a more optimal alignment that should be used when +possible, primarily for ``alloca`` and the alignment of global variables. It is +an optional value that must be greater than or equal to ``<abi>``. If omitted, +the preceding ``:`` should also be omitted and ``<pref>`` will be equal to +``<abi>``. + +Unless explicitly stated otherwise, every alignment specification is provided in +bits and must be in the range [1,2^16). The value must be a power of two times +the width of a byte (i.e. ``align = 8 * 2^N``). When constructing the data layout for a given target, LLVM starts with a default set of specifications which are then (possibly) overridden by @@ -4855,7 +4867,7 @@ to be eliminated. This is because '``poison``' is stronger than '``undef``'. %D = undef %E = icmp slt %D, 4 - %F = icmp gte %D, 4 + %F = icmp sge %D, 4 Safe: %A = undef @@ -11281,7 +11293,7 @@ If the ``load`` is marked as ``atomic``, it takes an extra :ref:`ordering Atomic loads produce :ref:`defined <memmodel>` results when they may see multiple atomic stores. The type of the pointee must be an integer, pointer, or floating-point type whose bit width is a power of two greater than or equal to -eight and less than or equal to a target-specific size limit. ``align`` must be +eight. ``align`` must be explicitly specified on atomic loads. Note: if the alignment is not greater or equal to the size of the `<value>` type, the atomic operation is likely to require a lock and have poor performance. ``!nontemporal`` does not have any @@ -11422,7 +11434,7 @@ If the ``store`` is marked as ``atomic``, it takes an extra :ref:`ordering Atomic loads produce :ref:`defined <memmodel>` results when they may see multiple atomic stores. The type of the pointee must be an integer, pointer, or floating-point type whose bit width is a power of two greater than or equal to -eight and less than or equal to a target-specific size limit. ``align`` must be +eight. ``align`` must be explicitly specified on atomic stores. Note: if the alignment is not greater or equal to the size of the `<value>` type, the atomic operation is likely to require a lock and have poor performance. ``!nontemporal`` does not have any @@ -11567,8 +11579,8 @@ There are three arguments to the '``cmpxchg``' instruction: an address to operate on, a value to compare to the value currently be at that address, and a new value to place at that address if the compared values are equal. The type of '<cmp>' must be an integer or pointer type whose -bit width is a power of two greater than or equal to eight and less -than or equal to a target-specific size limit. '<cmp>' and '<new>' must +bit width is a power of two greater than or equal to eight. +'<cmp>' and '<new>' must have the same type, and the type of '<pointer>' must be a pointer to that type. If the ``cmpxchg`` is marked as ``volatile``, then the optimizer is not allowed to modify the number or order of execution of @@ -11681,8 +11693,8 @@ operation. The operation must be one of the following keywords: - usub_sat For most of these operations, the type of '<value>' must be an integer -type whose bit width is a power of two greater than or equal to eight -and less than or equal to a target-specific size limit. For xchg, this +type whose bit width is a power of two greater than or equal to eight. +For xchg, this may also be a floating point or a pointer type with the same size constraints as integers. For fadd/fsub/fmax/fmin/fmaximum/fminimum, this must be a floating-point or fixed vector of floating-point type. The type of the '``<pointer>``' @@ -28302,9 +28314,9 @@ Overview: The '``llvm.experimental.constrained.lrint``' intrinsic returns the first argument rounded to the nearest integer. An inexact floating-point exception -will be raised if the argument is not an integer. An invalid exception is -raised if the result is too large to fit into a supported integer type, -and in this case the result is undefined. +will be raised if the argument is not an integer. If the rounded value is too +large to fit into the result type, an invalid exception is raised, and the +return value is a non-deterministic value (equivalent to `freeze poison`). Arguments: """""""""" @@ -28350,9 +28362,9 @@ Overview: The '``llvm.experimental.constrained.llrint``' intrinsic returns the first argument rounded to the nearest integer. An inexact floating-point exception -will be raised if the argument is not an integer. An invalid exception is -raised if the result is too large to fit into a supported integer type, -and in this case the result is undefined. +will be raised if the argument is not an integer. If the rounded value is too +large to fit into the result type, an invalid exception is raised, and the +return value is a non-deterministic value (equivalent to `freeze poison`). Arguments: """""""""" @@ -28701,8 +28713,9 @@ Overview: The '``llvm.experimental.constrained.lround``' intrinsic returns the first argument rounded to the nearest integer with ties away from zero. It will raise an inexact floating-point exception if the argument is not an integer. -An invalid exception is raised if the result is too large to fit into a -supported integer type, and in this case the result is undefined. +If the rounded value is too large to fit into the result type, an invalid +exception is raised, and the return value is a non-deterministic value +(equivalent to `freeze poison`). Arguments: """""""""" @@ -28739,8 +28752,9 @@ Overview: The '``llvm.experimental.constrained.llround``' intrinsic returns the first argument rounded to the nearest integer with ties away from zero. It will raise an inexact floating-point exception if the argument is not an integer. -An invalid exception is raised if the result is too large to fit into a -supported integer type, and in this case the result is undefined. +If the rounded value is too large to fit into the result type, an invalid +exception is raised, and the return value is a non-deterministic value +(equivalent to `freeze poison`). Arguments: """""""""" |
