1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc -march=amdgcn -mcpu=tonga -global-isel=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX8DAGISEL %s
3 ; RUN: llc -march=amdgcn -mcpu=tonga -global-isel=1 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX8GISEL %s
4 ; RUN: llc -march=amdgcn -mcpu=gfx900 -global-isel=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9DAGISEL %s
5 ; RUN: llc -march=amdgcn -mcpu=gfx900 -global-isel=1 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9GISEL %s
6 ; RUN: llc -march=amdgcn -mcpu=gfx1010 -global-isel=0 -mattr=+wavefrontsize64 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10DAGISEL,GFX1064DAGISEL %s
7 ; RUN: llc -march=amdgcn -mcpu=gfx1010 -global-isel=1 -mattr=+wavefrontsize64 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10GISEL,GFX1064GISEL %s
8 ; RUN: llc -march=amdgcn -mcpu=gfx1010 -global-isel=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10DAGISEL,GFX1032DAGISEL %s
9 ; RUN: llc -march=amdgcn -mcpu=gfx1010 -global-isel=1 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10GISEL,GFX1032GISEL %s
10 ; RUN: llc -march=amdgcn -mcpu=gfx1100 -global-isel=0 -mattr=+wavefrontsize64 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11DAGISEL,GFX1164DAGISEL %s
11 ; RUN: llc -march=amdgcn -mcpu=gfx1100 -global-isel=1 -mattr=+wavefrontsize64 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11GISEL,GFX1164GISEL %s
12 ; RUN: llc -march=amdgcn -mcpu=gfx1100 -global-isel=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11DAGISEL,GFX1132DAGISEL %s
13 ; RUN: llc -march=amdgcn -mcpu=gfx1100 -global-isel=1 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11GISEL,GFX1132GISEL %s
15 declare i32 @llvm.amdgcn.wave.reduce.umax.i32(i32, i32 immarg)
16 declare i32 @llvm.amdgcn.workitem.id.x()
18 define amdgpu_kernel void @uniform_value(ptr addrspace(1) %out, i32 %in) {
19 ; GFX8DAGISEL-LABEL: uniform_value:
20 ; GFX8DAGISEL: ; %bb.0: ; %entry
21 ; GFX8DAGISEL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24
22 ; GFX8DAGISEL-NEXT: s_load_dword s0, s[0:1], 0x2c
23 ; GFX8DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
24 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v0, s2
25 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v1, s3
26 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v2, s0
27 ; GFX8DAGISEL-NEXT: flat_store_dword v[0:1], v2
28 ; GFX8DAGISEL-NEXT: s_endpgm
30 ; GFX8GISEL-LABEL: uniform_value:
31 ; GFX8GISEL: ; %bb.0: ; %entry
32 ; GFX8GISEL-NEXT: s_load_dword s2, s[0:1], 0x2c
33 ; GFX8GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
34 ; GFX8GISEL-NEXT: s_waitcnt lgkmcnt(0)
35 ; GFX8GISEL-NEXT: v_mov_b32_e32 v2, s2
36 ; GFX8GISEL-NEXT: v_mov_b32_e32 v0, s0
37 ; GFX8GISEL-NEXT: v_mov_b32_e32 v1, s1
38 ; GFX8GISEL-NEXT: flat_store_dword v[0:1], v2
39 ; GFX8GISEL-NEXT: s_endpgm
41 ; GFX9DAGISEL-LABEL: uniform_value:
42 ; GFX9DAGISEL: ; %bb.0: ; %entry
43 ; GFX9DAGISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
44 ; GFX9DAGISEL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24
45 ; GFX9DAGISEL-NEXT: v_mov_b32_e32 v0, 0
46 ; GFX9DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
47 ; GFX9DAGISEL-NEXT: v_mov_b32_e32 v1, s4
48 ; GFX9DAGISEL-NEXT: global_store_dword v0, v1, s[2:3]
49 ; GFX9DAGISEL-NEXT: s_endpgm
51 ; GFX9GISEL-LABEL: uniform_value:
52 ; GFX9GISEL: ; %bb.0: ; %entry
53 ; GFX9GISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
54 ; GFX9GISEL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24
55 ; GFX9GISEL-NEXT: v_mov_b32_e32 v1, 0
56 ; GFX9GISEL-NEXT: s_waitcnt lgkmcnt(0)
57 ; GFX9GISEL-NEXT: v_mov_b32_e32 v0, s4
58 ; GFX9GISEL-NEXT: global_store_dword v1, v0, s[2:3]
59 ; GFX9GISEL-NEXT: s_endpgm
61 ; GFX10DAGISEL-LABEL: uniform_value:
62 ; GFX10DAGISEL: ; %bb.0: ; %entry
63 ; GFX10DAGISEL-NEXT: s_clause 0x1
64 ; GFX10DAGISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
65 ; GFX10DAGISEL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24
66 ; GFX10DAGISEL-NEXT: v_mov_b32_e32 v0, 0
67 ; GFX10DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
68 ; GFX10DAGISEL-NEXT: v_mov_b32_e32 v1, s4
69 ; GFX10DAGISEL-NEXT: global_store_dword v0, v1, s[2:3]
70 ; GFX10DAGISEL-NEXT: s_endpgm
72 ; GFX10GISEL-LABEL: uniform_value:
73 ; GFX10GISEL: ; %bb.0: ; %entry
74 ; GFX10GISEL-NEXT: s_clause 0x1
75 ; GFX10GISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
76 ; GFX10GISEL-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x24
77 ; GFX10GISEL-NEXT: v_mov_b32_e32 v1, 0
78 ; GFX10GISEL-NEXT: s_waitcnt lgkmcnt(0)
79 ; GFX10GISEL-NEXT: v_mov_b32_e32 v0, s4
80 ; GFX10GISEL-NEXT: global_store_dword v1, v0, s[2:3]
81 ; GFX10GISEL-NEXT: s_endpgm
83 ; GFX1164DAGISEL-LABEL: uniform_value:
84 ; GFX1164DAGISEL: ; %bb.0: ; %entry
85 ; GFX1164DAGISEL-NEXT: s_clause 0x1
86 ; GFX1164DAGISEL-NEXT: s_load_b32 s2, s[0:1], 0x2c
87 ; GFX1164DAGISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
88 ; GFX1164DAGISEL-NEXT: v_mov_b32_e32 v0, 0
89 ; GFX1164DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
90 ; GFX1164DAGISEL-NEXT: v_mov_b32_e32 v1, s2
91 ; GFX1164DAGISEL-NEXT: global_store_b32 v0, v1, s[0:1]
92 ; GFX1164DAGISEL-NEXT: s_nop 0
93 ; GFX1164DAGISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
94 ; GFX1164DAGISEL-NEXT: s_endpgm
96 ; GFX1164GISEL-LABEL: uniform_value:
97 ; GFX1164GISEL: ; %bb.0: ; %entry
98 ; GFX1164GISEL-NEXT: s_clause 0x1
99 ; GFX1164GISEL-NEXT: s_load_b32 s2, s[0:1], 0x2c
100 ; GFX1164GISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
101 ; GFX1164GISEL-NEXT: v_mov_b32_e32 v1, 0
102 ; GFX1164GISEL-NEXT: s_waitcnt lgkmcnt(0)
103 ; GFX1164GISEL-NEXT: v_mov_b32_e32 v0, s2
104 ; GFX1164GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
105 ; GFX1164GISEL-NEXT: s_nop 0
106 ; GFX1164GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
107 ; GFX1164GISEL-NEXT: s_endpgm
109 ; GFX1132DAGISEL-LABEL: uniform_value:
110 ; GFX1132DAGISEL: ; %bb.0: ; %entry
111 ; GFX1132DAGISEL-NEXT: s_clause 0x1
112 ; GFX1132DAGISEL-NEXT: s_load_b32 s2, s[0:1], 0x2c
113 ; GFX1132DAGISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
114 ; GFX1132DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
115 ; GFX1132DAGISEL-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
116 ; GFX1132DAGISEL-NEXT: global_store_b32 v0, v1, s[0:1]
117 ; GFX1132DAGISEL-NEXT: s_nop 0
118 ; GFX1132DAGISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
119 ; GFX1132DAGISEL-NEXT: s_endpgm
121 ; GFX1132GISEL-LABEL: uniform_value:
122 ; GFX1132GISEL: ; %bb.0: ; %entry
123 ; GFX1132GISEL-NEXT: s_clause 0x1
124 ; GFX1132GISEL-NEXT: s_load_b32 s2, s[0:1], 0x2c
125 ; GFX1132GISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
126 ; GFX1132GISEL-NEXT: s_waitcnt lgkmcnt(0)
127 ; GFX1132GISEL-NEXT: v_dual_mov_b32 v1, 0 :: v_dual_mov_b32 v0, s2
128 ; GFX1132GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
129 ; GFX1132GISEL-NEXT: s_nop 0
130 ; GFX1132GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
131 ; GFX1132GISEL-NEXT: s_endpgm
133 %result = call i32 @llvm.amdgcn.wave.reduce.umax.i32(i32 %in, i32 1)
134 store i32 %result, ptr addrspace(1) %out
138 define amdgpu_kernel void @const_value(ptr addrspace(1) %out) {
139 ; GFX8DAGISEL-LABEL: const_value:
140 ; GFX8DAGISEL: ; %bb.0: ; %entry
141 ; GFX8DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
142 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v2, 0x7b
143 ; GFX8DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
144 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v0, s0
145 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v1, s1
146 ; GFX8DAGISEL-NEXT: flat_store_dword v[0:1], v2
147 ; GFX8DAGISEL-NEXT: s_endpgm
149 ; GFX8GISEL-LABEL: const_value:
150 ; GFX8GISEL: ; %bb.0: ; %entry
151 ; GFX8GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
152 ; GFX8GISEL-NEXT: v_mov_b32_e32 v2, 0x7b
153 ; GFX8GISEL-NEXT: s_waitcnt lgkmcnt(0)
154 ; GFX8GISEL-NEXT: v_mov_b32_e32 v0, s0
155 ; GFX8GISEL-NEXT: v_mov_b32_e32 v1, s1
156 ; GFX8GISEL-NEXT: flat_store_dword v[0:1], v2
157 ; GFX8GISEL-NEXT: s_endpgm
159 ; GFX9DAGISEL-LABEL: const_value:
160 ; GFX9DAGISEL: ; %bb.0: ; %entry
161 ; GFX9DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
162 ; GFX9DAGISEL-NEXT: v_mov_b32_e32 v0, 0
163 ; GFX9DAGISEL-NEXT: v_mov_b32_e32 v1, 0x7b
164 ; GFX9DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
165 ; GFX9DAGISEL-NEXT: global_store_dword v0, v1, s[0:1]
166 ; GFX9DAGISEL-NEXT: s_endpgm
168 ; GFX9GISEL-LABEL: const_value:
169 ; GFX9GISEL: ; %bb.0: ; %entry
170 ; GFX9GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
171 ; GFX9GISEL-NEXT: v_mov_b32_e32 v0, 0x7b
172 ; GFX9GISEL-NEXT: v_mov_b32_e32 v1, 0
173 ; GFX9GISEL-NEXT: s_waitcnt lgkmcnt(0)
174 ; GFX9GISEL-NEXT: global_store_dword v1, v0, s[0:1]
175 ; GFX9GISEL-NEXT: s_endpgm
177 ; GFX10DAGISEL-LABEL: const_value:
178 ; GFX10DAGISEL: ; %bb.0: ; %entry
179 ; GFX10DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
180 ; GFX10DAGISEL-NEXT: v_mov_b32_e32 v0, 0
181 ; GFX10DAGISEL-NEXT: v_mov_b32_e32 v1, 0x7b
182 ; GFX10DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
183 ; GFX10DAGISEL-NEXT: global_store_dword v0, v1, s[0:1]
184 ; GFX10DAGISEL-NEXT: s_endpgm
186 ; GFX10GISEL-LABEL: const_value:
187 ; GFX10GISEL: ; %bb.0: ; %entry
188 ; GFX10GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
189 ; GFX10GISEL-NEXT: v_mov_b32_e32 v0, 0x7b
190 ; GFX10GISEL-NEXT: v_mov_b32_e32 v1, 0
191 ; GFX10GISEL-NEXT: s_waitcnt lgkmcnt(0)
192 ; GFX10GISEL-NEXT: global_store_dword v1, v0, s[0:1]
193 ; GFX10GISEL-NEXT: s_endpgm
195 ; GFX1164DAGISEL-LABEL: const_value:
196 ; GFX1164DAGISEL: ; %bb.0: ; %entry
197 ; GFX1164DAGISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
198 ; GFX1164DAGISEL-NEXT: v_mov_b32_e32 v0, 0
199 ; GFX1164DAGISEL-NEXT: v_mov_b32_e32 v1, 0x7b
200 ; GFX1164DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
201 ; GFX1164DAGISEL-NEXT: global_store_b32 v0, v1, s[0:1]
202 ; GFX1164DAGISEL-NEXT: s_nop 0
203 ; GFX1164DAGISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
204 ; GFX1164DAGISEL-NEXT: s_endpgm
206 ; GFX1164GISEL-LABEL: const_value:
207 ; GFX1164GISEL: ; %bb.0: ; %entry
208 ; GFX1164GISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
209 ; GFX1164GISEL-NEXT: v_mov_b32_e32 v0, 0x7b
210 ; GFX1164GISEL-NEXT: v_mov_b32_e32 v1, 0
211 ; GFX1164GISEL-NEXT: s_waitcnt lgkmcnt(0)
212 ; GFX1164GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
213 ; GFX1164GISEL-NEXT: s_nop 0
214 ; GFX1164GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
215 ; GFX1164GISEL-NEXT: s_endpgm
217 ; GFX1132DAGISEL-LABEL: const_value:
218 ; GFX1132DAGISEL: ; %bb.0: ; %entry
219 ; GFX1132DAGISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
220 ; GFX1132DAGISEL-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, 0x7b
221 ; GFX1132DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
222 ; GFX1132DAGISEL-NEXT: global_store_b32 v0, v1, s[0:1]
223 ; GFX1132DAGISEL-NEXT: s_nop 0
224 ; GFX1132DAGISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
225 ; GFX1132DAGISEL-NEXT: s_endpgm
227 ; GFX1132GISEL-LABEL: const_value:
228 ; GFX1132GISEL: ; %bb.0: ; %entry
229 ; GFX1132GISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
230 ; GFX1132GISEL-NEXT: v_dual_mov_b32 v0, 0x7b :: v_dual_mov_b32 v1, 0
231 ; GFX1132GISEL-NEXT: s_waitcnt lgkmcnt(0)
232 ; GFX1132GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
233 ; GFX1132GISEL-NEXT: s_nop 0
234 ; GFX1132GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
235 ; GFX1132GISEL-NEXT: s_endpgm
237 %result = call i32 @llvm.amdgcn.wave.reduce.umax.i32(i32 123, i32 1)
238 store i32 %result, ptr addrspace(1) %out
242 define amdgpu_kernel void @poison_value(ptr addrspace(1) %out, i32 %in) {
243 ; GFX8DAGISEL-LABEL: poison_value:
244 ; GFX8DAGISEL: ; %bb.0: ; %entry
245 ; GFX8DAGISEL-NEXT: s_endpgm
247 ; GFX8GISEL-LABEL: poison_value:
248 ; GFX8GISEL: ; %bb.0: ; %entry
249 ; GFX8GISEL-NEXT: s_endpgm
251 ; GFX9DAGISEL-LABEL: poison_value:
252 ; GFX9DAGISEL: ; %bb.0: ; %entry
253 ; GFX9DAGISEL-NEXT: s_endpgm
255 ; GFX9GISEL-LABEL: poison_value:
256 ; GFX9GISEL: ; %bb.0: ; %entry
257 ; GFX9GISEL-NEXT: s_endpgm
259 ; GFX10DAGISEL-LABEL: poison_value:
260 ; GFX10DAGISEL: ; %bb.0: ; %entry
261 ; GFX10DAGISEL-NEXT: s_endpgm
263 ; GFX10GISEL-LABEL: poison_value:
264 ; GFX10GISEL: ; %bb.0: ; %entry
265 ; GFX10GISEL-NEXT: s_endpgm
267 ; GFX11DAGISEL-LABEL: poison_value:
268 ; GFX11DAGISEL: ; %bb.0: ; %entry
269 ; GFX11DAGISEL-NEXT: s_endpgm
271 ; GFX11GISEL-LABEL: poison_value:
272 ; GFX11GISEL: ; %bb.0: ; %entry
273 ; GFX11GISEL-NEXT: s_endpgm
275 %result = call i32 @llvm.amdgcn.wave.reduce.umax.i32(i32 poison, i32 1)
276 store i32 %result, ptr addrspace(1) %out
280 define amdgpu_kernel void @divergent_value(ptr addrspace(1) %out, i32 %in) {
281 ; GFX8DAGISEL-LABEL: divergent_value:
282 ; GFX8DAGISEL: ; %bb.0: ; %entry
283 ; GFX8DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
284 ; GFX8DAGISEL-NEXT: s_mov_b64 s[2:3], exec
285 ; GFX8DAGISEL-NEXT: s_mov_b32 s4, 0
286 ; GFX8DAGISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
287 ; GFX8DAGISEL-NEXT: s_ff1_i32_b64 s5, s[2:3]
288 ; GFX8DAGISEL-NEXT: v_readlane_b32 s6, v0, s5
289 ; GFX8DAGISEL-NEXT: s_bitset0_b64 s[2:3], s5
290 ; GFX8DAGISEL-NEXT: s_max_u32 s4, s4, s6
291 ; GFX8DAGISEL-NEXT: s_cmp_lg_u64 s[2:3], 0
292 ; GFX8DAGISEL-NEXT: s_cbranch_scc1 .LBB3_1
293 ; GFX8DAGISEL-NEXT: ; %bb.2:
294 ; GFX8DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
295 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v0, s0
296 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v1, s1
297 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v2, s4
298 ; GFX8DAGISEL-NEXT: flat_store_dword v[0:1], v2
299 ; GFX8DAGISEL-NEXT: s_endpgm
301 ; GFX8GISEL-LABEL: divergent_value:
302 ; GFX8GISEL: ; %bb.0: ; %entry
303 ; GFX8GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
304 ; GFX8GISEL-NEXT: s_mov_b64 s[2:3], exec
305 ; GFX8GISEL-NEXT: s_mov_b32 s4, 0
306 ; GFX8GISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
307 ; GFX8GISEL-NEXT: s_ff1_i32_b64 s5, s[2:3]
308 ; GFX8GISEL-NEXT: v_readlane_b32 s6, v0, s5
309 ; GFX8GISEL-NEXT: s_bitset0_b64 s[2:3], s5
310 ; GFX8GISEL-NEXT: s_max_u32 s4, s4, s6
311 ; GFX8GISEL-NEXT: s_cmp_lg_u64 s[2:3], 0
312 ; GFX8GISEL-NEXT: s_cbranch_scc1 .LBB3_1
313 ; GFX8GISEL-NEXT: ; %bb.2:
314 ; GFX8GISEL-NEXT: s_waitcnt lgkmcnt(0)
315 ; GFX8GISEL-NEXT: v_mov_b32_e32 v0, s0
316 ; GFX8GISEL-NEXT: v_mov_b32_e32 v2, s4
317 ; GFX8GISEL-NEXT: v_mov_b32_e32 v1, s1
318 ; GFX8GISEL-NEXT: flat_store_dword v[0:1], v2
319 ; GFX8GISEL-NEXT: s_endpgm
321 ; GFX9DAGISEL-LABEL: divergent_value:
322 ; GFX9DAGISEL: ; %bb.0: ; %entry
323 ; GFX9DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
324 ; GFX9DAGISEL-NEXT: v_mov_b32_e32 v1, 0
325 ; GFX9DAGISEL-NEXT: s_mov_b64 s[2:3], exec
326 ; GFX9DAGISEL-NEXT: s_mov_b32 s4, 0
327 ; GFX9DAGISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
328 ; GFX9DAGISEL-NEXT: s_ff1_i32_b64 s5, s[2:3]
329 ; GFX9DAGISEL-NEXT: v_readlane_b32 s6, v0, s5
330 ; GFX9DAGISEL-NEXT: s_bitset0_b64 s[2:3], s5
331 ; GFX9DAGISEL-NEXT: s_max_u32 s4, s4, s6
332 ; GFX9DAGISEL-NEXT: s_cmp_lg_u64 s[2:3], 0
333 ; GFX9DAGISEL-NEXT: s_cbranch_scc1 .LBB3_1
334 ; GFX9DAGISEL-NEXT: ; %bb.2:
335 ; GFX9DAGISEL-NEXT: v_mov_b32_e32 v0, s4
336 ; GFX9DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
337 ; GFX9DAGISEL-NEXT: global_store_dword v1, v0, s[0:1]
338 ; GFX9DAGISEL-NEXT: s_endpgm
340 ; GFX9GISEL-LABEL: divergent_value:
341 ; GFX9GISEL: ; %bb.0: ; %entry
342 ; GFX9GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
343 ; GFX9GISEL-NEXT: s_mov_b64 s[2:3], exec
344 ; GFX9GISEL-NEXT: s_mov_b32 s4, 0
345 ; GFX9GISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
346 ; GFX9GISEL-NEXT: s_ff1_i32_b64 s5, s[2:3]
347 ; GFX9GISEL-NEXT: v_readlane_b32 s6, v0, s5
348 ; GFX9GISEL-NEXT: s_bitset0_b64 s[2:3], s5
349 ; GFX9GISEL-NEXT: s_max_u32 s4, s4, s6
350 ; GFX9GISEL-NEXT: s_cmp_lg_u64 s[2:3], 0
351 ; GFX9GISEL-NEXT: s_cbranch_scc1 .LBB3_1
352 ; GFX9GISEL-NEXT: ; %bb.2:
353 ; GFX9GISEL-NEXT: v_mov_b32_e32 v0, s4
354 ; GFX9GISEL-NEXT: v_mov_b32_e32 v1, 0
355 ; GFX9GISEL-NEXT: s_waitcnt lgkmcnt(0)
356 ; GFX9GISEL-NEXT: global_store_dword v1, v0, s[0:1]
357 ; GFX9GISEL-NEXT: s_endpgm
359 ; GFX1064DAGISEL-LABEL: divergent_value:
360 ; GFX1064DAGISEL: ; %bb.0: ; %entry
361 ; GFX1064DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
362 ; GFX1064DAGISEL-NEXT: v_mov_b32_e32 v1, 0
363 ; GFX1064DAGISEL-NEXT: s_mov_b64 s[2:3], exec
364 ; GFX1064DAGISEL-NEXT: s_mov_b32 s4, 0
365 ; GFX1064DAGISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
366 ; GFX1064DAGISEL-NEXT: s_ff1_i32_b64 s5, s[2:3]
367 ; GFX1064DAGISEL-NEXT: v_readlane_b32 s6, v0, s5
368 ; GFX1064DAGISEL-NEXT: s_bitset0_b64 s[2:3], s5
369 ; GFX1064DAGISEL-NEXT: s_max_u32 s4, s4, s6
370 ; GFX1064DAGISEL-NEXT: s_cmp_lg_u64 s[2:3], 0
371 ; GFX1064DAGISEL-NEXT: s_cbranch_scc1 .LBB3_1
372 ; GFX1064DAGISEL-NEXT: ; %bb.2:
373 ; GFX1064DAGISEL-NEXT: v_mov_b32_e32 v0, s4
374 ; GFX1064DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
375 ; GFX1064DAGISEL-NEXT: global_store_dword v1, v0, s[0:1]
376 ; GFX1064DAGISEL-NEXT: s_endpgm
378 ; GFX1064GISEL-LABEL: divergent_value:
379 ; GFX1064GISEL: ; %bb.0: ; %entry
380 ; GFX1064GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
381 ; GFX1064GISEL-NEXT: s_mov_b64 s[2:3], exec
382 ; GFX1064GISEL-NEXT: s_mov_b32 s4, 0
383 ; GFX1064GISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
384 ; GFX1064GISEL-NEXT: s_ff1_i32_b64 s5, s[2:3]
385 ; GFX1064GISEL-NEXT: v_readlane_b32 s6, v0, s5
386 ; GFX1064GISEL-NEXT: s_bitset0_b64 s[2:3], s5
387 ; GFX1064GISEL-NEXT: s_max_u32 s4, s4, s6
388 ; GFX1064GISEL-NEXT: s_cmp_lg_u64 s[2:3], 0
389 ; GFX1064GISEL-NEXT: s_cbranch_scc1 .LBB3_1
390 ; GFX1064GISEL-NEXT: ; %bb.2:
391 ; GFX1064GISEL-NEXT: v_mov_b32_e32 v0, s4
392 ; GFX1064GISEL-NEXT: v_mov_b32_e32 v1, 0
393 ; GFX1064GISEL-NEXT: s_waitcnt lgkmcnt(0)
394 ; GFX1064GISEL-NEXT: global_store_dword v1, v0, s[0:1]
395 ; GFX1064GISEL-NEXT: s_endpgm
397 ; GFX1032DAGISEL-LABEL: divergent_value:
398 ; GFX1032DAGISEL: ; %bb.0: ; %entry
399 ; GFX1032DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
400 ; GFX1032DAGISEL-NEXT: v_mov_b32_e32 v1, 0
401 ; GFX1032DAGISEL-NEXT: s_mov_b32 s3, exec_lo
402 ; GFX1032DAGISEL-NEXT: s_mov_b32 s2, 0
403 ; GFX1032DAGISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
404 ; GFX1032DAGISEL-NEXT: s_ff1_i32_b32 s4, s3
405 ; GFX1032DAGISEL-NEXT: v_readlane_b32 s5, v0, s4
406 ; GFX1032DAGISEL-NEXT: s_bitset0_b32 s3, s4
407 ; GFX1032DAGISEL-NEXT: s_max_u32 s2, s2, s5
408 ; GFX1032DAGISEL-NEXT: s_cmp_lg_u32 s3, 0
409 ; GFX1032DAGISEL-NEXT: s_cbranch_scc1 .LBB3_1
410 ; GFX1032DAGISEL-NEXT: ; %bb.2:
411 ; GFX1032DAGISEL-NEXT: v_mov_b32_e32 v0, s2
412 ; GFX1032DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
413 ; GFX1032DAGISEL-NEXT: global_store_dword v1, v0, s[0:1]
414 ; GFX1032DAGISEL-NEXT: s_endpgm
416 ; GFX1032GISEL-LABEL: divergent_value:
417 ; GFX1032GISEL: ; %bb.0: ; %entry
418 ; GFX1032GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
419 ; GFX1032GISEL-NEXT: s_mov_b32 s3, exec_lo
420 ; GFX1032GISEL-NEXT: s_mov_b32 s2, 0
421 ; GFX1032GISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
422 ; GFX1032GISEL-NEXT: s_ff1_i32_b32 s4, s3
423 ; GFX1032GISEL-NEXT: v_readlane_b32 s5, v0, s4
424 ; GFX1032GISEL-NEXT: s_bitset0_b32 s3, s4
425 ; GFX1032GISEL-NEXT: s_max_u32 s2, s2, s5
426 ; GFX1032GISEL-NEXT: s_cmp_lg_u32 s3, 0
427 ; GFX1032GISEL-NEXT: s_cbranch_scc1 .LBB3_1
428 ; GFX1032GISEL-NEXT: ; %bb.2:
429 ; GFX1032GISEL-NEXT: v_mov_b32_e32 v0, s2
430 ; GFX1032GISEL-NEXT: v_mov_b32_e32 v1, 0
431 ; GFX1032GISEL-NEXT: s_waitcnt lgkmcnt(0)
432 ; GFX1032GISEL-NEXT: global_store_dword v1, v0, s[0:1]
433 ; GFX1032GISEL-NEXT: s_endpgm
435 ; GFX1164DAGISEL-LABEL: divergent_value:
436 ; GFX1164DAGISEL: ; %bb.0: ; %entry
437 ; GFX1164DAGISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
438 ; GFX1164DAGISEL-NEXT: v_mov_b32_e32 v1, 0
439 ; GFX1164DAGISEL-NEXT: s_mov_b64 s[2:3], exec
440 ; GFX1164DAGISEL-NEXT: s_mov_b32 s4, 0
441 ; GFX1164DAGISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
442 ; GFX1164DAGISEL-NEXT: s_ctz_i32_b64 s5, s[2:3]
443 ; GFX1164DAGISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
444 ; GFX1164DAGISEL-NEXT: v_readlane_b32 s6, v0, s5
445 ; GFX1164DAGISEL-NEXT: s_bitset0_b64 s[2:3], s5
446 ; GFX1164DAGISEL-NEXT: s_max_u32 s4, s4, s6
447 ; GFX1164DAGISEL-NEXT: s_cmp_lg_u64 s[2:3], 0
448 ; GFX1164DAGISEL-NEXT: s_cbranch_scc1 .LBB3_1
449 ; GFX1164DAGISEL-NEXT: ; %bb.2:
450 ; GFX1164DAGISEL-NEXT: v_mov_b32_e32 v0, s4
451 ; GFX1164DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
452 ; GFX1164DAGISEL-NEXT: global_store_b32 v1, v0, s[0:1]
453 ; GFX1164DAGISEL-NEXT: s_nop 0
454 ; GFX1164DAGISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
455 ; GFX1164DAGISEL-NEXT: s_endpgm
457 ; GFX1164GISEL-LABEL: divergent_value:
458 ; GFX1164GISEL: ; %bb.0: ; %entry
459 ; GFX1164GISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
460 ; GFX1164GISEL-NEXT: s_mov_b64 s[2:3], exec
461 ; GFX1164GISEL-NEXT: s_mov_b32 s4, 0
462 ; GFX1164GISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
463 ; GFX1164GISEL-NEXT: s_ctz_i32_b64 s5, s[2:3]
464 ; GFX1164GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
465 ; GFX1164GISEL-NEXT: v_readlane_b32 s6, v0, s5
466 ; GFX1164GISEL-NEXT: s_bitset0_b64 s[2:3], s5
467 ; GFX1164GISEL-NEXT: s_max_u32 s4, s4, s6
468 ; GFX1164GISEL-NEXT: s_cmp_lg_u64 s[2:3], 0
469 ; GFX1164GISEL-NEXT: s_cbranch_scc1 .LBB3_1
470 ; GFX1164GISEL-NEXT: ; %bb.2:
471 ; GFX1164GISEL-NEXT: v_mov_b32_e32 v0, s4
472 ; GFX1164GISEL-NEXT: v_mov_b32_e32 v1, 0
473 ; GFX1164GISEL-NEXT: s_waitcnt lgkmcnt(0)
474 ; GFX1164GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
475 ; GFX1164GISEL-NEXT: s_nop 0
476 ; GFX1164GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
477 ; GFX1164GISEL-NEXT: s_endpgm
479 ; GFX1132DAGISEL-LABEL: divergent_value:
480 ; GFX1132DAGISEL: ; %bb.0: ; %entry
481 ; GFX1132DAGISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
482 ; GFX1132DAGISEL-NEXT: v_mov_b32_e32 v1, 0
483 ; GFX1132DAGISEL-NEXT: s_mov_b32 s3, exec_lo
484 ; GFX1132DAGISEL-NEXT: s_mov_b32 s2, 0
485 ; GFX1132DAGISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
486 ; GFX1132DAGISEL-NEXT: s_ctz_i32_b32 s4, s3
487 ; GFX1132DAGISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
488 ; GFX1132DAGISEL-NEXT: v_readlane_b32 s5, v0, s4
489 ; GFX1132DAGISEL-NEXT: s_bitset0_b32 s3, s4
490 ; GFX1132DAGISEL-NEXT: s_max_u32 s2, s2, s5
491 ; GFX1132DAGISEL-NEXT: s_cmp_lg_u32 s3, 0
492 ; GFX1132DAGISEL-NEXT: s_cbranch_scc1 .LBB3_1
493 ; GFX1132DAGISEL-NEXT: ; %bb.2:
494 ; GFX1132DAGISEL-NEXT: v_mov_b32_e32 v0, s2
495 ; GFX1132DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
496 ; GFX1132DAGISEL-NEXT: global_store_b32 v1, v0, s[0:1]
497 ; GFX1132DAGISEL-NEXT: s_nop 0
498 ; GFX1132DAGISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
499 ; GFX1132DAGISEL-NEXT: s_endpgm
501 ; GFX1132GISEL-LABEL: divergent_value:
502 ; GFX1132GISEL: ; %bb.0: ; %entry
503 ; GFX1132GISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
504 ; GFX1132GISEL-NEXT: s_mov_b32 s3, exec_lo
505 ; GFX1132GISEL-NEXT: s_mov_b32 s2, 0
506 ; GFX1132GISEL-NEXT: .LBB3_1: ; =>This Inner Loop Header: Depth=1
507 ; GFX1132GISEL-NEXT: s_ctz_i32_b32 s4, s3
508 ; GFX1132GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
509 ; GFX1132GISEL-NEXT: v_readlane_b32 s5, v0, s4
510 ; GFX1132GISEL-NEXT: s_bitset0_b32 s3, s4
511 ; GFX1132GISEL-NEXT: s_max_u32 s2, s2, s5
512 ; GFX1132GISEL-NEXT: s_cmp_lg_u32 s3, 0
513 ; GFX1132GISEL-NEXT: s_cbranch_scc1 .LBB3_1
514 ; GFX1132GISEL-NEXT: ; %bb.2:
515 ; GFX1132GISEL-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, 0
516 ; GFX1132GISEL-NEXT: s_waitcnt lgkmcnt(0)
517 ; GFX1132GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
518 ; GFX1132GISEL-NEXT: s_nop 0
519 ; GFX1132GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
520 ; GFX1132GISEL-NEXT: s_endpgm
522 %id.x = call i32 @llvm.amdgcn.workitem.id.x()
523 %result = call i32 @llvm.amdgcn.wave.reduce.umax.i32(i32 %id.x, i32 1)
524 store i32 %result, ptr addrspace(1) %out
528 define amdgpu_kernel void @divergent_cfg(ptr addrspace(1) %out, i32 %in) {
529 ; GFX8DAGISEL-LABEL: divergent_cfg:
530 ; GFX8DAGISEL: ; %bb.0: ; %entry
531 ; GFX8DAGISEL-NEXT: v_cmp_lt_u32_e32 vcc, 15, v0
532 ; GFX8DAGISEL-NEXT: ; implicit-def: $sgpr4
533 ; GFX8DAGISEL-NEXT: s_and_saveexec_b64 s[2:3], vcc
534 ; GFX8DAGISEL-NEXT: s_xor_b64 s[2:3], exec, s[2:3]
535 ; GFX8DAGISEL-NEXT: s_cbranch_execz .LBB4_2
536 ; GFX8DAGISEL-NEXT: ; %bb.1: ; %else
537 ; GFX8DAGISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
538 ; GFX8DAGISEL-NEXT: ; implicit-def: $vgpr0
539 ; GFX8DAGISEL-NEXT: .LBB4_2: ; %Flow
540 ; GFX8DAGISEL-NEXT: s_or_saveexec_b64 s[2:3], s[2:3]
541 ; GFX8DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
542 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v1, s4
543 ; GFX8DAGISEL-NEXT: s_xor_b64 exec, exec, s[2:3]
544 ; GFX8DAGISEL-NEXT: s_cbranch_execz .LBB4_6
545 ; GFX8DAGISEL-NEXT: ; %bb.3: ; %if
546 ; GFX8DAGISEL-NEXT: s_mov_b64 s[4:5], exec
547 ; GFX8DAGISEL-NEXT: s_mov_b32 s6, 0
548 ; GFX8DAGISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
549 ; GFX8DAGISEL-NEXT: s_ff1_i32_b64 s7, s[4:5]
550 ; GFX8DAGISEL-NEXT: v_readlane_b32 s8, v0, s7
551 ; GFX8DAGISEL-NEXT: s_bitset0_b64 s[4:5], s7
552 ; GFX8DAGISEL-NEXT: s_max_u32 s6, s6, s8
553 ; GFX8DAGISEL-NEXT: s_cmp_lg_u64 s[4:5], 0
554 ; GFX8DAGISEL-NEXT: s_cbranch_scc1 .LBB4_4
555 ; GFX8DAGISEL-NEXT: ; %bb.5:
556 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v1, s6
557 ; GFX8DAGISEL-NEXT: .LBB4_6: ; %endif
558 ; GFX8DAGISEL-NEXT: s_or_b64 exec, exec, s[2:3]
559 ; GFX8DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
560 ; GFX8DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
561 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v3, s1
562 ; GFX8DAGISEL-NEXT: v_mov_b32_e32 v2, s0
563 ; GFX8DAGISEL-NEXT: flat_store_dword v[2:3], v1
564 ; GFX8DAGISEL-NEXT: s_endpgm
566 ; GFX8GISEL-LABEL: divergent_cfg:
567 ; GFX8GISEL: ; %bb.0: ; %entry
568 ; GFX8GISEL-NEXT: v_cmp_le_u32_e32 vcc, 16, v0
569 ; GFX8GISEL-NEXT: ; implicit-def: $sgpr6
570 ; GFX8GISEL-NEXT: s_and_saveexec_b64 s[2:3], vcc
571 ; GFX8GISEL-NEXT: s_xor_b64 s[2:3], exec, s[2:3]
572 ; GFX8GISEL-NEXT: s_cbranch_execz .LBB4_2
573 ; GFX8GISEL-NEXT: ; %bb.1: ; %else
574 ; GFX8GISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
575 ; GFX8GISEL-NEXT: ; implicit-def: $vgpr0
576 ; GFX8GISEL-NEXT: s_waitcnt lgkmcnt(0)
577 ; GFX8GISEL-NEXT: s_mov_b32 s6, s4
578 ; GFX8GISEL-NEXT: .LBB4_2: ; %Flow
579 ; GFX8GISEL-NEXT: s_andn2_saveexec_b64 s[2:3], s[2:3]
580 ; GFX8GISEL-NEXT: s_cbranch_execz .LBB4_5
581 ; GFX8GISEL-NEXT: ; %bb.3: ; %if
582 ; GFX8GISEL-NEXT: s_mov_b64 s[4:5], exec
583 ; GFX8GISEL-NEXT: s_mov_b32 s6, 0
584 ; GFX8GISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
585 ; GFX8GISEL-NEXT: s_ff1_i32_b64 s7, s[4:5]
586 ; GFX8GISEL-NEXT: v_readlane_b32 s8, v0, s7
587 ; GFX8GISEL-NEXT: s_bitset0_b64 s[4:5], s7
588 ; GFX8GISEL-NEXT: s_max_u32 s6, s6, s8
589 ; GFX8GISEL-NEXT: s_cmp_lg_u64 s[4:5], 0
590 ; GFX8GISEL-NEXT: s_cbranch_scc1 .LBB4_4
591 ; GFX8GISEL-NEXT: .LBB4_5: ; %endif
592 ; GFX8GISEL-NEXT: s_or_b64 exec, exec, s[2:3]
593 ; GFX8GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
594 ; GFX8GISEL-NEXT: v_mov_b32_e32 v2, s6
595 ; GFX8GISEL-NEXT: s_waitcnt lgkmcnt(0)
596 ; GFX8GISEL-NEXT: v_mov_b32_e32 v0, s0
597 ; GFX8GISEL-NEXT: v_mov_b32_e32 v1, s1
598 ; GFX8GISEL-NEXT: flat_store_dword v[0:1], v2
599 ; GFX8GISEL-NEXT: s_endpgm
601 ; GFX9DAGISEL-LABEL: divergent_cfg:
602 ; GFX9DAGISEL: ; %bb.0: ; %entry
603 ; GFX9DAGISEL-NEXT: v_cmp_lt_u32_e32 vcc, 15, v0
604 ; GFX9DAGISEL-NEXT: ; implicit-def: $sgpr4
605 ; GFX9DAGISEL-NEXT: s_and_saveexec_b64 s[2:3], vcc
606 ; GFX9DAGISEL-NEXT: s_xor_b64 s[2:3], exec, s[2:3]
607 ; GFX9DAGISEL-NEXT: s_cbranch_execz .LBB4_2
608 ; GFX9DAGISEL-NEXT: ; %bb.1: ; %else
609 ; GFX9DAGISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
610 ; GFX9DAGISEL-NEXT: ; implicit-def: $vgpr0
611 ; GFX9DAGISEL-NEXT: .LBB4_2: ; %Flow
612 ; GFX9DAGISEL-NEXT: s_or_saveexec_b64 s[2:3], s[2:3]
613 ; GFX9DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
614 ; GFX9DAGISEL-NEXT: v_mov_b32_e32 v1, s4
615 ; GFX9DAGISEL-NEXT: s_xor_b64 exec, exec, s[2:3]
616 ; GFX9DAGISEL-NEXT: s_cbranch_execz .LBB4_6
617 ; GFX9DAGISEL-NEXT: ; %bb.3: ; %if
618 ; GFX9DAGISEL-NEXT: s_mov_b64 s[4:5], exec
619 ; GFX9DAGISEL-NEXT: s_mov_b32 s6, 0
620 ; GFX9DAGISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
621 ; GFX9DAGISEL-NEXT: s_ff1_i32_b64 s7, s[4:5]
622 ; GFX9DAGISEL-NEXT: v_readlane_b32 s8, v0, s7
623 ; GFX9DAGISEL-NEXT: s_bitset0_b64 s[4:5], s7
624 ; GFX9DAGISEL-NEXT: s_max_u32 s6, s6, s8
625 ; GFX9DAGISEL-NEXT: s_cmp_lg_u64 s[4:5], 0
626 ; GFX9DAGISEL-NEXT: s_cbranch_scc1 .LBB4_4
627 ; GFX9DAGISEL-NEXT: ; %bb.5:
628 ; GFX9DAGISEL-NEXT: v_mov_b32_e32 v1, s6
629 ; GFX9DAGISEL-NEXT: .LBB4_6: ; %endif
630 ; GFX9DAGISEL-NEXT: s_or_b64 exec, exec, s[2:3]
631 ; GFX9DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
632 ; GFX9DAGISEL-NEXT: v_mov_b32_e32 v0, 0
633 ; GFX9DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
634 ; GFX9DAGISEL-NEXT: global_store_dword v0, v1, s[0:1]
635 ; GFX9DAGISEL-NEXT: s_endpgm
637 ; GFX9GISEL-LABEL: divergent_cfg:
638 ; GFX9GISEL: ; %bb.0: ; %entry
639 ; GFX9GISEL-NEXT: v_cmp_le_u32_e32 vcc, 16, v0
640 ; GFX9GISEL-NEXT: ; implicit-def: $sgpr6
641 ; GFX9GISEL-NEXT: s_and_saveexec_b64 s[2:3], vcc
642 ; GFX9GISEL-NEXT: s_xor_b64 s[2:3], exec, s[2:3]
643 ; GFX9GISEL-NEXT: s_cbranch_execz .LBB4_2
644 ; GFX9GISEL-NEXT: ; %bb.1: ; %else
645 ; GFX9GISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
646 ; GFX9GISEL-NEXT: ; implicit-def: $vgpr0
647 ; GFX9GISEL-NEXT: s_waitcnt lgkmcnt(0)
648 ; GFX9GISEL-NEXT: s_mov_b32 s6, s4
649 ; GFX9GISEL-NEXT: .LBB4_2: ; %Flow
650 ; GFX9GISEL-NEXT: s_andn2_saveexec_b64 s[2:3], s[2:3]
651 ; GFX9GISEL-NEXT: s_cbranch_execz .LBB4_5
652 ; GFX9GISEL-NEXT: ; %bb.3: ; %if
653 ; GFX9GISEL-NEXT: s_mov_b64 s[4:5], exec
654 ; GFX9GISEL-NEXT: s_mov_b32 s6, 0
655 ; GFX9GISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
656 ; GFX9GISEL-NEXT: s_ff1_i32_b64 s7, s[4:5]
657 ; GFX9GISEL-NEXT: v_readlane_b32 s8, v0, s7
658 ; GFX9GISEL-NEXT: s_bitset0_b64 s[4:5], s7
659 ; GFX9GISEL-NEXT: s_max_u32 s6, s6, s8
660 ; GFX9GISEL-NEXT: s_cmp_lg_u64 s[4:5], 0
661 ; GFX9GISEL-NEXT: s_cbranch_scc1 .LBB4_4
662 ; GFX9GISEL-NEXT: .LBB4_5: ; %endif
663 ; GFX9GISEL-NEXT: s_or_b64 exec, exec, s[2:3]
664 ; GFX9GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
665 ; GFX9GISEL-NEXT: v_mov_b32_e32 v0, s6
666 ; GFX9GISEL-NEXT: v_mov_b32_e32 v1, 0
667 ; GFX9GISEL-NEXT: s_waitcnt lgkmcnt(0)
668 ; GFX9GISEL-NEXT: global_store_dword v1, v0, s[0:1]
669 ; GFX9GISEL-NEXT: s_endpgm
671 ; GFX1064DAGISEL-LABEL: divergent_cfg:
672 ; GFX1064DAGISEL: ; %bb.0: ; %entry
673 ; GFX1064DAGISEL-NEXT: v_cmp_lt_u32_e32 vcc, 15, v0
674 ; GFX1064DAGISEL-NEXT: ; implicit-def: $sgpr4
675 ; GFX1064DAGISEL-NEXT: s_and_saveexec_b64 s[2:3], vcc
676 ; GFX1064DAGISEL-NEXT: s_xor_b64 s[2:3], exec, s[2:3]
677 ; GFX1064DAGISEL-NEXT: s_cbranch_execz .LBB4_2
678 ; GFX1064DAGISEL-NEXT: ; %bb.1: ; %else
679 ; GFX1064DAGISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
680 ; GFX1064DAGISEL-NEXT: ; implicit-def: $vgpr0
681 ; GFX1064DAGISEL-NEXT: .LBB4_2: ; %Flow
682 ; GFX1064DAGISEL-NEXT: s_or_saveexec_b64 s[2:3], s[2:3]
683 ; GFX1064DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
684 ; GFX1064DAGISEL-NEXT: v_mov_b32_e32 v1, s4
685 ; GFX1064DAGISEL-NEXT: s_xor_b64 exec, exec, s[2:3]
686 ; GFX1064DAGISEL-NEXT: s_cbranch_execz .LBB4_6
687 ; GFX1064DAGISEL-NEXT: ; %bb.3: ; %if
688 ; GFX1064DAGISEL-NEXT: s_mov_b64 s[4:5], exec
689 ; GFX1064DAGISEL-NEXT: s_mov_b32 s6, 0
690 ; GFX1064DAGISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
691 ; GFX1064DAGISEL-NEXT: s_ff1_i32_b64 s7, s[4:5]
692 ; GFX1064DAGISEL-NEXT: v_readlane_b32 s8, v0, s7
693 ; GFX1064DAGISEL-NEXT: s_bitset0_b64 s[4:5], s7
694 ; GFX1064DAGISEL-NEXT: s_max_u32 s6, s6, s8
695 ; GFX1064DAGISEL-NEXT: s_cmp_lg_u64 s[4:5], 0
696 ; GFX1064DAGISEL-NEXT: s_cbranch_scc1 .LBB4_4
697 ; GFX1064DAGISEL-NEXT: ; %bb.5:
698 ; GFX1064DAGISEL-NEXT: v_mov_b32_e32 v1, s6
699 ; GFX1064DAGISEL-NEXT: .LBB4_6: ; %endif
700 ; GFX1064DAGISEL-NEXT: s_or_b64 exec, exec, s[2:3]
701 ; GFX1064DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
702 ; GFX1064DAGISEL-NEXT: v_mov_b32_e32 v0, 0
703 ; GFX1064DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
704 ; GFX1064DAGISEL-NEXT: global_store_dword v0, v1, s[0:1]
705 ; GFX1064DAGISEL-NEXT: s_endpgm
707 ; GFX1064GISEL-LABEL: divergent_cfg:
708 ; GFX1064GISEL: ; %bb.0: ; %entry
709 ; GFX1064GISEL-NEXT: v_cmp_le_u32_e32 vcc, 16, v0
710 ; GFX1064GISEL-NEXT: ; implicit-def: $sgpr6
711 ; GFX1064GISEL-NEXT: s_and_saveexec_b64 s[2:3], vcc
712 ; GFX1064GISEL-NEXT: s_xor_b64 s[2:3], exec, s[2:3]
713 ; GFX1064GISEL-NEXT: s_cbranch_execz .LBB4_2
714 ; GFX1064GISEL-NEXT: ; %bb.1: ; %else
715 ; GFX1064GISEL-NEXT: s_load_dword s4, s[0:1], 0x2c
716 ; GFX1064GISEL-NEXT: ; implicit-def: $vgpr0
717 ; GFX1064GISEL-NEXT: s_waitcnt lgkmcnt(0)
718 ; GFX1064GISEL-NEXT: s_mov_b32 s6, s4
719 ; GFX1064GISEL-NEXT: .LBB4_2: ; %Flow
720 ; GFX1064GISEL-NEXT: s_andn2_saveexec_b64 s[2:3], s[2:3]
721 ; GFX1064GISEL-NEXT: s_cbranch_execz .LBB4_5
722 ; GFX1064GISEL-NEXT: ; %bb.3: ; %if
723 ; GFX1064GISEL-NEXT: s_mov_b64 s[4:5], exec
724 ; GFX1064GISEL-NEXT: s_mov_b32 s6, 0
725 ; GFX1064GISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
726 ; GFX1064GISEL-NEXT: s_ff1_i32_b64 s7, s[4:5]
727 ; GFX1064GISEL-NEXT: v_readlane_b32 s8, v0, s7
728 ; GFX1064GISEL-NEXT: s_bitset0_b64 s[4:5], s7
729 ; GFX1064GISEL-NEXT: s_max_u32 s6, s6, s8
730 ; GFX1064GISEL-NEXT: s_cmp_lg_u64 s[4:5], 0
731 ; GFX1064GISEL-NEXT: s_cbranch_scc1 .LBB4_4
732 ; GFX1064GISEL-NEXT: .LBB4_5: ; %endif
733 ; GFX1064GISEL-NEXT: s_or_b64 exec, exec, s[2:3]
734 ; GFX1064GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
735 ; GFX1064GISEL-NEXT: v_mov_b32_e32 v0, s6
736 ; GFX1064GISEL-NEXT: v_mov_b32_e32 v1, 0
737 ; GFX1064GISEL-NEXT: s_waitcnt lgkmcnt(0)
738 ; GFX1064GISEL-NEXT: global_store_dword v1, v0, s[0:1]
739 ; GFX1064GISEL-NEXT: s_endpgm
741 ; GFX1032DAGISEL-LABEL: divergent_cfg:
742 ; GFX1032DAGISEL: ; %bb.0: ; %entry
743 ; GFX1032DAGISEL-NEXT: v_cmp_lt_u32_e32 vcc_lo, 15, v0
744 ; GFX1032DAGISEL-NEXT: ; implicit-def: $sgpr3
745 ; GFX1032DAGISEL-NEXT: s_and_saveexec_b32 s2, vcc_lo
746 ; GFX1032DAGISEL-NEXT: s_xor_b32 s2, exec_lo, s2
747 ; GFX1032DAGISEL-NEXT: s_cbranch_execz .LBB4_2
748 ; GFX1032DAGISEL-NEXT: ; %bb.1: ; %else
749 ; GFX1032DAGISEL-NEXT: s_load_dword s3, s[0:1], 0x2c
750 ; GFX1032DAGISEL-NEXT: ; implicit-def: $vgpr0
751 ; GFX1032DAGISEL-NEXT: .LBB4_2: ; %Flow
752 ; GFX1032DAGISEL-NEXT: s_or_saveexec_b32 s2, s2
753 ; GFX1032DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
754 ; GFX1032DAGISEL-NEXT: v_mov_b32_e32 v1, s3
755 ; GFX1032DAGISEL-NEXT: s_xor_b32 exec_lo, exec_lo, s2
756 ; GFX1032DAGISEL-NEXT: s_cbranch_execz .LBB4_6
757 ; GFX1032DAGISEL-NEXT: ; %bb.3: ; %if
758 ; GFX1032DAGISEL-NEXT: s_mov_b32 s4, exec_lo
759 ; GFX1032DAGISEL-NEXT: s_mov_b32 s3, 0
760 ; GFX1032DAGISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
761 ; GFX1032DAGISEL-NEXT: s_ff1_i32_b32 s5, s4
762 ; GFX1032DAGISEL-NEXT: v_readlane_b32 s6, v0, s5
763 ; GFX1032DAGISEL-NEXT: s_bitset0_b32 s4, s5
764 ; GFX1032DAGISEL-NEXT: s_max_u32 s3, s3, s6
765 ; GFX1032DAGISEL-NEXT: s_cmp_lg_u32 s4, 0
766 ; GFX1032DAGISEL-NEXT: s_cbranch_scc1 .LBB4_4
767 ; GFX1032DAGISEL-NEXT: ; %bb.5:
768 ; GFX1032DAGISEL-NEXT: v_mov_b32_e32 v1, s3
769 ; GFX1032DAGISEL-NEXT: .LBB4_6: ; %endif
770 ; GFX1032DAGISEL-NEXT: s_or_b32 exec_lo, exec_lo, s2
771 ; GFX1032DAGISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
772 ; GFX1032DAGISEL-NEXT: v_mov_b32_e32 v0, 0
773 ; GFX1032DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
774 ; GFX1032DAGISEL-NEXT: global_store_dword v0, v1, s[0:1]
775 ; GFX1032DAGISEL-NEXT: s_endpgm
777 ; GFX1032GISEL-LABEL: divergent_cfg:
778 ; GFX1032GISEL: ; %bb.0: ; %entry
779 ; GFX1032GISEL-NEXT: v_cmp_le_u32_e32 vcc_lo, 16, v0
780 ; GFX1032GISEL-NEXT: ; implicit-def: $sgpr2
781 ; GFX1032GISEL-NEXT: s_and_saveexec_b32 s3, vcc_lo
782 ; GFX1032GISEL-NEXT: s_xor_b32 s3, exec_lo, s3
783 ; GFX1032GISEL-NEXT: s_cbranch_execz .LBB4_2
784 ; GFX1032GISEL-NEXT: ; %bb.1: ; %else
785 ; GFX1032GISEL-NEXT: s_load_dword s2, s[0:1], 0x2c
786 ; GFX1032GISEL-NEXT: ; implicit-def: $vgpr0
787 ; GFX1032GISEL-NEXT: s_waitcnt lgkmcnt(0)
788 ; GFX1032GISEL-NEXT: s_mov_b32 s2, s2
789 ; GFX1032GISEL-NEXT: .LBB4_2: ; %Flow
790 ; GFX1032GISEL-NEXT: s_andn2_saveexec_b32 s3, s3
791 ; GFX1032GISEL-NEXT: s_cbranch_execz .LBB4_5
792 ; GFX1032GISEL-NEXT: ; %bb.3: ; %if
793 ; GFX1032GISEL-NEXT: s_mov_b32 s4, exec_lo
794 ; GFX1032GISEL-NEXT: s_mov_b32 s2, 0
795 ; GFX1032GISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
796 ; GFX1032GISEL-NEXT: s_ff1_i32_b32 s5, s4
797 ; GFX1032GISEL-NEXT: v_readlane_b32 s6, v0, s5
798 ; GFX1032GISEL-NEXT: s_bitset0_b32 s4, s5
799 ; GFX1032GISEL-NEXT: s_max_u32 s2, s2, s6
800 ; GFX1032GISEL-NEXT: s_cmp_lg_u32 s4, 0
801 ; GFX1032GISEL-NEXT: s_cbranch_scc1 .LBB4_4
802 ; GFX1032GISEL-NEXT: .LBB4_5: ; %endif
803 ; GFX1032GISEL-NEXT: s_or_b32 exec_lo, exec_lo, s3
804 ; GFX1032GISEL-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
805 ; GFX1032GISEL-NEXT: v_mov_b32_e32 v0, s2
806 ; GFX1032GISEL-NEXT: v_mov_b32_e32 v1, 0
807 ; GFX1032GISEL-NEXT: s_waitcnt lgkmcnt(0)
808 ; GFX1032GISEL-NEXT: global_store_dword v1, v0, s[0:1]
809 ; GFX1032GISEL-NEXT: s_endpgm
811 ; GFX1164DAGISEL-LABEL: divergent_cfg:
812 ; GFX1164DAGISEL: ; %bb.0: ; %entry
813 ; GFX1164DAGISEL-NEXT: s_mov_b64 s[2:3], exec
814 ; GFX1164DAGISEL-NEXT: ; implicit-def: $sgpr4
815 ; GFX1164DAGISEL-NEXT: v_cmpx_lt_u32_e32 15, v0
816 ; GFX1164DAGISEL-NEXT: s_xor_b64 s[2:3], exec, s[2:3]
817 ; GFX1164DAGISEL-NEXT: s_cbranch_execz .LBB4_2
818 ; GFX1164DAGISEL-NEXT: ; %bb.1: ; %else
819 ; GFX1164DAGISEL-NEXT: s_load_b32 s4, s[0:1], 0x2c
820 ; GFX1164DAGISEL-NEXT: ; implicit-def: $vgpr0
821 ; GFX1164DAGISEL-NEXT: .LBB4_2: ; %Flow
822 ; GFX1164DAGISEL-NEXT: s_or_saveexec_b64 s[2:3], s[2:3]
823 ; GFX1164DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
824 ; GFX1164DAGISEL-NEXT: v_mov_b32_e32 v1, s4
825 ; GFX1164DAGISEL-NEXT: s_xor_b64 exec, exec, s[2:3]
826 ; GFX1164DAGISEL-NEXT: s_cbranch_execz .LBB4_6
827 ; GFX1164DAGISEL-NEXT: ; %bb.3: ; %if
828 ; GFX1164DAGISEL-NEXT: s_mov_b64 s[4:5], exec
829 ; GFX1164DAGISEL-NEXT: s_mov_b32 s6, 0
830 ; GFX1164DAGISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
831 ; GFX1164DAGISEL-NEXT: s_ctz_i32_b64 s7, s[4:5]
832 ; GFX1164DAGISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
833 ; GFX1164DAGISEL-NEXT: v_readlane_b32 s8, v0, s7
834 ; GFX1164DAGISEL-NEXT: s_bitset0_b64 s[4:5], s7
835 ; GFX1164DAGISEL-NEXT: s_max_u32 s6, s6, s8
836 ; GFX1164DAGISEL-NEXT: s_cmp_lg_u64 s[4:5], 0
837 ; GFX1164DAGISEL-NEXT: s_cbranch_scc1 .LBB4_4
838 ; GFX1164DAGISEL-NEXT: ; %bb.5:
839 ; GFX1164DAGISEL-NEXT: v_mov_b32_e32 v1, s6
840 ; GFX1164DAGISEL-NEXT: .LBB4_6: ; %endif
841 ; GFX1164DAGISEL-NEXT: s_or_b64 exec, exec, s[2:3]
842 ; GFX1164DAGISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
843 ; GFX1164DAGISEL-NEXT: v_mov_b32_e32 v0, 0
844 ; GFX1164DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
845 ; GFX1164DAGISEL-NEXT: global_store_b32 v0, v1, s[0:1]
846 ; GFX1164DAGISEL-NEXT: s_nop 0
847 ; GFX1164DAGISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
848 ; GFX1164DAGISEL-NEXT: s_endpgm
850 ; GFX1164GISEL-LABEL: divergent_cfg:
851 ; GFX1164GISEL: ; %bb.0: ; %entry
852 ; GFX1164GISEL-NEXT: s_mov_b64 s[2:3], exec
853 ; GFX1164GISEL-NEXT: ; implicit-def: $sgpr6
854 ; GFX1164GISEL-NEXT: v_cmpx_le_u32_e32 16, v0
855 ; GFX1164GISEL-NEXT: s_xor_b64 s[2:3], exec, s[2:3]
856 ; GFX1164GISEL-NEXT: s_cbranch_execz .LBB4_2
857 ; GFX1164GISEL-NEXT: ; %bb.1: ; %else
858 ; GFX1164GISEL-NEXT: s_load_b32 s4, s[0:1], 0x2c
859 ; GFX1164GISEL-NEXT: ; implicit-def: $vgpr0
860 ; GFX1164GISEL-NEXT: s_waitcnt lgkmcnt(0)
861 ; GFX1164GISEL-NEXT: s_mov_b32 s6, s4
862 ; GFX1164GISEL-NEXT: .LBB4_2: ; %Flow
863 ; GFX1164GISEL-NEXT: s_and_not1_saveexec_b64 s[2:3], s[2:3]
864 ; GFX1164GISEL-NEXT: s_cbranch_execz .LBB4_5
865 ; GFX1164GISEL-NEXT: ; %bb.3: ; %if
866 ; GFX1164GISEL-NEXT: s_mov_b64 s[4:5], exec
867 ; GFX1164GISEL-NEXT: s_mov_b32 s6, 0
868 ; GFX1164GISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
869 ; GFX1164GISEL-NEXT: s_ctz_i32_b64 s7, s[4:5]
870 ; GFX1164GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
871 ; GFX1164GISEL-NEXT: v_readlane_b32 s8, v0, s7
872 ; GFX1164GISEL-NEXT: s_bitset0_b64 s[4:5], s7
873 ; GFX1164GISEL-NEXT: s_max_u32 s6, s6, s8
874 ; GFX1164GISEL-NEXT: s_cmp_lg_u64 s[4:5], 0
875 ; GFX1164GISEL-NEXT: s_cbranch_scc1 .LBB4_4
876 ; GFX1164GISEL-NEXT: .LBB4_5: ; %endif
877 ; GFX1164GISEL-NEXT: s_or_b64 exec, exec, s[2:3]
878 ; GFX1164GISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
879 ; GFX1164GISEL-NEXT: v_mov_b32_e32 v0, s6
880 ; GFX1164GISEL-NEXT: v_mov_b32_e32 v1, 0
881 ; GFX1164GISEL-NEXT: s_waitcnt lgkmcnt(0)
882 ; GFX1164GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
883 ; GFX1164GISEL-NEXT: s_nop 0
884 ; GFX1164GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
885 ; GFX1164GISEL-NEXT: s_endpgm
887 ; GFX1132DAGISEL-LABEL: divergent_cfg:
888 ; GFX1132DAGISEL: ; %bb.0: ; %entry
889 ; GFX1132DAGISEL-NEXT: s_mov_b32 s2, exec_lo
890 ; GFX1132DAGISEL-NEXT: ; implicit-def: $sgpr3
891 ; GFX1132DAGISEL-NEXT: v_cmpx_lt_u32_e32 15, v0
892 ; GFX1132DAGISEL-NEXT: s_xor_b32 s2, exec_lo, s2
893 ; GFX1132DAGISEL-NEXT: s_cbranch_execz .LBB4_2
894 ; GFX1132DAGISEL-NEXT: ; %bb.1: ; %else
895 ; GFX1132DAGISEL-NEXT: s_load_b32 s3, s[0:1], 0x2c
896 ; GFX1132DAGISEL-NEXT: ; implicit-def: $vgpr0
897 ; GFX1132DAGISEL-NEXT: .LBB4_2: ; %Flow
898 ; GFX1132DAGISEL-NEXT: s_or_saveexec_b32 s2, s2
899 ; GFX1132DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
900 ; GFX1132DAGISEL-NEXT: v_mov_b32_e32 v1, s3
901 ; GFX1132DAGISEL-NEXT: s_xor_b32 exec_lo, exec_lo, s2
902 ; GFX1132DAGISEL-NEXT: s_cbranch_execz .LBB4_6
903 ; GFX1132DAGISEL-NEXT: ; %bb.3: ; %if
904 ; GFX1132DAGISEL-NEXT: s_mov_b32 s4, exec_lo
905 ; GFX1132DAGISEL-NEXT: s_mov_b32 s3, 0
906 ; GFX1132DAGISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
907 ; GFX1132DAGISEL-NEXT: s_ctz_i32_b32 s5, s4
908 ; GFX1132DAGISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
909 ; GFX1132DAGISEL-NEXT: v_readlane_b32 s6, v0, s5
910 ; GFX1132DAGISEL-NEXT: s_bitset0_b32 s4, s5
911 ; GFX1132DAGISEL-NEXT: s_max_u32 s3, s3, s6
912 ; GFX1132DAGISEL-NEXT: s_cmp_lg_u32 s4, 0
913 ; GFX1132DAGISEL-NEXT: s_cbranch_scc1 .LBB4_4
914 ; GFX1132DAGISEL-NEXT: ; %bb.5:
915 ; GFX1132DAGISEL-NEXT: v_mov_b32_e32 v1, s3
916 ; GFX1132DAGISEL-NEXT: .LBB4_6: ; %endif
917 ; GFX1132DAGISEL-NEXT: s_or_b32 exec_lo, exec_lo, s2
918 ; GFX1132DAGISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
919 ; GFX1132DAGISEL-NEXT: v_mov_b32_e32 v0, 0
920 ; GFX1132DAGISEL-NEXT: s_waitcnt lgkmcnt(0)
921 ; GFX1132DAGISEL-NEXT: global_store_b32 v0, v1, s[0:1]
922 ; GFX1132DAGISEL-NEXT: s_nop 0
923 ; GFX1132DAGISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
924 ; GFX1132DAGISEL-NEXT: s_endpgm
926 ; GFX1132GISEL-LABEL: divergent_cfg:
927 ; GFX1132GISEL: ; %bb.0: ; %entry
928 ; GFX1132GISEL-NEXT: s_mov_b32 s3, exec_lo
929 ; GFX1132GISEL-NEXT: ; implicit-def: $sgpr2
930 ; GFX1132GISEL-NEXT: v_cmpx_le_u32_e32 16, v0
931 ; GFX1132GISEL-NEXT: s_xor_b32 s3, exec_lo, s3
932 ; GFX1132GISEL-NEXT: s_cbranch_execz .LBB4_2
933 ; GFX1132GISEL-NEXT: ; %bb.1: ; %else
934 ; GFX1132GISEL-NEXT: s_load_b32 s2, s[0:1], 0x2c
935 ; GFX1132GISEL-NEXT: ; implicit-def: $vgpr0
936 ; GFX1132GISEL-NEXT: s_waitcnt lgkmcnt(0)
937 ; GFX1132GISEL-NEXT: s_mov_b32 s2, s2
938 ; GFX1132GISEL-NEXT: .LBB4_2: ; %Flow
939 ; GFX1132GISEL-NEXT: s_and_not1_saveexec_b32 s3, s3
940 ; GFX1132GISEL-NEXT: s_cbranch_execz .LBB4_5
941 ; GFX1132GISEL-NEXT: ; %bb.3: ; %if
942 ; GFX1132GISEL-NEXT: s_mov_b32 s4, exec_lo
943 ; GFX1132GISEL-NEXT: s_mov_b32 s2, 0
944 ; GFX1132GISEL-NEXT: .LBB4_4: ; =>This Inner Loop Header: Depth=1
945 ; GFX1132GISEL-NEXT: s_ctz_i32_b32 s5, s4
946 ; GFX1132GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
947 ; GFX1132GISEL-NEXT: v_readlane_b32 s6, v0, s5
948 ; GFX1132GISEL-NEXT: s_bitset0_b32 s4, s5
949 ; GFX1132GISEL-NEXT: s_max_u32 s2, s2, s6
950 ; GFX1132GISEL-NEXT: s_cmp_lg_u32 s4, 0
951 ; GFX1132GISEL-NEXT: s_cbranch_scc1 .LBB4_4
952 ; GFX1132GISEL-NEXT: .LBB4_5: ; %endif
953 ; GFX1132GISEL-NEXT: s_or_b32 exec_lo, exec_lo, s3
954 ; GFX1132GISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x24
955 ; GFX1132GISEL-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, 0
956 ; GFX1132GISEL-NEXT: s_waitcnt lgkmcnt(0)
957 ; GFX1132GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
958 ; GFX1132GISEL-NEXT: s_nop 0
959 ; GFX1132GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
960 ; GFX1132GISEL-NEXT: s_endpgm
962 %tid = call i32 @llvm.amdgcn.workitem.id.x()
963 %d_cmp = icmp ult i32 %tid, 16
964 br i1 %d_cmp, label %if, label %else
967 %reducedValTid = call i32 @llvm.amdgcn.wave.reduce.umax.i32(i32 %tid, i32 1)
971 %reducedValIn = call i32 @llvm.amdgcn.wave.reduce.umax.i32(i32 %in, i32 1)
975 %combine = phi i32 [%reducedValTid, %if], [%reducedValIn, %else]
976 store i32 %combine, ptr addrspace(1) %out