Skip to content

Commit 141964b

Browse files
authored
[RISCV][GISel] Force atomic G_LOAD/STORE to the GPR register bank. (#162042)
We don't have FPR isel patterns for G_LOAD/STORE so force to the GPR register bank.
1 parent ec0db66 commit 141964b

File tree

2 files changed

+958
-0
lines changed

2 files changed

+958
-0
lines changed

llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
324324

325325
OpdsMapping[0] = GPRValueMapping;
326326

327+
// Atomics always use GPR destinations. Don't refine any further.
328+
if (cast<GLoad>(MI).isAtomic())
329+
break;
330+
327331
// Use FPR64 for s64 loads on rv32.
328332
if (GPRSize == 32 && Size.getFixedValue() == 64) {
329333
assert(MF.getSubtarget<RISCVSubtarget>().hasStdExtD());
@@ -358,6 +362,10 @@ RISCVRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
358362

359363
OpdsMapping[0] = GPRValueMapping;
360364

365+
// Atomics always use GPR sources. Don't refine any further.
366+
if (cast<GStore>(MI).isAtomic())
367+
break;
368+
361369
// Use FPR64 for s64 stores on rv32.
362370
if (GPRSize == 32 && Size.getFixedValue() == 64) {
363371
assert(MF.getSubtarget<RISCVSubtarget>().hasStdExtD());

0 commit comments

Comments
 (0)