forked from OSchip/llvm-project
AMDGPU: Use appropriate soffset for spilling
This needs to be the frame offset register, and not the global scratch wave offset register. For kernels, these are the same. llvm-svn: 303287
This commit is contained in:
parent
f084f6d7d1
commit
ea8a4ed588
|
@ -765,7 +765,7 @@ void SIInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
|
|||
.addFrameIndex(FrameIndex) // addr
|
||||
.addMemOperand(MMO)
|
||||
.addReg(MFI->getScratchRSrcReg(), RegState::Implicit)
|
||||
.addReg(MFI->getScratchWaveOffsetReg(), RegState::Implicit);
|
||||
.addReg(MFI->getFrameOffsetReg(), RegState::Implicit);
|
||||
// Add the scratch resource registers as implicit uses because we may end up
|
||||
// needing them, and need to ensure that the reserved registers are
|
||||
// correctly handled.
|
||||
|
@ -796,7 +796,7 @@ void SIInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
|
|||
.addReg(SrcReg, getKillRegState(isKill)) // data
|
||||
.addFrameIndex(FrameIndex) // addr
|
||||
.addReg(MFI->getScratchRSrcReg()) // scratch_rsrc
|
||||
.addReg(MFI->getScratchWaveOffsetReg()) // scratch_offset
|
||||
.addReg(MFI->getFrameOffsetReg()) // scratch_offset
|
||||
.addImm(0) // offset
|
||||
.addMemOperand(MMO);
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ void SIInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|||
.addFrameIndex(FrameIndex) // addr
|
||||
.addMemOperand(MMO)
|
||||
.addReg(MFI->getScratchRSrcReg(), RegState::Implicit)
|
||||
.addReg(MFI->getScratchWaveOffsetReg(), RegState::Implicit);
|
||||
.addReg(MFI->getFrameOffsetReg(), RegState::Implicit);
|
||||
|
||||
if (ST.hasScalarStores()) {
|
||||
// m0 is used for offset to scalar stores if used to spill.
|
||||
|
@ -892,10 +892,10 @@ void SIInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|||
|
||||
unsigned Opcode = getVGPRSpillRestoreOpcode(SpillSize);
|
||||
BuildMI(MBB, MI, DL, get(Opcode), DestReg)
|
||||
.addFrameIndex(FrameIndex) // vaddr
|
||||
.addReg(MFI->getScratchRSrcReg()) // scratch_rsrc
|
||||
.addReg(MFI->getScratchWaveOffsetReg()) // scratch_offset
|
||||
.addImm(0) // offset
|
||||
.addFrameIndex(FrameIndex) // vaddr
|
||||
.addReg(MFI->getScratchRSrcReg()) // scratch_rsrc
|
||||
.addReg(MFI->getFrameOffsetReg()) // scratch_offset
|
||||
.addImm(0) // offset
|
||||
.addMemOperand(MMO);
|
||||
}
|
||||
|
||||
|
|
|
@ -654,11 +654,11 @@ bool SIRegisterInfo::spillSGPR(MachineBasicBlock::iterator MI,
|
|||
int64_t Offset = (ST.getWavefrontSize() * FrOffset) + (EltSize * i);
|
||||
if (Offset != 0) {
|
||||
BuildMI(*MBB, MI, DL, TII->get(AMDGPU::S_ADD_U32), OffsetReg)
|
||||
.addReg(MFI->getScratchWaveOffsetReg())
|
||||
.addReg(MFI->getFrameOffsetReg())
|
||||
.addImm(Offset);
|
||||
} else {
|
||||
BuildMI(*MBB, MI, DL, TII->get(AMDGPU::S_MOV_B32), OffsetReg)
|
||||
.addReg(MFI->getScratchWaveOffsetReg());
|
||||
.addReg(MFI->getFrameOffsetReg());
|
||||
}
|
||||
|
||||
BuildMI(*MBB, MI, DL, TII->get(ScalarStoreOp))
|
||||
|
@ -715,11 +715,11 @@ bool SIRegisterInfo::spillSGPR(MachineBasicBlock::iterator MI,
|
|||
= MF->getMachineMemOperand(PtrInfo, MachineMemOperand::MOStore,
|
||||
EltSize, MinAlign(Align, EltSize * i));
|
||||
BuildMI(*MBB, MI, DL, TII->get(AMDGPU::SI_SPILL_V32_SAVE))
|
||||
.addReg(TmpReg, RegState::Kill) // src
|
||||
.addFrameIndex(Index) // vaddr
|
||||
.addReg(MFI->getScratchRSrcReg()) // srrsrc
|
||||
.addReg(MFI->getScratchWaveOffsetReg()) // soffset
|
||||
.addImm(i * 4) // offset
|
||||
.addReg(TmpReg, RegState::Kill) // src
|
||||
.addFrameIndex(Index) // vaddr
|
||||
.addReg(MFI->getScratchRSrcReg()) // srrsrc
|
||||
.addReg(MFI->getFrameOffsetReg()) // soffset
|
||||
.addImm(i * 4) // offset
|
||||
.addMemOperand(MMO);
|
||||
}
|
||||
}
|
||||
|
@ -806,11 +806,11 @@ bool SIRegisterInfo::restoreSGPR(MachineBasicBlock::iterator MI,
|
|||
int64_t Offset = (ST.getWavefrontSize() * FrOffset) + (EltSize * i);
|
||||
if (Offset != 0) {
|
||||
BuildMI(*MBB, MI, DL, TII->get(AMDGPU::S_ADD_U32), OffsetReg)
|
||||
.addReg(MFI->getScratchWaveOffsetReg())
|
||||
.addReg(MFI->getFrameOffsetReg())
|
||||
.addImm(Offset);
|
||||
} else {
|
||||
BuildMI(*MBB, MI, DL, TII->get(AMDGPU::S_MOV_B32), OffsetReg)
|
||||
.addReg(MFI->getScratchWaveOffsetReg());
|
||||
.addReg(MFI->getFrameOffsetReg());
|
||||
}
|
||||
|
||||
auto MIB =
|
||||
|
@ -853,10 +853,10 @@ bool SIRegisterInfo::restoreSGPR(MachineBasicBlock::iterator MI,
|
|||
MinAlign(Align, EltSize * i));
|
||||
|
||||
BuildMI(*MBB, MI, DL, TII->get(AMDGPU::SI_SPILL_V32_RESTORE), TmpReg)
|
||||
.addFrameIndex(Index) // vaddr
|
||||
.addReg(MFI->getScratchRSrcReg()) // srsrc
|
||||
.addReg(MFI->getScratchWaveOffsetReg()) // soffset
|
||||
.addImm(i * 4) // offset
|
||||
.addFrameIndex(Index) // vaddr
|
||||
.addReg(MFI->getScratchRSrcReg()) // srsrc
|
||||
.addReg(MFI->getFrameOffsetReg()) // soffset
|
||||
.addImm(i * 4) // offset
|
||||
.addMemOperand(MMO);
|
||||
|
||||
auto MIB =
|
||||
|
|
Loading…
Reference in New Issue