[llvm] [LV] Support binary and unary operations with EVL-vectorization (PR #93854)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 12:35:03 PDT 2024


================
@@ -1375,6 +1382,45 @@ class VPWidenRecipe : public VPRecipeWithIRFlags {
 #endif
 };
 
+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) {
+    this->transferFlags(*W);
+  }
+
+  ~VPWidenEVLRecipe() override = default;
+
+  VPWidenRecipe *clone() override final {
+    llvm_unreachable("VPWidenStoreEVLRecipe 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 widened copies of all Ingredients.
----------------
fhahn wrote:

I realized that the `VPWidenRecipe` comment was also out-of-date. Updated in e6fdecd29059c0951a4970e9e6cf478972844099, would probably be good to update the comment here as well

https://github.com/llvm/llvm-project/pull/93854


More information about the llvm-commits mailing list