[llvm] [RISCV][GlobalISel] Legalize Scalable Vector Loads and Stores (PR #84965)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 16:14:17 PDT 2024


================
@@ -279,7 +314,29 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
   } else if (ST.hasStdExtD()) {
     LoadStoreActions.legalForTypesWithMemDesc({{s64, p0, s64, 64}});
   }
-  LoadStoreActions.clampScalar(0, s32, sXLen).lower();
+  if (ST.hasVInstructions() && ST.getELen() == 64)
+    LoadStoreActions.legalForTypesWithMemDesc({{nxv1s8, p0, nxv1s8, 8},
+                                               {nxv1s16, p0, nxv1s16, 16},
+                                               {nxv1s32, p0, nxv1s32, 32}});
+
+  if (ST.hasVInstructionsI64())
+    LoadStoreActions.legalForTypesWithMemDesc({{nxv1s64, p0, nxv1s64, 64},
+                                               {nxv2s64, p0, nxv2s64, 64},
+                                               {nxv4s64, p0, nxv4s64, 64},
+                                               {nxv8s64, p0, nxv8s64, 64}});
+
+  LoadStoreActions.widenScalarToNextPow2(0, /* MinSize = */ 8)
+      .lowerIfMemSizeNotByteSizePow2()
+      .customIf(all(LegalityPredicate([=](const LegalityQuery &Query) {
+                      LLT Type = Query.Types[0];
+                      return Type.isScalableVector();
+                    }),
+                    LegalityPredicate(LegalityPredicates::any(
----------------
michaelmaitland wrote:

Is the `isScalableVector` predicate redundant with the `typeIsLegalXXXVec` checks?

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


More information about the llvm-commits mailing list