1; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii < %s | FileCheck -enable-var-scope -check-prefix=GCN %s 2 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. 5define hidden void @func() #1 { 6 ret void 7} 8 9; GCN-LABEL: {{^}}if_call: 10; GCN: s_and_saveexec_b64 11; GCN-NEXT: s_cbranch_execz [[END:BB[0-9]+_[0-9]+]] 12; GCN: s_swappc_b64 13; GCN: [[END]]: 14define void @if_call(i32 %flag) #0 { 15 %cc = icmp eq i32 %flag, 0 16 br i1 %cc, label %call, label %end 17 18call: 19 call void @func() 20 br label %end 21 22end: 23 ret void 24} 25 26; GCN-LABEL: {{^}}if_asm: 27; GCN: s_and_saveexec_b64 28; GCN-NEXT: s_cbranch_execz [[END:BB[0-9]+_[0-9]+]] 29; GCN: ; sample asm 30; GCN: [[END]]: 31define void @if_asm(i32 %flag) #0 { 32 %cc = icmp eq i32 %flag, 0 33 br i1 %cc, label %call, label %end 34 35call: 36 call void asm sideeffect "; sample asm", ""() 37 br label %end 38 39end: 40 ret void 41} 42 43; GCN-LABEL: {{^}}if_call_kernel: 44; GCN: s_and_saveexec_b64 45; GCN-NEXT: s_cbranch_execz BB3_2 46; GCN: s_swappc_b64 47define 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 51 52call: 53 call void @func() 54 br label %end 55 56end: 57 ret void 58} 59 60declare i32 @llvm.amdgcn.workitem.id.x() #2 61 62attributes #0 = { nounwind } 63attributes #1 = { nounwind noinline } 64attributes #2 = { nounwind readnone speculatable } 65