OSDN Git Service

New intrinsic @llvm.get.active.lane.mask()
authorSjoerd Meijer <sjoerd.meijer@arm.com>
Fri, 29 May 2020 07:27:22 +0000 (08:27 +0100)
committerSjoerd Meijer <sjoerd.meijer@arm.com>
Fri, 29 May 2020 07:51:40 +0000 (08:51 +0100)
commit7fb8a40e5220d6d4efa14c15f92b6f28ba1b18f7
tree5ae34ae690c0e4612021049c15003ccd82af68c4
parenta3418631e8aa0941b8b57ec2fc3b8d0c7db493be
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
D78203.

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
llvm/docs/LangRef.rst
llvm/include/llvm/IR/Intrinsics.td
llvm/lib/IR/Verifier.cpp
llvm/test/Verifier/get-active-lane-mask.ll [new file with mode: 0644]