New intrinsic @llvm.get.active.lane.mask()

Authored by SjoerdMeijer on May 29 2020, 12:27 AM.


New intrinsic @llvm.get.active.lane.mask()

This is split off from D79100 and:

  • adds a intrinsic description/definition for @llvm.get.active.lane.mask(), and
  • describe its semantics in LangRef.

As described (in more detail) in its LangRef section, it is semantically
equivalent to an icmp with the vector induction variable and the back-edge
taken count, and generates a mask of active/inactive vector lanes.

It will have several use cases. First, it will be used by the
ExpandVectorPredication pass for the VP intrinsics, to expand VP intrinsics for
scalable vectors on targets that do not support the %evl parameter, see

Also, this is part of, and essential for our ARM MVE tail-predication story:

  • this intrinsic will be emitted by the LoopVectorizer in D79100, when the scalar epilogue is tail-folded into the vector body. This new intrinsic will generate the predicate for the masked loads/stores, and it takes the back-edge taken count as an argument. The back-edge taken count represents the number of elements processed by the loop, which we need to setup MVE tail-predication.
  • Emitting the intrinsic is controlled by a new TTI hook, see D80597.
  • We pick up this new intrinsic in an ARM MVETailPredication backend pass, see D79175, and convert it to a MVE target specific intrinsic/instruction to create a tail-predicated loop.

Differential Revision: https://reviews.llvm.org/D80596


SjoerdMeijerMay 29 2020, 12:51 AM
Differential Revision
D80596: New intrinsic @llvm.get.active.lane.mask()
rGa3418631e8aa: libclc: update website url