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

Yeting Kuo via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 20:45:31 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;
----------------
yetingk wrote:

8fdd86b used splat for fixed vectors and scalable vectors are as usual, but I am not sure it could be better than Luke's  DAG approach.

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


More information about the llvm-commits mailing list