[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:17:57 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) {
----------------
michaelmaitland wrote:
nit: IIUC the `customIf` is to handle vector types that have non-standard align arguments. If that is an accurate description, could you add a comment clarifying this point for the reader? If someone isn't familiar with the code, it might not be clear why we are doing this special custom legalization for vector types that we addressed above.
https://github.com/llvm/llvm-project/pull/84965
More information about the llvm-commits
mailing list