[llvm] [LV] Support binary and unary operations with EVL-vectorization (PR #93854)
Kolya Panchenko via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 08:53:58 PDT 2024
================
@@ -1443,6 +1458,54 @@ class VPWidenRecipe : public VPRecipeWithIRFlags {
#endif
};
+/// A recipe for widening operations with vector-predication intrinsics with
+/// explicit vector length (EVL).
+class VPWidenEVLRecipe : public VPWidenRecipe {
+ using VPRecipeWithIRFlags::transferFlags;
+
+public:
+ template <typename IterT>
+ VPWidenEVLRecipe(Instruction &I, iterator_range<IterT> Operands, VPValue &EVL)
+ : VPWidenRecipe(VPDef::VPWidenEVLSC, I, Operands) {
+ addOperand(&EVL);
+ }
+ VPWidenEVLRecipe(VPWidenRecipe &W, VPValue &EVL)
+ : VPWidenEVLRecipe(*W.getUnderlyingInstr(), W.operands(), EVL) {
+ transferFlags(W);
+ }
+
+ ~VPWidenEVLRecipe() override = default;
+
+ VPWidenRecipe *clone() override final {
+ llvm_unreachable("VPWidenEVLRecipe cannot be cloned");
+ return nullptr;
+ }
+
+ VP_CLASSOF_IMPL(VPDef::VPWidenEVLSC);
+
+ VPValue *getEVL() { return getOperand(getNumOperands() - 1); }
+ const VPValue *getEVL() const { return getOperand(getNumOperands() - 1); }
+
+ /// Produce a vp-intrinsic using the opcode and operands of the recipe,
+ /// processing EVL elements.
+ void execute(VPTransformState &State) override final;
+
+ /// Returns true if the recipe only uses the first lane of operand \p Op.
+ bool onlyFirstLaneUsed(const VPValue *Op) const override {
+ assert(is_contained(operands(), Op) &&
+ "Op must be an operand of the recipe");
+ // EVL in that recipe is always the last operand, thus any use before means
----------------
nikolaypanchenko wrote:
Sure. I will create PR with verification I added and removed previously
https://github.com/llvm/llvm-project/pull/93854
More information about the llvm-commits
mailing list