[llvm] [LV][EVL]Support reversed loads/stores. (PR #88025)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 14:03:26 PDT 2024
================
@@ -9385,6 +9376,16 @@ void VPWidenLoadEVLRecipe::execute(VPTransformState &State) {
Value *Mask = getMask()
? State.get(getMask(), 0)
: Builder.CreateVectorSplat(State.VF, Builder.getTrue());
+ if (isReverse() && getMask()) {
+ VectorType *MaskTy = cast<VectorType>(Mask->getType());
+ Mask = Builder.CreateIntrinsic(
+ MaskTy, Intrinsic::experimental_vp_reverse,
+ {Mask,
+ Builder.CreateVectorSplat(MaskTy->getElementCount(),
+ Builder.getTrue()),
+ EVL},
+ nullptr, "vp.reverse.mask");
+ }
----------------
ayalz wrote:
The mask is arguably never masked itself, so reversing it should use an all-true mask.
Could a single AllTrueMask Value be reused, as in:
```suggestion
Value *AllTrueMask = Builder.CreateVectorSplat(State.VF, Builder.getTrue());
Value *Mask = getMask() ? State.get(getMask(), 0) : AllTrueMask;
if (isReverse() && getMask()) {
VectorType *MaskTy = cast<VectorType>(Mask->getType());
Mask = Builder.CreateIntrinsic(MaskTy, Intrinsic::experimental_vp_reverse,
{Mask, AllTrueMask, EVL}, nullptr, "vp.reverse.mask");
}
```
https://github.com/llvm/llvm-project/pull/88025
More information about the llvm-commits
mailing list