[llvm-branch-commits] [llvm] [llubi] Add support for vp.strided.load and vp.strided.store (PR #241715)
Luke Lau via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Nov 12 22:12:39 PST 2026
================
@@ -1075,6 +1075,35 @@ class InstExecutor : public InstVisitor<InstExecutor, void>,
std::move(Data), Mode, IsStore);
}
+ /// Implements llvm.experimental.vp.strided.{load,store} as a vp.gather or
+ /// vp.scatter of the pointers <Ptr, Ptr + Stride, Ptr + 2 * Stride, ...>.
+ /// \p Stride is signed and the arithmetic wraps in the pointer index type. An
+ /// align attribute on the base pointer applies to every lane's pointer.
+ AnyValue callVPStridedLoadStoreIntrinsic(CallBase &CB, const AnyValue &Ptr,
+ const AnyValue &Stride,
+ const AnyValue &Mask,
+ const AnyValue &EVL, AnyValue Data,
+ bool IsStore) {
+ const unsigned IndexBW =
+ DL.getIndexTypeSizeInBits(CB.getArgOperand(IsStore ? 1 : 0)->getType());
+ std::vector<AnyValue> LanePtrs(Mask.asAggregate().size(),
+ AnyValue::poison());
+ if (!Stride.isPoison()) {
+ const APInt StrideIdx = Stride.asInteger().sextOrTrunc(IndexBW);
+ for (auto [I, LanePtr] : enumerate(LanePtrs)) {
+ AnyValue AccumulatedOffset = AnyValue::poison();
+ LanePtr = Ctx.computePtrAdd(Ptr, StrideIdx * APInt(IndexBW, I),
+ GEPNoWrapFlags::none(), AccumulatedOffset);
+ }
+ }
+ AnyValue Ptrs(std::move(LanePtrs));
+ if (MaybeAlign Alignment = CB.getParamAlign(IsStore ? 1 : 0))
----------------
lukel97 wrote:
Yeah that does seem too strict, it should probably only be on the base pointer. Will fix
https://github.com/llvm/llvm-project/pull/241715
More information about the llvm-branch-commits
mailing list