[llvm] [SVE] Wide active lane mask (PR #76514)

Momchil Velikov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 07:53:57 PST 2024


================
@@ -1202,6 +1202,35 @@ class VPInstruction : public VPRecipeWithIRFlags, public VPValue {
   }
 };
 
+class VPActiveLaneMaskRecipe : public VPRecipeWithIRFlags, public VPValue {
+  const std::string Name;
+  ElementCount MaxLength;
+
+public:
+  VPActiveLaneMaskRecipe(VPValue *IV, VPValue *TC, // ElementCount MaxLength,
+                         DebugLoc DL = {}, const Twine &Name = "")
+      : VPRecipeWithIRFlags(VPDef::VPActiveLaneMaskSC,
+                            std::initializer_list<VPValue *>{IV, TC}, DL),
+        VPValue(this), Name(Name.str()) {} //, MaxLength(MaxLength) {}
+
+  VP_CLASSOF_IMPL(VPDef::VPActiveLaneMaskSC)
+
+  void execute(VPTransformState &State) override;
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+  /// Print the recipe.
+  void print(raw_ostream &O, const Twine &Indent,
+             VPSlotTracker &SlotTracker) const override;
+#endif
+
+  bool onlyFirstLaneUsed(const VPValue *Op) const override {
+    assert(is_contained(operands(), Op) &&
+           "Op must be an operand of the recipe");
+
+    return getOperand(0) == Op;
----------------
momchil-velikov wrote:

This class was split out of `VPInstruction`, so I preserved the existing behaviour of `VPInstruction` for the case it contained an active lane mask.

https://github.com/llvm/llvm-project/blob/f1b1611148fa533fe198fec3fa4ef8139224dc80/llvm/lib/Transforms/Vectorize/VPlan.h#L1238


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


More information about the llvm-commits mailing list