[llvm] [VPlan] Introduce recipes for VP loads and stores. (PR #87816)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 18 08:04:16 PDT 2024
================
@@ -2390,13 +2387,49 @@ struct VPWidenLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
bool onlyFirstLaneUsed(const VPValue *Op) const override {
assert(is_contained(operands(), Op) &&
"Op must be an operand of the recipe");
-
- // Widened, consecutive loads operations only demand the first lane of
- // their address.
+ // Widened, consecutive memory operations only demand the first lane of
+ // their address, unless the same operand is also stored. That latter can
+ // happen with opaque pointers.
return Op == getAddr() && isConsecutive();
}
};
+/// A recipe for widening load operations with vector-predication intrinsics,
+/// using the address to load from, the explicit vector length and an optional
+/// mask.
+struct VPWidenVPLoadRecipe final : public VPWidenMemoryRecipe, public VPValue {
+ VPWidenVPLoadRecipe(VPWidenLoadRecipe *L, VPValue *EVL, VPValue *Mask)
+ : VPWidenMemoryRecipe(
+ VPDef::VPWidenVPLoadSC, *cast<LoadInst>(&L->getIngredient()),
+ {L->getAddr(), EVL}, L->isConsecutive(), false, L->getDebugLoc()),
+ VPValue(this, &getIngredient()) {
+ setMask(Mask);
+ }
+
+ VP_CLASSOF_IMPL(VPDef::VPWidenVPLoadSC)
+
+ /// Return the EVL operand.
+ VPValue *getEVL() const { return getOperand(1); }
+
+ /// Generate the wide load/store.
----------------
fhahn wrote:
Done, thanks!
https://github.com/llvm/llvm-project/pull/87816
More information about the llvm-commits
mailing list