summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorVincent Lejeune <vljn@ovi.com>2013-12-02 17:29:37 +0000
committerVincent Lejeune <vljn@ovi.com>2013-12-02 17:29:37 +0000
commit4b8d9e303c2dd63542e327d49ddcdb53b8dca25b (patch)
tree240a76d7d64df0a0e6fb4aeb564c9bfcbab2c40b /llvm/lib/Target
parent604dfec8dcfbbb899820022ce7bab7ad57618f8a (diff)
downloadbcm5719-llvm-4b8d9e303c2dd63542e327d49ddcdb53b8dca25b.tar.gz
bcm5719-llvm-4b8d9e303c2dd63542e327d49ddcdb53b8dca25b.zip
R600: Workaround for cayman loop bug
llvm-svn: 196121
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp10
-rw-r--r--llvm/lib/Target/R600/R600Instructions.td4
2 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp b/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp
index ac3d8f63d57..ec39e097ba9 100644
--- a/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp
+++ b/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp
@@ -332,6 +332,7 @@ public:
unsigned MaxStack = 0;
unsigned CurrentStack = 0;
+ unsigned CurrentLoopDepth = 0;
bool HasPush = false;
for (MachineFunction::iterator MB = MF.begin(), ME = MF.end(); MB != ME;
++MB) {
@@ -370,6 +371,13 @@ public:
CurrentStack++;
MaxStack = std::max(MaxStack, CurrentStack);
HasPush = true;
+ if (ST.hasCaymanISA() && CurrentLoopDepth > 1) {
+ BuildMI(MBB, MI, MBB.findDebugLoc(MI), TII->get(AMDGPU::CF_PUSH_CM))
+ .addImm(CfCount + 1)
+ .addImm(1);
+ MI->setDesc(TII->get(AMDGPU::CF_ALU));
+ CfCount++;
+ }
case AMDGPU::CF_ALU:
I = MI;
AluClauses.push_back(MakeALUClause(MBB, I));
@@ -378,6 +386,7 @@ public:
break;
case AMDGPU::WHILELOOP: {
CurrentStack+=4;
+ CurrentLoopDepth++;
MaxStack = std::max(MaxStack, CurrentStack);
MachineInstr *MIb = BuildMI(MBB, MI, MBB.findDebugLoc(MI),
getHWInstrDesc(CF_WHILE_LOOP))
@@ -392,6 +401,7 @@ public:
}
case AMDGPU::ENDLOOP: {
CurrentStack-=4;
+ CurrentLoopDepth--;
std::pair<unsigned, std::set<MachineInstr *> > Pair =
LoopStack.back();
LoopStack.pop_back();
diff --git a/llvm/lib/Target/R600/R600Instructions.td b/llvm/lib/Target/R600/R600Instructions.td
index 0346e24ab77..2249ceec3c0 100644
--- a/llvm/lib/Target/R600/R600Instructions.td
+++ b/llvm/lib/Target/R600/R600Instructions.td
@@ -1867,6 +1867,10 @@ def : Pat <
let COUNT = 0;
}
+ def CF_PUSH_CM : CF_CLAUSE_EG<11, (ins i32imm:$ADDR, i32imm:$POP_COUNT), "PUSH @$ADDR POP:$POP_COUNT"> {
+ let COUNT = 0;
+ }
+
def : Pat<(fsqrt f32:$src), (MUL R600_Reg32:$src, (RECIPSQRT_CLAMPED_cm $src))>;
class RAT_STORE_DWORD <RegisterClass rc, ValueType vt, bits<4> mask> :
OpenPOWER on IntegriCloud