[llvm] [GISEL][RISCV] RegBank Scalable Vector Load/Store (PR #99932)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 20:47:35 PDT 2024


================
@@ -310,10 +310,15 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
   switch (Opc) {
   case TargetOpcode::G_LOAD: {
     LLT Ty = MRI.getType(MI.getOperand(0).getReg());
-    OpdsMapping[0] = GPRValueMapping;
+    TypeSize Size = Ty.getSizeInBits();
+    if (Ty.isVector())
+      OpdsMapping[0] = getVRBValueMapping(Size.getKnownMinValue());
+    else
+      OpdsMapping[0] = GPRValueMapping;
+
     OpdsMapping[1] = GPRValueMapping;
     // Use FPR64 for s64 loads on rv32.
-    if (GPRSize == 32 && Ty.getSizeInBits() == 64) {
+    if (!Ty.isVector() && GPRSize == 32 && Size.getFixedValue() == 64) {
       assert(MF.getSubtarget<RISCVSubtarget>().hasStdExtD());
       OpdsMapping[0] = getFPValueMapping(Ty.getSizeInBits());
       break;
----------------
topperc wrote:

We need to check !VT.isVector() before calling `anyUseOnlyUseFP` late. Maybe easiest to `break` early for `VT.isVector()`?

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


More information about the llvm-commits mailing list