1 ; RUN: opt -mtriple=amdgcn-- -S -structurizecfg -si-annotate-control-flow %s | FileCheck -check-prefix=OPT %s
2 ; RUN: opt -mtriple=amdgcn-- -S -passes=structurizecfg,si-annotate-control-flow %s | FileCheck -check-prefix=OPT %s
3 ; RUN: llc -mtriple=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
6 ; OPT-LABEL: @annotate_unreachable(
7 ; OPT: call { i1, i64 } @llvm.amdgcn.if.i64(
8 ; OPT-NOT: call void @llvm.amdgcn.end.cf
11 ; GCN-LABEL: {{^}}annotate_unreachable:
12 ; GCN: s_and_saveexec_b64
15 define amdgpu_kernel void @annotate_unreachable(ptr addrspace(1) noalias nocapture readonly %arg, i1 %c0) #0 {
17 %tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
21 %tmp2 = sext i32 %tmp to i64
22 %tmp3 = getelementptr inbounds <4 x float>, ptr addrspace(1) %arg, i64 %tmp2
23 %tmp4 = load <4 x float>, ptr addrspace(1) %tmp3, align 16
24 br i1 %c0, label %bb3, label %bb5 ; label order reversed
27 %tmp6 = extractelement <4 x float> %tmp4, i32 2
28 %tmp7 = fcmp olt float %tmp6, 0.000000e+00
29 br i1 %tmp7, label %bb4, label %bb5
34 bb5: ; preds = %bb3, %bb1
38 declare i32 @llvm.amdgcn.workitem.id.x() #1
40 attributes #0 = { nounwind }
41 attributes #1 = { nounwind readnone }