xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/si-lower-control-flow-unreachable-block.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}lower_control_flow_unreachable_terminator:
4*9880d681SAndroid Build Coastguard Worker; GCN: v_cmp_eq_i32
5*9880d681SAndroid Build Coastguard Worker; GCN: s_and_saveexec_b64
6*9880d681SAndroid Build Coastguard Worker; GCN: s_xor_b64
7*9880d681SAndroid Build Coastguard Worker; GCN: s_branch BB0_1
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker; GCN: s_or_b64 exec, exec
10*9880d681SAndroid Build Coastguard Worker; GCN: s_endpgm
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; GCN: ds_write_b32
13*9880d681SAndroid Build Coastguard Worker; GCN: s_waitcnt
14*9880d681SAndroid Build Coastguard Workerdefine void @lower_control_flow_unreachable_terminator() #0 {
15*9880d681SAndroid Build Coastguard Workerbb:
16*9880d681SAndroid Build Coastguard Worker  %tmp15 = tail call i32 @llvm.amdgcn.workitem.id.y()
17*9880d681SAndroid Build Coastguard Worker  %tmp63 = icmp eq i32 %tmp15, 32
18*9880d681SAndroid Build Coastguard Worker  br i1 %tmp63, label %bb64, label %bb68
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerbb64:
21*9880d681SAndroid Build Coastguard Worker  store volatile i32 0, i32 addrspace(3)* undef, align 4
22*9880d681SAndroid Build Coastguard Worker  unreachable
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerbb68:
25*9880d681SAndroid Build Coastguard Worker  ret void
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}lower_control_flow_unreachable_terminator_swap_block_order:
29*9880d681SAndroid Build Coastguard Worker; GCN: v_cmp_eq_i32
30*9880d681SAndroid Build Coastguard Worker; GCN: s_and_saveexec_b64
31*9880d681SAndroid Build Coastguard Worker; GCN: s_xor_b64
32*9880d681SAndroid Build Coastguard Worker; GCN: s_endpgm
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker; GCN: s_or_b64 exec, exec
35*9880d681SAndroid Build Coastguard Worker; GCN: ds_write_b32
36*9880d681SAndroid Build Coastguard Worker; GCN: s_waitcnt
37*9880d681SAndroid Build Coastguard Workerdefine void @lower_control_flow_unreachable_terminator_swap_block_order() #0 {
38*9880d681SAndroid Build Coastguard Workerbb:
39*9880d681SAndroid Build Coastguard Worker  %tmp15 = tail call i32 @llvm.amdgcn.workitem.id.y()
40*9880d681SAndroid Build Coastguard Worker  %tmp63 = icmp eq i32 %tmp15, 32
41*9880d681SAndroid Build Coastguard Worker  br i1 %tmp63, label %bb68, label %bb64
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerbb68:
44*9880d681SAndroid Build Coastguard Worker  ret void
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Workerbb64:
47*9880d681SAndroid Build Coastguard Worker  store volatile i32 0, i32 addrspace(3)* undef, align 4
48*9880d681SAndroid Build Coastguard Worker  unreachable
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
52*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.workitem.id.y() #1
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind }
55*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone }
56*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind }
57