# Changeset View

Changeset View

# Standalone View

Standalone View

# llvm/docs/LangRef.rst

- This file is larger than 256 KB, so syntax highlighting is disabled by default.

Show First 20 Lines • Show All 16,924 Lines • ▼ Show 20 Lines | |||||

Semantics: | Semantics: | ||||

"""""""""" | """""""""" | ||||

The '``llvm.get.active.lane.mask.*``' intrinsics are semantically equivalent | The '``llvm.get.active.lane.mask.*``' intrinsics are semantically equivalent | ||||

to: | to: | ||||

:: | :: | ||||

%m[i] = icmp ule (%base + i), %n | %m[i] = icmp ult (%base + i), %n | ||||

where ``%m`` is a vector (mask) of active/inactive lanes with its elements | where ``%m`` is a vector (mask) of active/inactive lanes with its elements | ||||

indexed by ``i``, and ``%base``, ``%n`` are the two arguments to | indexed by ``i``, and ``%base``, ``%n`` are the two arguments to | ||||

``llvm.get.active.lane.mask.*``, ``%imcp`` is an integer compare and ``ule`` | ``llvm.get.active.lane.mask.*``, ``%icmp`` is an integer compare and ``ult`` | ||||

samparker: bah, I missed the 'ule' and there's an original typo: imcp | |||||

the unsigned less-than-equal comparison operator. Overflow cannot occur in | the unsigned less-than comparison operator. Overflow cannot occur in | ||||

``(%base + i)`` and its comparison against ``%n`` as it is performed in integer | ``(%base + i)`` and its comparison against ``%n`` with ``%n > 0``, as it is | ||||

numbers and not in machine numbers. The above is equivalent to: | performed in integer numbers and not in machine numbers. The above is | ||||

equivalent to: | |||||

:: | :: | ||||

%m = @llvm.get.active.lane.mask(%base, %n) | %m = @llvm.get.active.lane.mask(%base, %n) | ||||

This can, for example, be emitted by the loop vectorizer. Then, ``%base`` is | This can, for example, be emitted by the loop vectorizer in which case | ||||

the first element of the vector induction variable (VIV), and ``%n`` is the | ``%base`` is the first element of the vector induction variable (VIV) and | ||||

Back-edge Taken Count (BTC). Thus, these intrinsics perform an element-wise | ``%n`` is the loop tripcount. Thus, these intrinsics perform an element-wise | ||||

less than or equal comparison of VIV with BTC, producing a mask of true/false | less than comparison of VIV with the loop tripcount, producing a mask of | ||||

values representing active/inactive vector lanes, except if the VIV overflows | true/false values representing active/inactive vector lanes, except if the VIV | ||||

in which case they return false in the lanes where the VIV overflows. The | overflows in which case they return false in the lanes where the VIV overflows. | ||||

arguments are scalar types to accommodate scalable vector types, for which it is | The arguments are scalar types to accommodate scalable vector types, for which | ||||

unknown what the type of the step vector needs to be that enumerate its | it is unknown what the type of the step vector needs to be that enumerate its | ||||

lanes without overflow. | lanes without overflow. | ||||

This mask ``%m`` can e.g. be used in masked load/store instructions. These | This mask ``%m`` can e.g. be used in masked load/store instructions. These | ||||

intrinsics provide a hint to the backend. I.e., for a vector loop, the | intrinsics provide a hint to the backend. I.e., for a vector loop, the | ||||

back-edge taken count of the original scalar loop is explicit as the second | back-edge taken count of the original scalar loop is explicit as the second | ||||

argument. | argument. | ||||

▲ Show 20 Lines • Show All 3,802 Lines • Show Last 20 Lines |

bah, I missed the 'ule' and there's an original typo: imcp