diff options
| author | Christian Konig <christian.koenig@amd.com> | 2013-03-26 14:04:12 +0000 |
|---|---|---|
| committer | Christian Konig <christian.koenig@amd.com> | 2013-03-26 14:04:12 +0000 |
| commit | 082c661f9456c1f6e82324ada31618f6a38ea7d7 (patch) | |
| tree | 6d180232ae822571e5a28a160bd662366fa894c8 /llvm/lib/Target/R600/SIInstrInfo.cpp | |
| parent | 25ce3e9f4c82fac2ad12ff7f3f518e2c52c8b9ae (diff) | |
| download | bcm5719-llvm-082c661f9456c1f6e82324ada31618f6a38ea7d7.tar.gz bcm5719-llvm-082c661f9456c1f6e82324ada31618f6a38ea7d7.zip | |
R600/SI: improve vector interpolation
Prevent loading M0 multiple times.
Signed-off-by: Christian König <christian.koenig@amd.com>
llvm-svn: 178023
Diffstat (limited to 'llvm/lib/Target/R600/SIInstrInfo.cpp')
| -rw-r--r-- | llvm/lib/Target/R600/SIInstrInfo.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Target/R600/SIInstrInfo.cpp b/llvm/lib/Target/R600/SIInstrInfo.cpp index de2373b11a7..b9b25b5ecfb 100644 --- a/llvm/lib/Target/R600/SIInstrInfo.cpp +++ b/llvm/lib/Target/R600/SIInstrInfo.cpp @@ -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) |

