mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-22 10:33:23 +00:00
R600: Rewrite an awkward loop in R600MachineScheduler
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183458 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9342b9ccdd
commit
81c5d11c25
@ -159,6 +159,19 @@ bool R600VectorRegMerger::tryMergeVector(const RegSeqInfo *Untouched,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
unsigned getReassignedChan(
|
||||||
|
const std::vector<std::pair<unsigned, unsigned> > &RemapChan,
|
||||||
|
unsigned Chan) {
|
||||||
|
for (unsigned j = 0, je = RemapChan.size(); j < je; j++) {
|
||||||
|
if (RemapChan[j].first == Chan) {
|
||||||
|
return RemapChan[j].second;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
llvm_unreachable("Chan wasn't reassigned");
|
||||||
|
}
|
||||||
|
|
||||||
MachineInstr *R600VectorRegMerger::RebuildVector(
|
MachineInstr *R600VectorRegMerger::RebuildVector(
|
||||||
RegSeqInfo *RSI, const RegSeqInfo *BaseRSI,
|
RegSeqInfo *RSI, const RegSeqInfo *BaseRSI,
|
||||||
const std::vector<std::pair<unsigned, unsigned> > &RemapChan) const {
|
const std::vector<std::pair<unsigned, unsigned> > &RemapChan) const {
|
||||||
@ -179,13 +192,8 @@ MachineInstr *R600VectorRegMerger::RebuildVector(
|
|||||||
unsigned DstReg = MRI->createVirtualRegister(&AMDGPU::R600_Reg128RegClass);
|
unsigned DstReg = MRI->createVirtualRegister(&AMDGPU::R600_Reg128RegClass);
|
||||||
unsigned SubReg = (*It).first;
|
unsigned SubReg = (*It).first;
|
||||||
unsigned Swizzle = (*It).second;
|
unsigned Swizzle = (*It).second;
|
||||||
unsigned Chan = 0xDEADBEEF;
|
unsigned Chan = getReassignedChan(RemapChan, Swizzle);
|
||||||
for (unsigned j = 0, je = RemapChan.size(); j < je; j++) {
|
|
||||||
if (RemapChan[j].first == Swizzle) {
|
|
||||||
Chan = RemapChan[j].second;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MachineInstr *Tmp = BuildMI(MBB, Pos, DL, TII->get(AMDGPU::INSERT_SUBREG),
|
MachineInstr *Tmp = BuildMI(MBB, Pos, DL, TII->get(AMDGPU::INSERT_SUBREG),
|
||||||
DstReg)
|
DstReg)
|
||||||
.addReg(SrcVec)
|
.addReg(SrcVec)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user