@@ -112,8 +112,7 @@ using namespace llvm;
112
112
RISCVRegisterBankInfo::RISCVRegisterBankInfo (unsigned HwMode)
113
113
: RISCVGenRegisterBankInfo(HwMode) {}
114
114
115
- static const RegisterBankInfo::ValueMapping *
116
- getFPValueMapping (unsigned Size, bool HasFPExt = true ) {
115
+ static const RegisterBankInfo::ValueMapping *getFPValueMapping (unsigned Size) {
117
116
unsigned Idx;
118
117
switch (Size) {
119
118
default :
@@ -122,10 +121,10 @@ getFPValueMapping(unsigned Size, bool HasFPExt = true) {
122
121
Idx = RISCV::FPRB16Idx;
123
122
break ;
124
123
case 32 :
125
- Idx = HasFPExt ? RISCV::FPRB32Idx : RISCV::GPRB32Idx ;
124
+ Idx = RISCV::FPRB32Idx;
126
125
break ;
127
126
case 64 :
128
- Idx = HasFPExt ? RISCV::FPRB64Idx : RISCV::GPRB64Idx ;
127
+ Idx = RISCV::FPRB64Idx;
129
128
break ;
130
129
}
131
130
return &RISCV::ValueMappings[Idx];
@@ -220,9 +219,6 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
220
219
const TargetSubtargetInfo &STI = MF.getSubtarget ();
221
220
const TargetRegisterInfo &TRI = *STI.getRegisterInfo ();
222
221
223
- // D and Zfh extension implies F.
224
- bool HasFPExt = STI.hasFeature (RISCV::FeatureStdExtF);
225
-
226
222
unsigned GPRSize = getMaximumSize (RISCV::GPRBRegBankID);
227
223
assert ((GPRSize == 32 || GPRSize == 64 ) && " Unexpected GPR size" );
228
224
@@ -270,7 +266,7 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
270
266
if (Ty.isVector ())
271
267
Mapping = getVRBValueMapping (Size.getKnownMinValue ());
272
268
else if (isPreISelGenericFloatingPointOpcode (Opc))
273
- Mapping = getFPValueMapping (Size.getFixedValue (), HasFPExt );
269
+ Mapping = getFPValueMapping (Size.getFixedValue ());
274
270
else
275
271
Mapping = GPRValueMapping;
276
272
@@ -305,7 +301,7 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
305
301
if (DstTy.isVector ())
306
302
Mapping = getVRBValueMapping (DstMinSize);
307
303
else if (anyUseOnlyUseFP (Dst, MRI, TRI))
308
- Mapping = getFPValueMapping (DstMinSize, HasFPExt );
304
+ Mapping = getFPValueMapping (DstMinSize);
309
305
310
306
return getInstructionMapping (DefaultMappingID, /* Cost=*/ 1 , Mapping,
311
307
NumOperands);
@@ -343,7 +339,7 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
343
339
// assume this was a floating point load in the IR. If it was
344
340
// not, we would have had a bitcast before reaching that
345
341
// instruction.
346
- OpdsMapping[0 ] = getFPValueMapping (Size, HasFPExt );
342
+ OpdsMapping[0 ] = getFPValueMapping (Size);
347
343
break ;
348
344
}
349
345
@@ -371,7 +367,7 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
371
367
372
368
MachineInstr *DefMI = MRI.getVRegDef (MI.getOperand (0 ).getReg ());
373
369
if (onlyDefinesFP (*DefMI, MRI, TRI))
374
- OpdsMapping[0 ] = getFPValueMapping (Ty.getSizeInBits (), HasFPExt );
370
+ OpdsMapping[0 ] = getFPValueMapping (Ty.getSizeInBits ());
375
371
break ;
376
372
}
377
373
case TargetOpcode::G_SELECT: {
@@ -436,7 +432,7 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
436
432
437
433
const ValueMapping *Mapping = GPRValueMapping;
438
434
if (NumFP >= 2 )
439
- Mapping = getFPValueMapping (Ty.getSizeInBits (), HasFPExt );
435
+ Mapping = getFPValueMapping (Ty.getSizeInBits ());
440
436
441
437
OpdsMapping[0 ] = OpdsMapping[2 ] = OpdsMapping[3 ] = Mapping;
442
438
break ;
@@ -448,13 +444,13 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
448
444
case RISCV::G_FCLASS: {
449
445
LLT Ty = MRI.getType (MI.getOperand (1 ).getReg ());
450
446
OpdsMapping[0 ] = GPRValueMapping;
451
- OpdsMapping[1 ] = getFPValueMapping (Ty.getSizeInBits (), HasFPExt );
447
+ OpdsMapping[1 ] = getFPValueMapping (Ty.getSizeInBits ());
452
448
break ;
453
449
}
454
450
case TargetOpcode::G_SITOFP:
455
451
case TargetOpcode::G_UITOFP: {
456
452
LLT Ty = MRI.getType (MI.getOperand (0 ).getReg ());
457
- OpdsMapping[0 ] = getFPValueMapping (Ty.getSizeInBits (), HasFPExt );
453
+ OpdsMapping[0 ] = getFPValueMapping (Ty.getSizeInBits ());
458
454
OpdsMapping[1 ] = GPRValueMapping;
459
455
break ;
460
456
}
@@ -472,7 +468,7 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
472
468
LLT Ty = MRI.getType (MI.getOperand (0 ).getReg ());
473
469
if (GPRSize == 32 && Ty.getSizeInBits () == 64 ) {
474
470
assert (MF.getSubtarget <RISCVSubtarget>().hasStdExtD ());
475
- OpdsMapping[0 ] = getFPValueMapping (Ty.getSizeInBits (), HasFPExt );
471
+ OpdsMapping[0 ] = getFPValueMapping (Ty.getSizeInBits ());
476
472
OpdsMapping[1 ] = GPRValueMapping;
477
473
OpdsMapping[2 ] = GPRValueMapping;
478
474
}
@@ -485,7 +481,7 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
485
481
assert (MF.getSubtarget <RISCVSubtarget>().hasStdExtD ());
486
482
OpdsMapping[0 ] = GPRValueMapping;
487
483
OpdsMapping[1 ] = GPRValueMapping;
488
- OpdsMapping[2 ] = getFPValueMapping (Ty.getSizeInBits (), HasFPExt );
484
+ OpdsMapping[2 ] = getFPValueMapping (Ty.getSizeInBits ());
489
485
}
490
486
break ;
491
487
}
@@ -499,7 +495,7 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
499
495
if ((GPRSize == 32 && ScalarTy.getSizeInBits () == 64 ) ||
500
496
onlyDefinesFP (*DefMI, MRI, TRI)) {
501
497
assert (MF.getSubtarget <RISCVSubtarget>().hasStdExtD ());
502
- OpdsMapping[1 ] = getFPValueMapping (ScalarTy.getSizeInBits (), HasFPExt );
498
+ OpdsMapping[1 ] = getFPValueMapping (ScalarTy.getSizeInBits ());
503
499
} else
504
500
OpdsMapping[1 ] = GPRValueMapping;
505
501
break ;
@@ -518,7 +514,7 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
518
514
OpdsMapping[Idx] =
519
515
getVRBValueMapping (Ty.getSizeInBits ().getKnownMinValue ());
520
516
else if (isPreISelGenericFloatingPointOpcode (Opc))
521
- OpdsMapping[Idx] = getFPValueMapping (Ty.getSizeInBits (), HasFPExt );
517
+ OpdsMapping[Idx] = getFPValueMapping (Ty.getSizeInBits ());
522
518
else
523
519
OpdsMapping[Idx] = GPRValueMapping;
524
520
}
0 commit comments