xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/disconnected-predset-break-bug.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; PRED_SET* instructions must be tied to any instruction that uses their
4*9880d681SAndroid Build Coastguard Worker; result.  This tests that there are no instructions between the PRED_SET*
5*9880d681SAndroid Build Coastguard Worker; and the PREDICATE_BREAK in this loop.
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; CHECK: {{^}}loop_ge:
8*9880d681SAndroid Build Coastguard Worker; CHECK: LOOP_START_DX10
9*9880d681SAndroid Build Coastguard Worker; CHECK: ALU_PUSH_BEFORE
10*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: JUMP
11*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: LOOP_BREAK
12*9880d681SAndroid Build Coastguard Workerdefine void @loop_ge(i32 addrspace(1)* nocapture %out, i32 %iterations) nounwind {
13*9880d681SAndroid Build Coastguard Workerentry:
14*9880d681SAndroid Build Coastguard Worker  %cmp5 = icmp sgt i32 %iterations, 0
15*9880d681SAndroid Build Coastguard Worker  br i1 %cmp5, label %for.body, label %for.end
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerfor.body:                                         ; preds = %for.body, %entry
18*9880d681SAndroid Build Coastguard Worker  %i.07.in = phi i32 [ %i.07, %for.body ], [ %iterations, %entry ]
19*9880d681SAndroid Build Coastguard Worker  %ai.06 = phi i32 [ %add, %for.body ], [ 0, %entry ]
20*9880d681SAndroid Build Coastguard Worker  %i.07 = add nsw i32 %i.07.in, -1
21*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 %ai.06
22*9880d681SAndroid Build Coastguard Worker  store i32 %i.07, i32 addrspace(1)* %arrayidx, align 4
23*9880d681SAndroid Build Coastguard Worker  %add = add nsw i32 %ai.06, 1
24*9880d681SAndroid Build Coastguard Worker  %exitcond = icmp eq i32 %add, %iterations
25*9880d681SAndroid Build Coastguard Worker  br i1 %exitcond, label %for.end, label %for.body
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerfor.end:                                          ; preds = %for.body, %entry
28*9880d681SAndroid Build Coastguard Worker  ret void
29*9880d681SAndroid Build Coastguard Worker}
30