@@ -310,10 +310,18 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
310
310
switch (Opc) {
311
311
case TargetOpcode::G_LOAD: {
312
312
LLT Ty = MRI.getType (MI.getOperand (0 ).getReg ());
313
- OpdsMapping[0 ] = GPRValueMapping;
313
+ TypeSize Size = Ty.getSizeInBits ();
314
+ if (Ty.isVector ())
315
+ OpdsMapping[0 ] = getVRBValueMapping (Size.getKnownMinValue ());
316
+ else
317
+ OpdsMapping[0 ] = GPRValueMapping;
318
+
314
319
OpdsMapping[1 ] = GPRValueMapping;
320
+
321
+ if (Ty.isVector ())
322
+ break ;
315
323
// Use FPR64 for s64 loads on rv32.
316
- if (GPRSize == 32 && Ty. getSizeInBits () == 64 ) {
324
+ if (GPRSize == 32 && Size. getFixedValue () == 64 ) {
317
325
assert (MF.getSubtarget <RISCVSubtarget>().hasStdExtD ());
318
326
OpdsMapping[0 ] = getFPValueMapping (Ty.getSizeInBits ());
319
327
break ;
@@ -333,10 +341,19 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
333
341
}
334
342
case TargetOpcode::G_STORE: {
335
343
LLT Ty = MRI.getType (MI.getOperand (0 ).getReg ());
336
- OpdsMapping[0 ] = GPRValueMapping;
344
+ TypeSize Size = Ty.getSizeInBits ();
345
+ if (Ty.isVector ())
346
+ OpdsMapping[0 ] = getVRBValueMapping (Size.getKnownMinValue ());
347
+ else
348
+ OpdsMapping[0 ] = GPRValueMapping;
349
+
337
350
OpdsMapping[1 ] = GPRValueMapping;
351
+
352
+ if (Ty.isVector ())
353
+ break ;
354
+
338
355
// Use FPR64 for s64 stores on rv32.
339
- if (GPRSize == 32 && Ty. getSizeInBits () == 64 ) {
356
+ if (GPRSize == 32 && Size. getFixedValue () == 64 ) {
340
357
assert (MF.getSubtarget <RISCVSubtarget>().hasStdExtD ());
341
358
OpdsMapping[0 ] = getFPValueMapping (Ty.getSizeInBits ());
342
359
break ;
0 commit comments