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: s_cbranch_execz [[END:.LBB[0-9]+_[0-9]+]]
14 define void @if_call(i32 %flag) #0 {
15 %cc = icmp eq i32 %flag, 0
16 br i1 %cc, label %call, label %end
26 ; GCN-LABEL: {{^}}if_asm:
27 ; GCN: s_and_saveexec_b64
28 ; GCN-NEXT: s_cbranch_execz [[END:.LBB[0-9]+_[0-9]+]]
31 define void @if_asm(i32 %flag) #0 {
32 %cc = icmp eq i32 %flag, 0
33 br i1 %cc, label %call, label %end
36 call void asm sideeffect "; sample asm", ""()
43 ; GCN-LABEL: {{^}}if_call_kernel:
44 ; GCN: s_and_saveexec_b64
45 ; GCN-NEXT: s_cbranch_execz .LBB3_2
47 define amdgpu_kernel void @if_call_kernel() #0 {
48 %id = call i32 @llvm.amdgcn.workitem.id.x()
49 %cc = icmp eq i32 %id, 0
50 br i1 %cc, label %call, label %end
60 declare i32 @llvm.amdgcn.workitem.id.x() #2
62 attributes #0 = { nounwind }
63 attributes #1 = { nounwind noinline }
64 attributes #2 = { nounwind readnone speculatable }