Skip to content

Commit

Permalink
R600/SI: improve vector interpolation
Browse files Browse the repository at this point in the history
Prevent loading M0 multiple times.

Signed-off-by: Christian König <[email protected]>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178023 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ChristianKoenigAMD committed Mar 26, 2013
1 parent a55e365 commit 3851e98
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/Target/R600/SIInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ SIInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
unsigned Opcode;
const int16_t *SubIndices;

if (AMDGPU::M0 == DestReg) {
// Check if M0 isn't already set to this value
for (MachineBasicBlock::reverse_iterator E = MBB.rend(),
I = MachineBasicBlock::reverse_iterator(MI); I != E; ++I) {

if (!I->definesRegister(AMDGPU::M0))
continue;

unsigned Opc = I->getOpcode();
if (Opc != TargetOpcode::COPY && Opc != AMDGPU::S_MOV_B32)
break;

if (!I->readsRegister(SrcReg))
break;

// The copy isn't necessary
return;
}
}

if (AMDGPU::SReg_32RegClass.contains(DestReg)) {
assert(AMDGPU::SReg_32RegClass.contains(SrcReg));
BuildMI(MBB, MI, DL, get(AMDGPU::S_MOV_B32), DestReg)
Expand Down

0 comments on commit 3851e98

Please sign in to comment.