[llvm] [RISCV] Expand vp.stride.load to splat of a scalar load. (PR #98140)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 20:40:10 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;
----------------
lukel97 wrote:

I think vp.splat makes sense to have, if we already have vp.splice and vp.reverse for the other shufflevector patterns.

I think we should go ahead with this PR with or without the fixed vector case though, I would prefer it over the DAG combine since its more powerful

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


More information about the llvm-commits mailing list