74 lines · plain
1; RUN: llc -mtriple=amdgcn < %s | FileCheck -check-prefix=GCN %s2 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]]6define amdgpu_ps void @if_with_kill(i32 %arg) {7.entry:8 %cmp = icmp eq i32 %arg, 329 br i1 %cmp, label %then, label %endif10 11then:12 tail call void @llvm.amdgcn.kill(i1 false)13 br label %endif14 15endif:16 ret void17}18 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]]22define amdgpu_ps void @if_with_loop_kill_after(i32 %arg) {23.entry:24 %cmp = icmp eq i32 %arg, 3225 br i1 %cmp, label %then, label %endif26 27then:28 %sub = sub i32 %arg, 129 br label %loop30 31loop:32 %ind = phi i32 [%sub, %then], [%dec, %loop]33 %dec = sub i32 %ind, 134 %cc = icmp ne i32 %ind, 035 br i1 %cc, label %loop, label %break36 37break:38 tail call void @llvm.amdgcn.kill(i1 false)39 br label %endif40 41endif:42 ret void43}44 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]]48define amdgpu_ps void @if_with_kill_inside_loop(i32 %arg) {49.entry:50 %cmp = icmp eq i32 %arg, 3251 br i1 %cmp, label %then, label %endif52 53then:54 %sub = sub i32 %arg, 155 br label %loop56 57loop:58 %ind = phi i32 [%sub, %then], [%dec, %loop]59 %dec = sub i32 %ind, 160 %cc = icmp ne i32 %ind, 061 tail call void @llvm.amdgcn.kill(i1 false)62 br i1 %cc, label %loop, label %break63 64break:65 br label %endif66 67endif:68 ret void69}70 71declare void @llvm.amdgcn.kill(i1) #072 73attributes #0 = { nounwind }74