1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3 ; GCN-LABEL: {{^}}if_with_kill:
4 ; GCN: s_and_saveexec_b64 [[SAVEEXEC:s\[[0-9:]+\]]],
5 ; GCN-NEXT: s_xor_b64 s[{{[0-9:]+}}], exec, [[SAVEEXEC]]
6 define amdgpu_ps void @if_with_kill(i32 %arg) {
8 %cmp = icmp eq i32 %arg, 32
9 br i1 %cmp, label %then, label %endif
12 tail call void @llvm.amdgcn.kill(i1 false)
19 ; GCN-LABEL: {{^}}if_with_loop_kill_after:
20 ; GCN: s_and_saveexec_b64 [[SAVEEXEC:s\[[0-9:]+\]]],
21 ; GCN-NEXT: s_xor_b64 s[{{[0-9:]+}}], exec, [[SAVEEXEC]]
22 define amdgpu_ps void @if_with_loop_kill_after(i32 %arg) {
24 %cmp = icmp eq i32 %arg, 32
25 br i1 %cmp, label %then, label %endif
28 %sub = sub i32 %arg, 1
32 %ind = phi i32 [%sub, %then], [%dec, %loop]
33 %dec = sub i32 %ind, 1
34 %cc = icmp ne i32 %ind, 0
35 br i1 %cc, label %loop, label %break
38 tail call void @llvm.amdgcn.kill(i1 false)
45 ; GCN-LABEL: {{^}}if_with_kill_inside_loop:
46 ; GCN: s_and_saveexec_b64 [[SAVEEXEC:s\[[0-9:]+\]]],
47 ; GCN-NEXT: s_xor_b64 s[{{[0-9:]+}}], exec, [[SAVEEXEC]]
48 define amdgpu_ps void @if_with_kill_inside_loop(i32 %arg) {
50 %cmp = icmp eq i32 %arg, 32
51 br i1 %cmp, label %then, label %endif
54 %sub = sub i32 %arg, 1
58 %ind = phi i32 [%sub, %then], [%dec, %loop]
59 %dec = sub i32 %ind, 1
60 %cc = icmp ne i32 %ind, 0
61 tail call void @llvm.amdgcn.kill(i1 false)
62 br i1 %cc, label %loop, label %break
71 declare void @llvm.amdgcn.kill(i1) #0
73 attributes #0 = { nounwind }