1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii < %s | FileCheck -enable-var-scope -check-prefix=GCN %s
3 ; A call should be skipped if all lanes are zero, since we don't know
4 ; what side effects should be avoided inside the call.
5 define hidden void @func() #1 {
9 ; GCN-LABEL: {{^}}if_call:
10 ; GCN: s_and_saveexec_b64
11 ; GCN-NEXT: ; mask branch [[END:BB[0-9]+_[0-9]+]]
12 ; GCN-NEXT: s_cbranch_execz [[END]]
15 define void @if_call(i32 %flag) #0 {
16 %cc = icmp eq i32 %flag, 0
17 br i1 %cc, label %call, label %end
27 ; GCN-LABEL: {{^}}if_asm:
28 ; GCN: s_and_saveexec_b64
29 ; GCN-NEXT: ; mask branch [[END:BB[0-9]+_[0-9]+]]
30 ; GCN-NEXT: s_cbranch_execz [[END]]
33 define void @if_asm(i32 %flag) #0 {
34 %cc = icmp eq i32 %flag, 0
35 br i1 %cc, label %call, label %end
38 call void asm sideeffect "; sample asm", ""()
45 ; GCN-LABEL: {{^}}if_call_kernel:
46 ; GCN: s_and_saveexec_b64
47 ; GCN-NEXT: ; mask branch [[END:BB[0-9]+_[0-9]+]]
48 ; GCN-NEXT: s_cbranch_execz [[END]]
50 define amdgpu_kernel void @if_call_kernel() #0 {
51 %id = call i32 @llvm.amdgcn.workitem.id.x()
52 %cc = icmp eq i32 %id, 0
53 br i1 %cc, label %call, label %end
63 declare i32 @llvm.amdgcn.workitem.id.x() #2
65 attributes #0 = { nounwind }
66 attributes #1 = { nounwind noinline }
67 attributes #2 = { nounwind readnone speculatable }