[llvm] [RISCV] Expand vp.stride.load to splat of a scalar load. (PR #98140)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 15:29:59 PDT 2024
================
@@ -155,6 +163,43 @@ bool RISCVCodeGenPrepare::visitIntrinsicInst(IntrinsicInst &I) {
return true;
}
+bool RISCVCodeGenPrepare::expandVPStrideLoad(IntrinsicInst &II) {
+ if (ST->hasOptimizedZeroStrideLoad())
+ return false;
+
+ Value *BasePtr, *VL;
+ using namespace PatternMatch;
+ if (!match(&II, m_Intrinsic<Intrinsic::experimental_vp_strided_load>(
+ m_Value(BasePtr), m_Zero(), m_AllOnes(), m_Value(VL))))
+ return false;
+
+ if (!isKnownNonZero(VL, {*DL, DT, nullptr, &II}))
+ return false;
+
+ auto *VTy = cast<VectorType>(II.getType());
+
+ // FIXME: Support fixed vector types.
+ if (!isa<ScalableVectorType>(VTy))
+ return false;
----------------
topperc wrote:
The original motivation for this patch was for our downstream vectorizer which generates in-loop vsetvlis and vp.strided.load directly. I don't want more VL toggles in the loop.
We could use Luke's original DAG combine patch for the fixed vector case since the EVL there is likely to be a constant.
We could add vp.splat. This isn't the first time I thought about adding it.
We could make riscv.vmv.v.x work with fixed vectors.
https://github.com/llvm/llvm-project/pull/98140
More information about the llvm-commits
mailing list