Index: llvm/docs/LangRef.rst =================================================================== --- llvm/docs/LangRef.rst +++ llvm/docs/LangRef.rst @@ -16924,14 +16924,15 @@ :: - %m[i] = icmp ule (%base + i), %n + %m[i] = icmp ule (%base + i), %n - 1 where ``%m`` is a vector (mask) of active/inactive lanes with its elements indexed by ``i``, and ``%base``, ``%n`` are the two arguments to ``llvm.get.active.lane.mask.*``, ``%imcp`` is an integer compare and ``ule`` the unsigned less-than-equal comparison operator. Overflow cannot occur in -``(%base + i)`` and its comparison against ``%n`` as it is performed in integer -numbers and not in machine numbers. The above is equivalent to: +``(%base + i)`` and its comparison against ``%n`` with ``%n > 0``, as it is +performed in integer numbers and not in machine numbers. The above is +equivalent to: :: @@ -16939,13 +16940,13 @@ This can, for example, be emitted by the loop vectorizer. Then, ``%base`` is the first element of the vector induction variable (VIV), and ``%n`` is the -Back-edge Taken Count (BTC). Thus, these intrinsics perform an element-wise -less than or equal comparison of VIV with BTC, producing a mask of true/false -values representing active/inactive vector lanes, except if the VIV overflows -in which case they return false in the lanes where the VIV overflows. The -arguments are scalar types to accommodate scalable vector types, for which it is -unknown what the type of the step vector needs to be that enumerate its -lanes without overflow. +loop tripcount. Since ``%n - 1`` corresponds to the Back-edge Taken Count +(BTC), these intrinsics perform an element-wise less than or equal comparison +of VIV with BTC, producing a mask of true/false values representing +active/inactive vector lanes, except if the VIV overflows in which case they +return false in the lanes where the VIV overflows. The arguments are scalar +types to accommodate scalable vector types, for which it is unknown what the +type of the step vector needs to be that enumerate its lanes without overflow. 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