Revert "AMDGPU: Remove unused control flow intrinsic"
llvm-svn: 274978
diff --git a/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp b/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
index 1ba14cd..3d6fc9e 100644
--- a/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
+++ b/llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
@@ -80,6 +80,7 @@
void If(MachineInstr &MI);
void Else(MachineInstr &MI, bool ExecModified);
+ void Break(MachineInstr &MI);
void IfBreak(MachineInstr &MI);
void ElseBreak(MachineInstr &MI);
void Loop(MachineInstr &MI);
@@ -276,6 +277,20 @@
MI.eraseFromParent();
}
+void SILowerControlFlow::Break(MachineInstr &MI) {
+ MachineBasicBlock &MBB = *MI.getParent();
+ DebugLoc DL = MI.getDebugLoc();
+
+ unsigned Dst = MI.getOperand(0).getReg();
+ unsigned Src = MI.getOperand(1).getReg();
+
+ BuildMI(MBB, &MI, DL, TII->get(AMDGPU::S_OR_B64), Dst)
+ .addReg(AMDGPU::EXEC)
+ .addReg(Src);
+
+ MI.eraseFromParent();
+}
+
void SILowerControlFlow::IfBreak(MachineInstr &MI) {
MachineBasicBlock &MBB = *MI.getParent();
DebugLoc DL = MI.getDebugLoc();
@@ -661,6 +676,10 @@
Else(MI, ExecModified);
break;
+ case AMDGPU::SI_BREAK:
+ Break(MI);
+ break;
+
case AMDGPU::SI_IF_BREAK:
IfBreak(MI);
break;