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