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