1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 < %s | FileCheck -check-prefix=GFX12 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx940 < %s | FileCheck -check-prefix=GFX940 %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1100 < %s | FileCheck -check-prefix=GFX11 %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 < %s | FileCheck -check-prefix=GFX10 %s
6 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx90a < %s | FileCheck -check-prefix=GFX90A %s
7 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx908 < %s | FileCheck -check-prefix=GFX908 %s
8 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=tonga < %s | FileCheck -check-prefix=GFX8 %s
9 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=hawaii < %s | FileCheck -check-prefix=GFX7 %s
10 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=tahiti < %s | FileCheck -check-prefix=GFX6 %s
12 ; --------------------------------------------------------------------
14 ; --------------------------------------------------------------------
16 define float @local_atomic_fmin_ret_f32(ptr addrspace(3) %ptr) nounwind {
17 ; GFX12-LABEL: local_atomic_fmin_ret_f32:
19 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
20 ; GFX12-NEXT: s_wait_expcnt 0x0
21 ; GFX12-NEXT: s_wait_samplecnt 0x0
22 ; GFX12-NEXT: s_wait_bvhcnt 0x0
23 ; GFX12-NEXT: s_wait_kmcnt 0x0
24 ; GFX12-NEXT: v_mov_b32_e32 v1, 4.0
25 ; GFX12-NEXT: global_wb scope:SCOPE_SE
26 ; GFX12-NEXT: s_wait_storecnt 0x0
27 ; GFX12-NEXT: ds_min_num_rtn_f32 v0, v0, v1
28 ; GFX12-NEXT: s_wait_dscnt 0x0
29 ; GFX12-NEXT: global_inv scope:SCOPE_SE
30 ; GFX12-NEXT: s_setpc_b64 s[30:31]
32 ; GFX940-LABEL: local_atomic_fmin_ret_f32:
34 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
35 ; GFX940-NEXT: v_mov_b32_e32 v1, 4.0
36 ; GFX940-NEXT: ds_min_rtn_f32 v0, v0, v1
37 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
38 ; GFX940-NEXT: s_setpc_b64 s[30:31]
40 ; GFX11-LABEL: local_atomic_fmin_ret_f32:
42 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
43 ; GFX11-NEXT: v_mov_b32_e32 v1, 4.0
44 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
45 ; GFX11-NEXT: ds_min_rtn_f32 v0, v0, v1
46 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
47 ; GFX11-NEXT: buffer_gl0_inv
48 ; GFX11-NEXT: s_setpc_b64 s[30:31]
50 ; GFX10-LABEL: local_atomic_fmin_ret_f32:
52 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
53 ; GFX10-NEXT: v_mov_b32_e32 v1, 4.0
54 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
55 ; GFX10-NEXT: ds_min_rtn_f32 v0, v0, v1
56 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
57 ; GFX10-NEXT: buffer_gl0_inv
58 ; GFX10-NEXT: s_setpc_b64 s[30:31]
60 ; GFX90A-LABEL: local_atomic_fmin_ret_f32:
62 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
63 ; GFX90A-NEXT: v_mov_b32_e32 v1, 4.0
64 ; GFX90A-NEXT: ds_min_rtn_f32 v0, v0, v1
65 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
66 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
68 ; GFX908-LABEL: local_atomic_fmin_ret_f32:
70 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
71 ; GFX908-NEXT: v_mov_b32_e32 v1, 4.0
72 ; GFX908-NEXT: ds_min_rtn_f32 v0, v0, v1
73 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
74 ; GFX908-NEXT: s_setpc_b64 s[30:31]
76 ; GFX8-LABEL: local_atomic_fmin_ret_f32:
78 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
79 ; GFX8-NEXT: v_mov_b32_e32 v1, 4.0
80 ; GFX8-NEXT: s_mov_b32 m0, -1
81 ; GFX8-NEXT: ds_min_rtn_f32 v0, v0, v1
82 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
83 ; GFX8-NEXT: s_setpc_b64 s[30:31]
85 ; GFX7-LABEL: local_atomic_fmin_ret_f32:
87 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
88 ; GFX7-NEXT: v_mov_b32_e32 v1, 4.0
89 ; GFX7-NEXT: s_mov_b32 m0, -1
90 ; GFX7-NEXT: ds_min_rtn_f32 v0, v0, v1
91 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
92 ; GFX7-NEXT: s_setpc_b64 s[30:31]
94 ; GFX6-LABEL: local_atomic_fmin_ret_f32:
96 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
97 ; GFX6-NEXT: v_mov_b32_e32 v1, 4.0
98 ; GFX6-NEXT: s_mov_b32 m0, -1
99 ; GFX6-NEXT: ds_min_rtn_f32 v0, v0, v1
100 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
101 ; GFX6-NEXT: s_setpc_b64 s[30:31]
102 %result = atomicrmw fmin ptr addrspace(3) %ptr, float 4.0 seq_cst
106 define float @local_atomic_fmin_ret_f32__offset(ptr addrspace(3) %ptr) nounwind {
107 ; GFX12-LABEL: local_atomic_fmin_ret_f32__offset:
109 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
110 ; GFX12-NEXT: s_wait_expcnt 0x0
111 ; GFX12-NEXT: s_wait_samplecnt 0x0
112 ; GFX12-NEXT: s_wait_bvhcnt 0x0
113 ; GFX12-NEXT: s_wait_kmcnt 0x0
114 ; GFX12-NEXT: v_mov_b32_e32 v1, 4.0
115 ; GFX12-NEXT: global_wb scope:SCOPE_SE
116 ; GFX12-NEXT: s_wait_storecnt 0x0
117 ; GFX12-NEXT: ds_min_num_rtn_f32 v0, v0, v1 offset:65532
118 ; GFX12-NEXT: s_wait_dscnt 0x0
119 ; GFX12-NEXT: global_inv scope:SCOPE_SE
120 ; GFX12-NEXT: s_setpc_b64 s[30:31]
122 ; GFX940-LABEL: local_atomic_fmin_ret_f32__offset:
124 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
125 ; GFX940-NEXT: v_mov_b32_e32 v1, 4.0
126 ; GFX940-NEXT: ds_min_rtn_f32 v0, v0, v1 offset:65532
127 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
128 ; GFX940-NEXT: s_setpc_b64 s[30:31]
130 ; GFX11-LABEL: local_atomic_fmin_ret_f32__offset:
132 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
133 ; GFX11-NEXT: v_mov_b32_e32 v1, 4.0
134 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
135 ; GFX11-NEXT: ds_min_rtn_f32 v0, v0, v1 offset:65532
136 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
137 ; GFX11-NEXT: buffer_gl0_inv
138 ; GFX11-NEXT: s_setpc_b64 s[30:31]
140 ; GFX10-LABEL: local_atomic_fmin_ret_f32__offset:
142 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
143 ; GFX10-NEXT: v_mov_b32_e32 v1, 4.0
144 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
145 ; GFX10-NEXT: ds_min_rtn_f32 v0, v0, v1 offset:65532
146 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
147 ; GFX10-NEXT: buffer_gl0_inv
148 ; GFX10-NEXT: s_setpc_b64 s[30:31]
150 ; GFX90A-LABEL: local_atomic_fmin_ret_f32__offset:
152 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
153 ; GFX90A-NEXT: v_mov_b32_e32 v1, 4.0
154 ; GFX90A-NEXT: ds_min_rtn_f32 v0, v0, v1 offset:65532
155 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
156 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
158 ; GFX908-LABEL: local_atomic_fmin_ret_f32__offset:
160 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
161 ; GFX908-NEXT: v_mov_b32_e32 v1, 4.0
162 ; GFX908-NEXT: ds_min_rtn_f32 v0, v0, v1 offset:65532
163 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
164 ; GFX908-NEXT: s_setpc_b64 s[30:31]
166 ; GFX8-LABEL: local_atomic_fmin_ret_f32__offset:
168 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
169 ; GFX8-NEXT: v_mov_b32_e32 v1, 4.0
170 ; GFX8-NEXT: s_mov_b32 m0, -1
171 ; GFX8-NEXT: ds_min_rtn_f32 v0, v0, v1 offset:65532
172 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
173 ; GFX8-NEXT: s_setpc_b64 s[30:31]
175 ; GFX7-LABEL: local_atomic_fmin_ret_f32__offset:
177 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
178 ; GFX7-NEXT: v_mov_b32_e32 v1, 4.0
179 ; GFX7-NEXT: s_mov_b32 m0, -1
180 ; GFX7-NEXT: ds_min_rtn_f32 v0, v0, v1 offset:65532
181 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
182 ; GFX7-NEXT: s_setpc_b64 s[30:31]
184 ; GFX6-LABEL: local_atomic_fmin_ret_f32__offset:
186 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
187 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffc, v0
188 ; GFX6-NEXT: v_mov_b32_e32 v1, 4.0
189 ; GFX6-NEXT: s_mov_b32 m0, -1
190 ; GFX6-NEXT: ds_min_rtn_f32 v0, v0, v1
191 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
192 ; GFX6-NEXT: s_setpc_b64 s[30:31]
193 %gep = getelementptr float, ptr addrspace(3) %ptr, i32 16383
194 %result = atomicrmw fmin ptr addrspace(3) %gep, float 4.0 seq_cst
198 define void @local_atomic_fmin_noret_f32(ptr addrspace(3) %ptr) nounwind {
199 ; GFX12-LABEL: local_atomic_fmin_noret_f32:
201 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
202 ; GFX12-NEXT: s_wait_expcnt 0x0
203 ; GFX12-NEXT: s_wait_samplecnt 0x0
204 ; GFX12-NEXT: s_wait_bvhcnt 0x0
205 ; GFX12-NEXT: s_wait_kmcnt 0x0
206 ; GFX12-NEXT: v_mov_b32_e32 v1, 4.0
207 ; GFX12-NEXT: global_wb scope:SCOPE_SE
208 ; GFX12-NEXT: s_wait_storecnt 0x0
209 ; GFX12-NEXT: ds_min_num_f32 v0, v1
210 ; GFX12-NEXT: s_wait_dscnt 0x0
211 ; GFX12-NEXT: global_inv scope:SCOPE_SE
212 ; GFX12-NEXT: s_setpc_b64 s[30:31]
214 ; GFX940-LABEL: local_atomic_fmin_noret_f32:
216 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
217 ; GFX940-NEXT: v_mov_b32_e32 v1, 4.0
218 ; GFX940-NEXT: ds_min_f32 v0, v1
219 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
220 ; GFX940-NEXT: s_setpc_b64 s[30:31]
222 ; GFX11-LABEL: local_atomic_fmin_noret_f32:
224 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
225 ; GFX11-NEXT: v_mov_b32_e32 v1, 4.0
226 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
227 ; GFX11-NEXT: ds_min_f32 v0, v1
228 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
229 ; GFX11-NEXT: buffer_gl0_inv
230 ; GFX11-NEXT: s_setpc_b64 s[30:31]
232 ; GFX10-LABEL: local_atomic_fmin_noret_f32:
234 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
235 ; GFX10-NEXT: v_mov_b32_e32 v1, 4.0
236 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
237 ; GFX10-NEXT: ds_min_f32 v0, v1
238 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
239 ; GFX10-NEXT: buffer_gl0_inv
240 ; GFX10-NEXT: s_setpc_b64 s[30:31]
242 ; GFX90A-LABEL: local_atomic_fmin_noret_f32:
244 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
245 ; GFX90A-NEXT: v_mov_b32_e32 v1, 4.0
246 ; GFX90A-NEXT: ds_min_f32 v0, v1
247 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
248 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
250 ; GFX908-LABEL: local_atomic_fmin_noret_f32:
252 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
253 ; GFX908-NEXT: v_mov_b32_e32 v1, 4.0
254 ; GFX908-NEXT: ds_min_f32 v0, v1
255 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
256 ; GFX908-NEXT: s_setpc_b64 s[30:31]
258 ; GFX8-LABEL: local_atomic_fmin_noret_f32:
260 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
261 ; GFX8-NEXT: v_mov_b32_e32 v1, 4.0
262 ; GFX8-NEXT: s_mov_b32 m0, -1
263 ; GFX8-NEXT: ds_min_f32 v0, v1
264 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
265 ; GFX8-NEXT: s_setpc_b64 s[30:31]
267 ; GFX7-LABEL: local_atomic_fmin_noret_f32:
269 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
270 ; GFX7-NEXT: v_mov_b32_e32 v1, 4.0
271 ; GFX7-NEXT: s_mov_b32 m0, -1
272 ; GFX7-NEXT: ds_min_f32 v0, v1
273 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
274 ; GFX7-NEXT: s_setpc_b64 s[30:31]
276 ; GFX6-LABEL: local_atomic_fmin_noret_f32:
278 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
279 ; GFX6-NEXT: v_mov_b32_e32 v1, 4.0
280 ; GFX6-NEXT: s_mov_b32 m0, -1
281 ; GFX6-NEXT: ds_min_f32 v0, v1
282 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
283 ; GFX6-NEXT: s_setpc_b64 s[30:31]
284 %result = atomicrmw fmin ptr addrspace(3) %ptr, float 4.0 seq_cst
288 define void @local_atomic_fmin_noret_f32__offset(ptr addrspace(3) %ptr) nounwind {
289 ; GFX12-LABEL: local_atomic_fmin_noret_f32__offset:
291 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
292 ; GFX12-NEXT: s_wait_expcnt 0x0
293 ; GFX12-NEXT: s_wait_samplecnt 0x0
294 ; GFX12-NEXT: s_wait_bvhcnt 0x0
295 ; GFX12-NEXT: s_wait_kmcnt 0x0
296 ; GFX12-NEXT: v_mov_b32_e32 v1, 4.0
297 ; GFX12-NEXT: global_wb scope:SCOPE_SE
298 ; GFX12-NEXT: s_wait_storecnt 0x0
299 ; GFX12-NEXT: ds_min_num_f32 v0, v1 offset:65532
300 ; GFX12-NEXT: s_wait_dscnt 0x0
301 ; GFX12-NEXT: global_inv scope:SCOPE_SE
302 ; GFX12-NEXT: s_setpc_b64 s[30:31]
304 ; GFX940-LABEL: local_atomic_fmin_noret_f32__offset:
306 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
307 ; GFX940-NEXT: v_mov_b32_e32 v1, 4.0
308 ; GFX940-NEXT: ds_min_f32 v0, v1 offset:65532
309 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
310 ; GFX940-NEXT: s_setpc_b64 s[30:31]
312 ; GFX11-LABEL: local_atomic_fmin_noret_f32__offset:
314 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
315 ; GFX11-NEXT: v_mov_b32_e32 v1, 4.0
316 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
317 ; GFX11-NEXT: ds_min_f32 v0, v1 offset:65532
318 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
319 ; GFX11-NEXT: buffer_gl0_inv
320 ; GFX11-NEXT: s_setpc_b64 s[30:31]
322 ; GFX10-LABEL: local_atomic_fmin_noret_f32__offset:
324 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
325 ; GFX10-NEXT: v_mov_b32_e32 v1, 4.0
326 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
327 ; GFX10-NEXT: ds_min_f32 v0, v1 offset:65532
328 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
329 ; GFX10-NEXT: buffer_gl0_inv
330 ; GFX10-NEXT: s_setpc_b64 s[30:31]
332 ; GFX90A-LABEL: local_atomic_fmin_noret_f32__offset:
334 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
335 ; GFX90A-NEXT: v_mov_b32_e32 v1, 4.0
336 ; GFX90A-NEXT: ds_min_f32 v0, v1 offset:65532
337 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
338 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
340 ; GFX908-LABEL: local_atomic_fmin_noret_f32__offset:
342 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
343 ; GFX908-NEXT: v_mov_b32_e32 v1, 4.0
344 ; GFX908-NEXT: ds_min_f32 v0, v1 offset:65532
345 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
346 ; GFX908-NEXT: s_setpc_b64 s[30:31]
348 ; GFX8-LABEL: local_atomic_fmin_noret_f32__offset:
350 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
351 ; GFX8-NEXT: v_mov_b32_e32 v1, 4.0
352 ; GFX8-NEXT: s_mov_b32 m0, -1
353 ; GFX8-NEXT: ds_min_f32 v0, v1 offset:65532
354 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
355 ; GFX8-NEXT: s_setpc_b64 s[30:31]
357 ; GFX7-LABEL: local_atomic_fmin_noret_f32__offset:
359 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
360 ; GFX7-NEXT: v_mov_b32_e32 v1, 4.0
361 ; GFX7-NEXT: s_mov_b32 m0, -1
362 ; GFX7-NEXT: ds_min_f32 v0, v1 offset:65532
363 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
364 ; GFX7-NEXT: s_setpc_b64 s[30:31]
366 ; GFX6-LABEL: local_atomic_fmin_noret_f32__offset:
368 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
369 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffc, v0
370 ; GFX6-NEXT: v_mov_b32_e32 v1, 4.0
371 ; GFX6-NEXT: s_mov_b32 m0, -1
372 ; GFX6-NEXT: ds_min_f32 v0, v1
373 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
374 ; GFX6-NEXT: s_setpc_b64 s[30:31]
375 %gep = getelementptr float, ptr addrspace(3) %ptr, i32 16383
376 %unused = atomicrmw fmin ptr addrspace(3) %gep, float 4.0 seq_cst
380 ; --------------------------------------------------------------------
382 ; --------------------------------------------------------------------
384 define double @local_atomic_fmin_ret_f64(ptr addrspace(3) %ptr) nounwind {
385 ; GFX12-LABEL: local_atomic_fmin_ret_f64:
387 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
388 ; GFX12-NEXT: s_wait_expcnt 0x0
389 ; GFX12-NEXT: s_wait_samplecnt 0x0
390 ; GFX12-NEXT: s_wait_bvhcnt 0x0
391 ; GFX12-NEXT: s_wait_kmcnt 0x0
392 ; GFX12-NEXT: v_mov_b32_e32 v1, 0
393 ; GFX12-NEXT: v_mov_b32_e32 v2, 0x40100000
394 ; GFX12-NEXT: global_wb scope:SCOPE_SE
395 ; GFX12-NEXT: s_wait_storecnt 0x0
396 ; GFX12-NEXT: ds_min_num_rtn_f64 v[0:1], v0, v[1:2]
397 ; GFX12-NEXT: s_wait_dscnt 0x0
398 ; GFX12-NEXT: global_inv scope:SCOPE_SE
399 ; GFX12-NEXT: s_setpc_b64 s[30:31]
401 ; GFX940-LABEL: local_atomic_fmin_ret_f64:
403 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
404 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], 4.0
405 ; GFX940-NEXT: ds_min_rtn_f64 v[0:1], v0, v[2:3]
406 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
407 ; GFX940-NEXT: s_setpc_b64 s[30:31]
409 ; GFX11-LABEL: local_atomic_fmin_ret_f64:
411 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
412 ; GFX11-NEXT: v_mov_b32_e32 v1, 0
413 ; GFX11-NEXT: v_mov_b32_e32 v2, 0x40100000
414 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
415 ; GFX11-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2]
416 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
417 ; GFX11-NEXT: buffer_gl0_inv
418 ; GFX11-NEXT: s_setpc_b64 s[30:31]
420 ; GFX10-LABEL: local_atomic_fmin_ret_f64:
422 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
423 ; GFX10-NEXT: v_mov_b32_e32 v1, 0
424 ; GFX10-NEXT: v_mov_b32_e32 v2, 0x40100000
425 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
426 ; GFX10-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2]
427 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
428 ; GFX10-NEXT: buffer_gl0_inv
429 ; GFX10-NEXT: s_setpc_b64 s[30:31]
431 ; GFX90A-LABEL: local_atomic_fmin_ret_f64:
433 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
434 ; GFX90A-NEXT: v_mov_b32_e32 v2, 0
435 ; GFX90A-NEXT: v_mov_b32_e32 v3, 0x40100000
436 ; GFX90A-NEXT: ds_min_rtn_f64 v[0:1], v0, v[2:3]
437 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
438 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
440 ; GFX908-LABEL: local_atomic_fmin_ret_f64:
442 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
443 ; GFX908-NEXT: v_mov_b32_e32 v1, 0
444 ; GFX908-NEXT: v_mov_b32_e32 v2, 0x40100000
445 ; GFX908-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2]
446 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
447 ; GFX908-NEXT: s_setpc_b64 s[30:31]
449 ; GFX8-LABEL: local_atomic_fmin_ret_f64:
451 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
452 ; GFX8-NEXT: v_mov_b32_e32 v1, 0
453 ; GFX8-NEXT: v_mov_b32_e32 v2, 0x40100000
454 ; GFX8-NEXT: s_mov_b32 m0, -1
455 ; GFX8-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2]
456 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
457 ; GFX8-NEXT: s_setpc_b64 s[30:31]
459 ; GFX7-LABEL: local_atomic_fmin_ret_f64:
461 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
462 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
463 ; GFX7-NEXT: v_mov_b32_e32 v2, 0x40100000
464 ; GFX7-NEXT: s_mov_b32 m0, -1
465 ; GFX7-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2]
466 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
467 ; GFX7-NEXT: s_setpc_b64 s[30:31]
469 ; GFX6-LABEL: local_atomic_fmin_ret_f64:
471 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
472 ; GFX6-NEXT: v_mov_b32_e32 v1, 0
473 ; GFX6-NEXT: v_mov_b32_e32 v2, 0x40100000
474 ; GFX6-NEXT: s_mov_b32 m0, -1
475 ; GFX6-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2]
476 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
477 ; GFX6-NEXT: s_setpc_b64 s[30:31]
478 %result = atomicrmw fmin ptr addrspace(3) %ptr, double 4.0 seq_cst
482 define double @local_atomic_fmin_ret_f64__offset(ptr addrspace(3) %ptr) nounwind {
483 ; GFX12-LABEL: local_atomic_fmin_ret_f64__offset:
485 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
486 ; GFX12-NEXT: s_wait_expcnt 0x0
487 ; GFX12-NEXT: s_wait_samplecnt 0x0
488 ; GFX12-NEXT: s_wait_bvhcnt 0x0
489 ; GFX12-NEXT: s_wait_kmcnt 0x0
490 ; GFX12-NEXT: v_mov_b32_e32 v1, 0
491 ; GFX12-NEXT: v_mov_b32_e32 v2, 0x40100000
492 ; GFX12-NEXT: global_wb scope:SCOPE_SE
493 ; GFX12-NEXT: s_wait_storecnt 0x0
494 ; GFX12-NEXT: ds_min_num_rtn_f64 v[0:1], v0, v[1:2] offset:65528
495 ; GFX12-NEXT: s_wait_dscnt 0x0
496 ; GFX12-NEXT: global_inv scope:SCOPE_SE
497 ; GFX12-NEXT: s_setpc_b64 s[30:31]
499 ; GFX940-LABEL: local_atomic_fmin_ret_f64__offset:
501 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
502 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], 4.0
503 ; GFX940-NEXT: ds_min_rtn_f64 v[0:1], v0, v[2:3] offset:65528
504 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
505 ; GFX940-NEXT: s_setpc_b64 s[30:31]
507 ; GFX11-LABEL: local_atomic_fmin_ret_f64__offset:
509 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
510 ; GFX11-NEXT: v_mov_b32_e32 v1, 0
511 ; GFX11-NEXT: v_mov_b32_e32 v2, 0x40100000
512 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
513 ; GFX11-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2] offset:65528
514 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
515 ; GFX11-NEXT: buffer_gl0_inv
516 ; GFX11-NEXT: s_setpc_b64 s[30:31]
518 ; GFX10-LABEL: local_atomic_fmin_ret_f64__offset:
520 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
521 ; GFX10-NEXT: v_mov_b32_e32 v1, 0
522 ; GFX10-NEXT: v_mov_b32_e32 v2, 0x40100000
523 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
524 ; GFX10-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2] offset:65528
525 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
526 ; GFX10-NEXT: buffer_gl0_inv
527 ; GFX10-NEXT: s_setpc_b64 s[30:31]
529 ; GFX90A-LABEL: local_atomic_fmin_ret_f64__offset:
531 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
532 ; GFX90A-NEXT: v_mov_b32_e32 v2, 0
533 ; GFX90A-NEXT: v_mov_b32_e32 v3, 0x40100000
534 ; GFX90A-NEXT: ds_min_rtn_f64 v[0:1], v0, v[2:3] offset:65528
535 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
536 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
538 ; GFX908-LABEL: local_atomic_fmin_ret_f64__offset:
540 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
541 ; GFX908-NEXT: v_mov_b32_e32 v1, 0
542 ; GFX908-NEXT: v_mov_b32_e32 v2, 0x40100000
543 ; GFX908-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2] offset:65528
544 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
545 ; GFX908-NEXT: s_setpc_b64 s[30:31]
547 ; GFX8-LABEL: local_atomic_fmin_ret_f64__offset:
549 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
550 ; GFX8-NEXT: v_mov_b32_e32 v1, 0
551 ; GFX8-NEXT: v_mov_b32_e32 v2, 0x40100000
552 ; GFX8-NEXT: s_mov_b32 m0, -1
553 ; GFX8-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2] offset:65528
554 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
555 ; GFX8-NEXT: s_setpc_b64 s[30:31]
557 ; GFX7-LABEL: local_atomic_fmin_ret_f64__offset:
559 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
560 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
561 ; GFX7-NEXT: v_mov_b32_e32 v2, 0x40100000
562 ; GFX7-NEXT: s_mov_b32 m0, -1
563 ; GFX7-NEXT: ds_min_rtn_f64 v[0:1], v0, v[1:2] offset:65528
564 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
565 ; GFX7-NEXT: s_setpc_b64 s[30:31]
567 ; GFX6-LABEL: local_atomic_fmin_ret_f64__offset:
569 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
570 ; GFX6-NEXT: v_add_i32_e32 v2, vcc, 0xfff8, v0
571 ; GFX6-NEXT: v_mov_b32_e32 v0, 0
572 ; GFX6-NEXT: v_mov_b32_e32 v1, 0x40100000
573 ; GFX6-NEXT: s_mov_b32 m0, -1
574 ; GFX6-NEXT: ds_min_rtn_f64 v[0:1], v2, v[0:1]
575 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
576 ; GFX6-NEXT: s_setpc_b64 s[30:31]
577 %gep = getelementptr double, ptr addrspace(3) %ptr, i32 8191
578 %result = atomicrmw fmin ptr addrspace(3) %gep, double 4.0 seq_cst
582 define void @local_atomic_fmin_noret_f64(ptr addrspace(3) %ptr) nounwind {
583 ; GFX12-LABEL: local_atomic_fmin_noret_f64:
585 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
586 ; GFX12-NEXT: s_wait_expcnt 0x0
587 ; GFX12-NEXT: s_wait_samplecnt 0x0
588 ; GFX12-NEXT: s_wait_bvhcnt 0x0
589 ; GFX12-NEXT: s_wait_kmcnt 0x0
590 ; GFX12-NEXT: v_mov_b32_e32 v1, 0
591 ; GFX12-NEXT: v_mov_b32_e32 v2, 0x40100000
592 ; GFX12-NEXT: global_wb scope:SCOPE_SE
593 ; GFX12-NEXT: s_wait_storecnt 0x0
594 ; GFX12-NEXT: ds_min_num_f64 v0, v[1:2]
595 ; GFX12-NEXT: s_wait_dscnt 0x0
596 ; GFX12-NEXT: global_inv scope:SCOPE_SE
597 ; GFX12-NEXT: s_setpc_b64 s[30:31]
599 ; GFX940-LABEL: local_atomic_fmin_noret_f64:
601 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
602 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], 4.0
603 ; GFX940-NEXT: ds_min_f64 v0, v[2:3]
604 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
605 ; GFX940-NEXT: s_setpc_b64 s[30:31]
607 ; GFX11-LABEL: local_atomic_fmin_noret_f64:
609 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
610 ; GFX11-NEXT: v_mov_b32_e32 v1, 0
611 ; GFX11-NEXT: v_mov_b32_e32 v2, 0x40100000
612 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
613 ; GFX11-NEXT: ds_min_f64 v0, v[1:2]
614 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
615 ; GFX11-NEXT: buffer_gl0_inv
616 ; GFX11-NEXT: s_setpc_b64 s[30:31]
618 ; GFX10-LABEL: local_atomic_fmin_noret_f64:
620 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
621 ; GFX10-NEXT: v_mov_b32_e32 v1, 0
622 ; GFX10-NEXT: v_mov_b32_e32 v2, 0x40100000
623 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
624 ; GFX10-NEXT: ds_min_f64 v0, v[1:2]
625 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
626 ; GFX10-NEXT: buffer_gl0_inv
627 ; GFX10-NEXT: s_setpc_b64 s[30:31]
629 ; GFX90A-LABEL: local_atomic_fmin_noret_f64:
631 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
632 ; GFX90A-NEXT: v_mov_b32_e32 v2, 0
633 ; GFX90A-NEXT: v_mov_b32_e32 v3, 0x40100000
634 ; GFX90A-NEXT: ds_min_f64 v0, v[2:3]
635 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
636 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
638 ; GFX908-LABEL: local_atomic_fmin_noret_f64:
640 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
641 ; GFX908-NEXT: v_mov_b32_e32 v1, 0
642 ; GFX908-NEXT: v_mov_b32_e32 v2, 0x40100000
643 ; GFX908-NEXT: ds_min_f64 v0, v[1:2]
644 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
645 ; GFX908-NEXT: s_setpc_b64 s[30:31]
647 ; GFX8-LABEL: local_atomic_fmin_noret_f64:
649 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
650 ; GFX8-NEXT: v_mov_b32_e32 v1, 0
651 ; GFX8-NEXT: v_mov_b32_e32 v2, 0x40100000
652 ; GFX8-NEXT: s_mov_b32 m0, -1
653 ; GFX8-NEXT: ds_min_f64 v0, v[1:2]
654 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
655 ; GFX8-NEXT: s_setpc_b64 s[30:31]
657 ; GFX7-LABEL: local_atomic_fmin_noret_f64:
659 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
660 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
661 ; GFX7-NEXT: v_mov_b32_e32 v2, 0x40100000
662 ; GFX7-NEXT: s_mov_b32 m0, -1
663 ; GFX7-NEXT: ds_min_f64 v0, v[1:2]
664 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
665 ; GFX7-NEXT: s_setpc_b64 s[30:31]
667 ; GFX6-LABEL: local_atomic_fmin_noret_f64:
669 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
670 ; GFX6-NEXT: v_mov_b32_e32 v1, 0
671 ; GFX6-NEXT: v_mov_b32_e32 v2, 0x40100000
672 ; GFX6-NEXT: s_mov_b32 m0, -1
673 ; GFX6-NEXT: ds_min_f64 v0, v[1:2]
674 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
675 ; GFX6-NEXT: s_setpc_b64 s[30:31]
676 %result = atomicrmw fmin ptr addrspace(3) %ptr, double 4.0 seq_cst
680 define void @local_atomic_fmin_noret_f64__offset(ptr addrspace(3) %ptr) nounwind {
681 ; GFX12-LABEL: local_atomic_fmin_noret_f64__offset:
683 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
684 ; GFX12-NEXT: s_wait_expcnt 0x0
685 ; GFX12-NEXT: s_wait_samplecnt 0x0
686 ; GFX12-NEXT: s_wait_bvhcnt 0x0
687 ; GFX12-NEXT: s_wait_kmcnt 0x0
688 ; GFX12-NEXT: v_mov_b32_e32 v1, 0
689 ; GFX12-NEXT: v_mov_b32_e32 v2, 0x40100000
690 ; GFX12-NEXT: global_wb scope:SCOPE_SE
691 ; GFX12-NEXT: s_wait_storecnt 0x0
692 ; GFX12-NEXT: ds_min_num_f64 v0, v[1:2] offset:65528
693 ; GFX12-NEXT: s_wait_dscnt 0x0
694 ; GFX12-NEXT: global_inv scope:SCOPE_SE
695 ; GFX12-NEXT: s_setpc_b64 s[30:31]
697 ; GFX940-LABEL: local_atomic_fmin_noret_f64__offset:
699 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
700 ; GFX940-NEXT: v_mov_b64_e32 v[2:3], 4.0
701 ; GFX940-NEXT: ds_min_f64 v0, v[2:3] offset:65528
702 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
703 ; GFX940-NEXT: s_setpc_b64 s[30:31]
705 ; GFX11-LABEL: local_atomic_fmin_noret_f64__offset:
707 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
708 ; GFX11-NEXT: v_mov_b32_e32 v1, 0
709 ; GFX11-NEXT: v_mov_b32_e32 v2, 0x40100000
710 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
711 ; GFX11-NEXT: ds_min_f64 v0, v[1:2] offset:65528
712 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
713 ; GFX11-NEXT: buffer_gl0_inv
714 ; GFX11-NEXT: s_setpc_b64 s[30:31]
716 ; GFX10-LABEL: local_atomic_fmin_noret_f64__offset:
718 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
719 ; GFX10-NEXT: v_mov_b32_e32 v1, 0
720 ; GFX10-NEXT: v_mov_b32_e32 v2, 0x40100000
721 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
722 ; GFX10-NEXT: ds_min_f64 v0, v[1:2] offset:65528
723 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
724 ; GFX10-NEXT: buffer_gl0_inv
725 ; GFX10-NEXT: s_setpc_b64 s[30:31]
727 ; GFX90A-LABEL: local_atomic_fmin_noret_f64__offset:
729 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
730 ; GFX90A-NEXT: v_mov_b32_e32 v2, 0
731 ; GFX90A-NEXT: v_mov_b32_e32 v3, 0x40100000
732 ; GFX90A-NEXT: ds_min_f64 v0, v[2:3] offset:65528
733 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
734 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
736 ; GFX908-LABEL: local_atomic_fmin_noret_f64__offset:
738 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
739 ; GFX908-NEXT: v_mov_b32_e32 v1, 0
740 ; GFX908-NEXT: v_mov_b32_e32 v2, 0x40100000
741 ; GFX908-NEXT: ds_min_f64 v0, v[1:2] offset:65528
742 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
743 ; GFX908-NEXT: s_setpc_b64 s[30:31]
745 ; GFX8-LABEL: local_atomic_fmin_noret_f64__offset:
747 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
748 ; GFX8-NEXT: v_mov_b32_e32 v1, 0
749 ; GFX8-NEXT: v_mov_b32_e32 v2, 0x40100000
750 ; GFX8-NEXT: s_mov_b32 m0, -1
751 ; GFX8-NEXT: ds_min_f64 v0, v[1:2] offset:65528
752 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
753 ; GFX8-NEXT: s_setpc_b64 s[30:31]
755 ; GFX7-LABEL: local_atomic_fmin_noret_f64__offset:
757 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
758 ; GFX7-NEXT: v_mov_b32_e32 v1, 0
759 ; GFX7-NEXT: v_mov_b32_e32 v2, 0x40100000
760 ; GFX7-NEXT: s_mov_b32 m0, -1
761 ; GFX7-NEXT: ds_min_f64 v0, v[1:2] offset:65528
762 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
763 ; GFX7-NEXT: s_setpc_b64 s[30:31]
765 ; GFX6-LABEL: local_atomic_fmin_noret_f64__offset:
767 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
768 ; GFX6-NEXT: v_add_i32_e32 v2, vcc, 0xfff8, v0
769 ; GFX6-NEXT: v_mov_b32_e32 v0, 0
770 ; GFX6-NEXT: v_mov_b32_e32 v1, 0x40100000
771 ; GFX6-NEXT: s_mov_b32 m0, -1
772 ; GFX6-NEXT: ds_min_f64 v2, v[0:1]
773 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
774 ; GFX6-NEXT: s_setpc_b64 s[30:31]
775 %gep = getelementptr double, ptr addrspace(3) %ptr, i32 8191
776 %unused = atomicrmw fmin ptr addrspace(3) %gep, double 4.0 seq_cst
780 ; --------------------------------------------------------------------
782 ; --------------------------------------------------------------------
784 define half @local_atomic_fmin_ret_f16(ptr addrspace(3) %ptr) nounwind {
785 ; GFX12-LABEL: local_atomic_fmin_ret_f16:
787 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
788 ; GFX12-NEXT: s_wait_expcnt 0x0
789 ; GFX12-NEXT: s_wait_samplecnt 0x0
790 ; GFX12-NEXT: s_wait_bvhcnt 0x0
791 ; GFX12-NEXT: s_wait_kmcnt 0x0
792 ; GFX12-NEXT: v_and_b32_e32 v1, -4, v0
793 ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 3, v0
794 ; GFX12-NEXT: s_mov_b32 s0, 0
795 ; GFX12-NEXT: ds_load_b32 v3, v1
796 ; GFX12-NEXT: v_lshlrev_b32_e64 v2, v0, 0xffff
797 ; GFX12-NEXT: v_and_b32_e32 v0, 24, v0
798 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2)
799 ; GFX12-NEXT: v_not_b32_e32 v2, v2
800 ; GFX12-NEXT: .LBB8_1: ; %atomicrmw.start
801 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
802 ; GFX12-NEXT: s_wait_dscnt 0x0
803 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
804 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
805 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v0, v4
806 ; GFX12-NEXT: v_max_num_f16_e32 v3, v3, v3
807 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
808 ; GFX12-NEXT: v_min_num_f16_e32 v3, 4.0, v3
809 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
810 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
811 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v0, v3
812 ; GFX12-NEXT: v_and_or_b32 v3, v4, v2, v3
813 ; GFX12-NEXT: global_wb scope:SCOPE_SE
814 ; GFX12-NEXT: s_wait_storecnt 0x0
815 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v3, v1, v3, v4
816 ; GFX12-NEXT: s_wait_dscnt 0x0
817 ; GFX12-NEXT: global_inv scope:SCOPE_SE
818 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
819 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
820 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
821 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
822 ; GFX12-NEXT: s_cbranch_execnz .LBB8_1
823 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
824 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
825 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v0, v3
826 ; GFX12-NEXT: s_setpc_b64 s[30:31]
828 ; GFX940-LABEL: local_atomic_fmin_ret_f16:
830 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
831 ; GFX940-NEXT: v_and_b32_e32 v1, -4, v0
832 ; GFX940-NEXT: ds_read_b32 v3, v1
833 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 3, v0
834 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
835 ; GFX940-NEXT: v_and_b32_e32 v0, 24, v2
836 ; GFX940-NEXT: v_lshlrev_b32_e64 v2, v2, s0
837 ; GFX940-NEXT: v_not_b32_e32 v2, v2
838 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
839 ; GFX940-NEXT: .LBB8_1: ; %atomicrmw.start
840 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
841 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
842 ; GFX940-NEXT: v_mov_b32_e32 v4, v3
843 ; GFX940-NEXT: v_lshrrev_b32_e32 v3, v0, v4
844 ; GFX940-NEXT: v_max_f16_e32 v3, v3, v3
845 ; GFX940-NEXT: v_min_f16_e32 v3, 4.0, v3
846 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, v0, v3
847 ; GFX940-NEXT: v_and_or_b32 v3, v4, v2, v3
848 ; GFX940-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
849 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
850 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
851 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
852 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
853 ; GFX940-NEXT: s_cbranch_execnz .LBB8_1
854 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
855 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
856 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v0, v3
857 ; GFX940-NEXT: s_setpc_b64 s[30:31]
859 ; GFX11-LABEL: local_atomic_fmin_ret_f16:
861 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
862 ; GFX11-NEXT: v_and_b32_e32 v1, -4, v0
863 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
864 ; GFX11-NEXT: s_mov_b32 s0, 0
865 ; GFX11-NEXT: ds_load_b32 v3, v1
866 ; GFX11-NEXT: v_lshlrev_b32_e64 v2, v0, 0xffff
867 ; GFX11-NEXT: v_and_b32_e32 v0, 24, v0
868 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2)
869 ; GFX11-NEXT: v_not_b32_e32 v2, v2
870 ; GFX11-NEXT: .LBB8_1: ; %atomicrmw.start
871 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
872 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
873 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
874 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
875 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v0, v4
876 ; GFX11-NEXT: v_max_f16_e32 v3, v3, v3
877 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
878 ; GFX11-NEXT: v_min_f16_e32 v3, 4.0, v3
879 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
880 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
881 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v0, v3
882 ; GFX11-NEXT: v_and_or_b32 v3, v4, v2, v3
883 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
884 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v3, v1, v3, v4
885 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
886 ; GFX11-NEXT: buffer_gl0_inv
887 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
888 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
889 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
890 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
891 ; GFX11-NEXT: s_cbranch_execnz .LBB8_1
892 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
893 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
894 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v0, v3
895 ; GFX11-NEXT: s_setpc_b64 s[30:31]
897 ; GFX10-LABEL: local_atomic_fmin_ret_f16:
899 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
900 ; GFX10-NEXT: v_and_b32_e32 v1, -4, v0
901 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 3, v0
902 ; GFX10-NEXT: s_mov_b32 s4, 0
903 ; GFX10-NEXT: ds_read_b32 v2, v1
904 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v0, 0xffff
905 ; GFX10-NEXT: v_and_b32_e32 v0, 24, v0
906 ; GFX10-NEXT: v_not_b32_e32 v3, v3
907 ; GFX10-NEXT: .LBB8_1: ; %atomicrmw.start
908 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
909 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
910 ; GFX10-NEXT: v_mov_b32_e32 v4, v2
911 ; GFX10-NEXT: v_lshrrev_b32_e32 v2, v0, v4
912 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
913 ; GFX10-NEXT: v_min_f16_e32 v2, 4.0, v2
914 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v0, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
915 ; GFX10-NEXT: v_and_or_b32 v2, v4, v3, v2
916 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
917 ; GFX10-NEXT: ds_cmpst_rtn_b32 v2, v1, v4, v2
918 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
919 ; GFX10-NEXT: buffer_gl0_inv
920 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v4
921 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
922 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
923 ; GFX10-NEXT: s_cbranch_execnz .LBB8_1
924 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
925 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
926 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v0, v2
927 ; GFX10-NEXT: s_setpc_b64 s[30:31]
929 ; GFX90A-LABEL: local_atomic_fmin_ret_f16:
931 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
932 ; GFX90A-NEXT: v_and_b32_e32 v1, -4, v0
933 ; GFX90A-NEXT: ds_read_b32 v3, v1
934 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 3, v0
935 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
936 ; GFX90A-NEXT: v_and_b32_e32 v0, 24, v2
937 ; GFX90A-NEXT: v_lshlrev_b32_e64 v2, v2, s4
938 ; GFX90A-NEXT: v_not_b32_e32 v2, v2
939 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
940 ; GFX90A-NEXT: .LBB8_1: ; %atomicrmw.start
941 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
942 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
943 ; GFX90A-NEXT: v_mov_b32_e32 v4, v3
944 ; GFX90A-NEXT: v_lshrrev_b32_e32 v3, v0, v4
945 ; GFX90A-NEXT: v_max_f16_e32 v3, v3, v3
946 ; GFX90A-NEXT: v_min_f16_e32 v3, 4.0, v3
947 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, v0, v3
948 ; GFX90A-NEXT: v_and_or_b32 v3, v4, v2, v3
949 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
950 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
951 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
952 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
953 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
954 ; GFX90A-NEXT: s_cbranch_execnz .LBB8_1
955 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
956 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
957 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v0, v3
958 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
960 ; GFX908-LABEL: local_atomic_fmin_ret_f16:
962 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
963 ; GFX908-NEXT: v_and_b32_e32 v1, -4, v0
964 ; GFX908-NEXT: ds_read_b32 v3, v1
965 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 3, v0
966 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
967 ; GFX908-NEXT: v_and_b32_e32 v0, 24, v2
968 ; GFX908-NEXT: v_lshlrev_b32_e64 v2, v2, s4
969 ; GFX908-NEXT: v_not_b32_e32 v2, v2
970 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
971 ; GFX908-NEXT: .LBB8_1: ; %atomicrmw.start
972 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
973 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
974 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
975 ; GFX908-NEXT: v_lshrrev_b32_e32 v3, v0, v4
976 ; GFX908-NEXT: v_max_f16_e32 v3, v3, v3
977 ; GFX908-NEXT: v_min_f16_e32 v3, 4.0, v3
978 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, v0, v3
979 ; GFX908-NEXT: v_and_or_b32 v3, v4, v2, v3
980 ; GFX908-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
981 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
982 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
983 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
984 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
985 ; GFX908-NEXT: s_cbranch_execnz .LBB8_1
986 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
987 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
988 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v0, v3
989 ; GFX908-NEXT: s_setpc_b64 s[30:31]
991 ; GFX8-LABEL: local_atomic_fmin_ret_f16:
993 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
994 ; GFX8-NEXT: v_and_b32_e32 v1, -4, v0
995 ; GFX8-NEXT: s_mov_b32 m0, -1
996 ; GFX8-NEXT: ds_read_b32 v3, v1
997 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 3, v0
998 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
999 ; GFX8-NEXT: v_and_b32_e32 v0, 24, v2
1000 ; GFX8-NEXT: v_lshlrev_b32_e64 v2, v2, s4
1001 ; GFX8-NEXT: v_not_b32_e32 v2, v2
1002 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1003 ; GFX8-NEXT: .LBB8_1: ; %atomicrmw.start
1004 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1005 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1006 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
1007 ; GFX8-NEXT: v_lshrrev_b32_e32 v3, v0, v4
1008 ; GFX8-NEXT: v_max_f16_e32 v3, v3, v3
1009 ; GFX8-NEXT: v_min_f16_e32 v3, 4.0, v3
1010 ; GFX8-NEXT: v_and_b32_e32 v5, v4, v2
1011 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, v0, v3
1012 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
1013 ; GFX8-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
1014 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1015 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1016 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1017 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1018 ; GFX8-NEXT: s_cbranch_execnz .LBB8_1
1019 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1020 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1021 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v0, v3
1022 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1024 ; GFX7-LABEL: local_atomic_fmin_ret_f16:
1026 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1027 ; GFX7-NEXT: v_and_b32_e32 v1, -4, v0
1028 ; GFX7-NEXT: s_mov_b32 m0, -1
1029 ; GFX7-NEXT: ds_read_b32 v3, v1
1030 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v0
1031 ; GFX7-NEXT: v_and_b32_e32 v0, 24, v2
1032 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v2
1033 ; GFX7-NEXT: v_not_b32_e32 v2, v2
1034 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
1035 ; GFX7-NEXT: .LBB8_1: ; %atomicrmw.start
1036 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1037 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1038 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
1039 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, v0, v4
1040 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
1041 ; GFX7-NEXT: v_and_b32_e32 v5, v4, v2
1042 ; GFX7-NEXT: v_min_f32_e32 v3, 4.0, v3
1043 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
1044 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, v0, v3
1045 ; GFX7-NEXT: v_or_b32_e32 v3, v5, v3
1046 ; GFX7-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
1047 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1048 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1049 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1050 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
1051 ; GFX7-NEXT: s_cbranch_execnz .LBB8_1
1052 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1053 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
1054 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v0, v3
1055 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
1056 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1058 ; GFX6-LABEL: local_atomic_fmin_ret_f16:
1060 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1061 ; GFX6-NEXT: v_and_b32_e32 v1, -4, v0
1062 ; GFX6-NEXT: s_mov_b32 m0, -1
1063 ; GFX6-NEXT: ds_read_b32 v3, v1
1064 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 3, v0
1065 ; GFX6-NEXT: v_and_b32_e32 v0, 24, v2
1066 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v2
1067 ; GFX6-NEXT: v_not_b32_e32 v2, v2
1068 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
1069 ; GFX6-NEXT: .LBB8_1: ; %atomicrmw.start
1070 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
1071 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1072 ; GFX6-NEXT: v_mov_b32_e32 v4, v3
1073 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, v0, v4
1074 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
1075 ; GFX6-NEXT: v_and_b32_e32 v5, v4, v2
1076 ; GFX6-NEXT: v_min_f32_e32 v3, 4.0, v3
1077 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
1078 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, v0, v3
1079 ; GFX6-NEXT: v_or_b32_e32 v3, v5, v3
1080 ; GFX6-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
1081 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1082 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1083 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1084 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
1085 ; GFX6-NEXT: s_cbranch_execnz .LBB8_1
1086 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
1087 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
1088 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v0, v3
1089 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v0
1090 ; GFX6-NEXT: s_setpc_b64 s[30:31]
1091 %result = atomicrmw fmin ptr addrspace(3) %ptr, half 4.0 seq_cst
1095 define half @local_atomic_fmin_ret_f16__offset(ptr addrspace(3) %ptr) nounwind {
1096 ; GFX12-LABEL: local_atomic_fmin_ret_f16__offset:
1098 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1099 ; GFX12-NEXT: s_wait_expcnt 0x0
1100 ; GFX12-NEXT: s_wait_samplecnt 0x0
1101 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1102 ; GFX12-NEXT: s_wait_kmcnt 0x0
1103 ; GFX12-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
1104 ; GFX12-NEXT: s_mov_b32 s0, 0
1105 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
1106 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v1
1107 ; GFX12-NEXT: v_and_b32_e32 v1, 3, v1
1108 ; GFX12-NEXT: ds_load_b32 v3, v0
1109 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1110 ; GFX12-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
1111 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
1112 ; GFX12-NEXT: v_not_b32_e32 v2, v2
1113 ; GFX12-NEXT: .LBB9_1: ; %atomicrmw.start
1114 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
1115 ; GFX12-NEXT: s_wait_dscnt 0x0
1116 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
1117 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1118 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v1, v4
1119 ; GFX12-NEXT: v_max_num_f16_e32 v3, v3, v3
1120 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1121 ; GFX12-NEXT: v_min_num_f16_e32 v3, 4.0, v3
1122 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
1123 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1124 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v1, v3
1125 ; GFX12-NEXT: v_and_or_b32 v3, v4, v2, v3
1126 ; GFX12-NEXT: global_wb scope:SCOPE_SE
1127 ; GFX12-NEXT: s_wait_storecnt 0x0
1128 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v3, v0, v3, v4
1129 ; GFX12-NEXT: s_wait_dscnt 0x0
1130 ; GFX12-NEXT: global_inv scope:SCOPE_SE
1131 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1132 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
1133 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1134 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1135 ; GFX12-NEXT: s_cbranch_execnz .LBB9_1
1136 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
1137 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
1138 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v1, v3
1139 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1141 ; GFX940-LABEL: local_atomic_fmin_ret_f16__offset:
1143 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1144 ; GFX940-NEXT: v_add_u32_e32 v0, 0xfffe, v0
1145 ; GFX940-NEXT: v_and_b32_e32 v1, -4, v0
1146 ; GFX940-NEXT: ds_read_b32 v3, v1
1147 ; GFX940-NEXT: v_and_b32_e32 v0, 3, v0
1148 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 3, v0
1149 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
1150 ; GFX940-NEXT: v_lshlrev_b32_e64 v2, v0, s0
1151 ; GFX940-NEXT: v_not_b32_e32 v2, v2
1152 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
1153 ; GFX940-NEXT: .LBB9_1: ; %atomicrmw.start
1154 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
1155 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
1156 ; GFX940-NEXT: v_mov_b32_e32 v4, v3
1157 ; GFX940-NEXT: v_lshrrev_b32_e32 v3, v0, v4
1158 ; GFX940-NEXT: v_max_f16_e32 v3, v3, v3
1159 ; GFX940-NEXT: v_min_f16_e32 v3, 4.0, v3
1160 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, v0, v3
1161 ; GFX940-NEXT: v_and_or_b32 v3, v4, v2, v3
1162 ; GFX940-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
1163 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
1164 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1165 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
1166 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
1167 ; GFX940-NEXT: s_cbranch_execnz .LBB9_1
1168 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
1169 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
1170 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v0, v3
1171 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1173 ; GFX11-LABEL: local_atomic_fmin_ret_f16__offset:
1175 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1176 ; GFX11-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
1177 ; GFX11-NEXT: s_mov_b32 s0, 0
1178 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
1179 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v1
1180 ; GFX11-NEXT: v_and_b32_e32 v1, 3, v1
1181 ; GFX11-NEXT: ds_load_b32 v3, v0
1182 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1183 ; GFX11-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
1184 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
1185 ; GFX11-NEXT: v_not_b32_e32 v2, v2
1186 ; GFX11-NEXT: .LBB9_1: ; %atomicrmw.start
1187 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
1188 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1189 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
1190 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1191 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v1, v4
1192 ; GFX11-NEXT: v_max_f16_e32 v3, v3, v3
1193 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1194 ; GFX11-NEXT: v_min_f16_e32 v3, 4.0, v3
1195 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
1196 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1197 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v1, v3
1198 ; GFX11-NEXT: v_and_or_b32 v3, v4, v2, v3
1199 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1200 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v3, v0, v3, v4
1201 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1202 ; GFX11-NEXT: buffer_gl0_inv
1203 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1204 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
1205 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1206 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1207 ; GFX11-NEXT: s_cbranch_execnz .LBB9_1
1208 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
1209 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
1210 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v1, v3
1211 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1213 ; GFX10-LABEL: local_atomic_fmin_ret_f16__offset:
1215 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1216 ; GFX10-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
1217 ; GFX10-NEXT: s_mov_b32 s4, 0
1218 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v1
1219 ; GFX10-NEXT: v_and_b32_e32 v1, 3, v1
1220 ; GFX10-NEXT: ds_read_b32 v3, v0
1221 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1222 ; GFX10-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
1223 ; GFX10-NEXT: v_not_b32_e32 v2, v2
1224 ; GFX10-NEXT: .LBB9_1: ; %atomicrmw.start
1225 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1226 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1227 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
1228 ; GFX10-NEXT: v_lshrrev_b32_e32 v3, v1, v4
1229 ; GFX10-NEXT: v_max_f16_e32 v3, v3, v3
1230 ; GFX10-NEXT: v_min_f16_e32 v3, 4.0, v3
1231 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v1, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
1232 ; GFX10-NEXT: v_and_or_b32 v3, v4, v2, v3
1233 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1234 ; GFX10-NEXT: ds_cmpst_rtn_b32 v3, v0, v4, v3
1235 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1236 ; GFX10-NEXT: buffer_gl0_inv
1237 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1238 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1239 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1240 ; GFX10-NEXT: s_cbranch_execnz .LBB9_1
1241 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1242 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1243 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v1, v3
1244 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1246 ; GFX90A-LABEL: local_atomic_fmin_ret_f16__offset:
1248 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1249 ; GFX90A-NEXT: v_add_u32_e32 v0, 0xfffe, v0
1250 ; GFX90A-NEXT: v_and_b32_e32 v1, -4, v0
1251 ; GFX90A-NEXT: ds_read_b32 v3, v1
1252 ; GFX90A-NEXT: v_and_b32_e32 v0, 3, v0
1253 ; GFX90A-NEXT: v_lshlrev_b32_e32 v0, 3, v0
1254 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
1255 ; GFX90A-NEXT: v_lshlrev_b32_e64 v2, v0, s4
1256 ; GFX90A-NEXT: v_not_b32_e32 v2, v2
1257 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1258 ; GFX90A-NEXT: .LBB9_1: ; %atomicrmw.start
1259 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1260 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
1261 ; GFX90A-NEXT: v_mov_b32_e32 v4, v3
1262 ; GFX90A-NEXT: v_lshrrev_b32_e32 v3, v0, v4
1263 ; GFX90A-NEXT: v_max_f16_e32 v3, v3, v3
1264 ; GFX90A-NEXT: v_min_f16_e32 v3, 4.0, v3
1265 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, v0, v3
1266 ; GFX90A-NEXT: v_and_or_b32 v3, v4, v2, v3
1267 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
1268 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
1269 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1270 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1271 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1272 ; GFX90A-NEXT: s_cbranch_execnz .LBB9_1
1273 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1274 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1275 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v0, v3
1276 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1278 ; GFX908-LABEL: local_atomic_fmin_ret_f16__offset:
1280 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1281 ; GFX908-NEXT: v_add_u32_e32 v0, 0xfffe, v0
1282 ; GFX908-NEXT: v_and_b32_e32 v1, -4, v0
1283 ; GFX908-NEXT: ds_read_b32 v3, v1
1284 ; GFX908-NEXT: v_and_b32_e32 v0, 3, v0
1285 ; GFX908-NEXT: v_lshlrev_b32_e32 v0, 3, v0
1286 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
1287 ; GFX908-NEXT: v_lshlrev_b32_e64 v2, v0, s4
1288 ; GFX908-NEXT: v_not_b32_e32 v2, v2
1289 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1290 ; GFX908-NEXT: .LBB9_1: ; %atomicrmw.start
1291 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1292 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
1293 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
1294 ; GFX908-NEXT: v_lshrrev_b32_e32 v3, v0, v4
1295 ; GFX908-NEXT: v_max_f16_e32 v3, v3, v3
1296 ; GFX908-NEXT: v_min_f16_e32 v3, 4.0, v3
1297 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, v0, v3
1298 ; GFX908-NEXT: v_and_or_b32 v3, v4, v2, v3
1299 ; GFX908-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
1300 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
1301 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1302 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1303 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1304 ; GFX908-NEXT: s_cbranch_execnz .LBB9_1
1305 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1306 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1307 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v0, v3
1308 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1310 ; GFX8-LABEL: local_atomic_fmin_ret_f16__offset:
1312 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1313 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffe, v0
1314 ; GFX8-NEXT: v_and_b32_e32 v1, -4, v0
1315 ; GFX8-NEXT: s_mov_b32 m0, -1
1316 ; GFX8-NEXT: ds_read_b32 v3, v1
1317 ; GFX8-NEXT: v_and_b32_e32 v0, 3, v0
1318 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 3, v0
1319 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
1320 ; GFX8-NEXT: v_lshlrev_b32_e64 v2, v0, s4
1321 ; GFX8-NEXT: v_not_b32_e32 v2, v2
1322 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1323 ; GFX8-NEXT: .LBB9_1: ; %atomicrmw.start
1324 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1325 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1326 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
1327 ; GFX8-NEXT: v_lshrrev_b32_e32 v3, v0, v4
1328 ; GFX8-NEXT: v_max_f16_e32 v3, v3, v3
1329 ; GFX8-NEXT: v_min_f16_e32 v3, 4.0, v3
1330 ; GFX8-NEXT: v_and_b32_e32 v5, v4, v2
1331 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, v0, v3
1332 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
1333 ; GFX8-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
1334 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1335 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1336 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1337 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1338 ; GFX8-NEXT: s_cbranch_execnz .LBB9_1
1339 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1340 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1341 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v0, v3
1342 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1344 ; GFX7-LABEL: local_atomic_fmin_ret_f16__offset:
1346 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1347 ; GFX7-NEXT: v_add_i32_e32 v1, vcc, 0xfffe, v0
1348 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v1
1349 ; GFX7-NEXT: s_mov_b32 m0, -1
1350 ; GFX7-NEXT: ds_read_b32 v3, v0
1351 ; GFX7-NEXT: v_and_b32_e32 v1, 3, v1
1352 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1353 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v1
1354 ; GFX7-NEXT: v_not_b32_e32 v2, v2
1355 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
1356 ; GFX7-NEXT: .LBB9_1: ; %atomicrmw.start
1357 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1358 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1359 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
1360 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, v1, v4
1361 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
1362 ; GFX7-NEXT: v_and_b32_e32 v5, v4, v2
1363 ; GFX7-NEXT: v_min_f32_e32 v3, 4.0, v3
1364 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
1365 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, v1, v3
1366 ; GFX7-NEXT: v_or_b32_e32 v3, v5, v3
1367 ; GFX7-NEXT: ds_cmpst_rtn_b32 v3, v0, v4, v3
1368 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1369 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1370 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1371 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
1372 ; GFX7-NEXT: s_cbranch_execnz .LBB9_1
1373 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1374 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
1375 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v1, v3
1376 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
1377 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1379 ; GFX6-LABEL: local_atomic_fmin_ret_f16__offset:
1381 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1382 ; GFX6-NEXT: v_add_i32_e32 v1, vcc, 0xfffe, v0
1383 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v1
1384 ; GFX6-NEXT: s_mov_b32 m0, -1
1385 ; GFX6-NEXT: ds_read_b32 v3, v0
1386 ; GFX6-NEXT: v_and_b32_e32 v1, 3, v1
1387 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1388 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v1
1389 ; GFX6-NEXT: v_not_b32_e32 v2, v2
1390 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
1391 ; GFX6-NEXT: .LBB9_1: ; %atomicrmw.start
1392 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
1393 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1394 ; GFX6-NEXT: v_mov_b32_e32 v4, v3
1395 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, v1, v4
1396 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
1397 ; GFX6-NEXT: v_and_b32_e32 v5, v4, v2
1398 ; GFX6-NEXT: v_min_f32_e32 v3, 4.0, v3
1399 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
1400 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, v1, v3
1401 ; GFX6-NEXT: v_or_b32_e32 v3, v5, v3
1402 ; GFX6-NEXT: ds_cmpst_rtn_b32 v3, v0, v4, v3
1403 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1404 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1405 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1406 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
1407 ; GFX6-NEXT: s_cbranch_execnz .LBB9_1
1408 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
1409 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
1410 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v1, v3
1411 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v0
1412 ; GFX6-NEXT: s_setpc_b64 s[30:31]
1413 %gep = getelementptr half, ptr addrspace(3) %ptr, i32 32767
1414 %result = atomicrmw fmin ptr addrspace(3) %gep, half 4.0 seq_cst
1418 define void @local_atomic_fmin_noret_f16(ptr addrspace(3) %ptr) nounwind {
1419 ; GFX12-LABEL: local_atomic_fmin_noret_f16:
1421 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1422 ; GFX12-NEXT: s_wait_expcnt 0x0
1423 ; GFX12-NEXT: s_wait_samplecnt 0x0
1424 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1425 ; GFX12-NEXT: s_wait_kmcnt 0x0
1426 ; GFX12-NEXT: v_and_b32_e32 v1, -4, v0
1427 ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 3, v0
1428 ; GFX12-NEXT: s_mov_b32 s0, 0
1429 ; GFX12-NEXT: ds_load_b32 v2, v1
1430 ; GFX12-NEXT: v_lshlrev_b32_e64 v3, v0, 0xffff
1431 ; GFX12-NEXT: v_and_b32_e32 v0, 24, v0
1432 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2)
1433 ; GFX12-NEXT: v_not_b32_e32 v3, v3
1434 ; GFX12-NEXT: .LBB10_1: ; %atomicrmw.start
1435 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
1436 ; GFX12-NEXT: s_wait_dscnt 0x0
1437 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
1438 ; GFX12-NEXT: v_lshrrev_b32_e32 v4, v0, v2
1439 ; GFX12-NEXT: v_max_num_f16_e32 v4, v4, v4
1440 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1441 ; GFX12-NEXT: v_min_num_f16_e32 v4, 4.0, v4
1442 ; GFX12-NEXT: v_and_b32_e32 v4, 0xffff, v4
1443 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1444 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, v0, v4
1445 ; GFX12-NEXT: v_and_or_b32 v4, v2, v3, v4
1446 ; GFX12-NEXT: global_wb scope:SCOPE_SE
1447 ; GFX12-NEXT: s_wait_storecnt 0x0
1448 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v4, v1, v4, v2
1449 ; GFX12-NEXT: s_wait_dscnt 0x0
1450 ; GFX12-NEXT: global_inv scope:SCOPE_SE
1451 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v2
1452 ; GFX12-NEXT: v_mov_b32_e32 v2, v4
1453 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
1454 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1455 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1456 ; GFX12-NEXT: s_cbranch_execnz .LBB10_1
1457 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
1458 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
1459 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1461 ; GFX940-LABEL: local_atomic_fmin_noret_f16:
1463 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1464 ; GFX940-NEXT: v_and_b32_e32 v1, -4, v0
1465 ; GFX940-NEXT: ds_read_b32 v3, v1
1466 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 3, v0
1467 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
1468 ; GFX940-NEXT: v_and_b32_e32 v0, 24, v2
1469 ; GFX940-NEXT: v_lshlrev_b32_e64 v2, v2, s0
1470 ; GFX940-NEXT: v_not_b32_e32 v2, v2
1471 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
1472 ; GFX940-NEXT: .LBB10_1: ; %atomicrmw.start
1473 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
1474 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
1475 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v0, v3
1476 ; GFX940-NEXT: v_max_f16_e32 v4, v4, v4
1477 ; GFX940-NEXT: v_min_f16_e32 v4, 4.0, v4
1478 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v0, v4
1479 ; GFX940-NEXT: v_and_or_b32 v4, v3, v2, v4
1480 ; GFX940-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
1481 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
1482 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1483 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
1484 ; GFX940-NEXT: v_mov_b32_e32 v3, v4
1485 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
1486 ; GFX940-NEXT: s_cbranch_execnz .LBB10_1
1487 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
1488 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
1489 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1491 ; GFX11-LABEL: local_atomic_fmin_noret_f16:
1493 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1494 ; GFX11-NEXT: v_and_b32_e32 v1, -4, v0
1495 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
1496 ; GFX11-NEXT: s_mov_b32 s0, 0
1497 ; GFX11-NEXT: ds_load_b32 v2, v1
1498 ; GFX11-NEXT: v_lshlrev_b32_e64 v3, v0, 0xffff
1499 ; GFX11-NEXT: v_and_b32_e32 v0, 24, v0
1500 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2)
1501 ; GFX11-NEXT: v_not_b32_e32 v3, v3
1502 ; GFX11-NEXT: .LBB10_1: ; %atomicrmw.start
1503 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
1504 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1505 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
1506 ; GFX11-NEXT: v_lshrrev_b32_e32 v4, v0, v2
1507 ; GFX11-NEXT: v_max_f16_e32 v4, v4, v4
1508 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1509 ; GFX11-NEXT: v_min_f16_e32 v4, 4.0, v4
1510 ; GFX11-NEXT: v_and_b32_e32 v4, 0xffff, v4
1511 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1512 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, v0, v4
1513 ; GFX11-NEXT: v_and_or_b32 v4, v2, v3, v4
1514 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1515 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v4, v1, v4, v2
1516 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1517 ; GFX11-NEXT: buffer_gl0_inv
1518 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v2
1519 ; GFX11-NEXT: v_mov_b32_e32 v2, v4
1520 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
1521 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1522 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1523 ; GFX11-NEXT: s_cbranch_execnz .LBB10_1
1524 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
1525 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
1526 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1528 ; GFX10-LABEL: local_atomic_fmin_noret_f16:
1530 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1531 ; GFX10-NEXT: v_and_b32_e32 v1, -4, v0
1532 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 3, v0
1533 ; GFX10-NEXT: s_mov_b32 s4, 0
1534 ; GFX10-NEXT: ds_read_b32 v2, v1
1535 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v0, 0xffff
1536 ; GFX10-NEXT: v_and_b32_e32 v0, 24, v0
1537 ; GFX10-NEXT: v_not_b32_e32 v3, v3
1538 ; GFX10-NEXT: .LBB10_1: ; %atomicrmw.start
1539 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1540 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1541 ; GFX10-NEXT: v_lshrrev_b32_e32 v4, v0, v2
1542 ; GFX10-NEXT: v_max_f16_e32 v4, v4, v4
1543 ; GFX10-NEXT: v_min_f16_e32 v4, 4.0, v4
1544 ; GFX10-NEXT: v_lshlrev_b32_sdwa v4, v0, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
1545 ; GFX10-NEXT: v_and_or_b32 v4, v2, v3, v4
1546 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1547 ; GFX10-NEXT: ds_cmpst_rtn_b32 v4, v1, v2, v4
1548 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1549 ; GFX10-NEXT: buffer_gl0_inv
1550 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v2
1551 ; GFX10-NEXT: v_mov_b32_e32 v2, v4
1552 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1553 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1554 ; GFX10-NEXT: s_cbranch_execnz .LBB10_1
1555 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1556 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1557 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1559 ; GFX90A-LABEL: local_atomic_fmin_noret_f16:
1561 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1562 ; GFX90A-NEXT: v_and_b32_e32 v1, -4, v0
1563 ; GFX90A-NEXT: ds_read_b32 v3, v1
1564 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 3, v0
1565 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
1566 ; GFX90A-NEXT: v_and_b32_e32 v0, 24, v2
1567 ; GFX90A-NEXT: v_lshlrev_b32_e64 v2, v2, s4
1568 ; GFX90A-NEXT: v_not_b32_e32 v2, v2
1569 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1570 ; GFX90A-NEXT: .LBB10_1: ; %atomicrmw.start
1571 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1572 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
1573 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v0, v3
1574 ; GFX90A-NEXT: v_max_f16_e32 v4, v4, v4
1575 ; GFX90A-NEXT: v_min_f16_e32 v4, 4.0, v4
1576 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v0, v4
1577 ; GFX90A-NEXT: v_and_or_b32 v4, v3, v2, v4
1578 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
1579 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
1580 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1581 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1582 ; GFX90A-NEXT: v_mov_b32_e32 v3, v4
1583 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1584 ; GFX90A-NEXT: s_cbranch_execnz .LBB10_1
1585 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1586 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1587 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1589 ; GFX908-LABEL: local_atomic_fmin_noret_f16:
1591 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1592 ; GFX908-NEXT: v_and_b32_e32 v1, -4, v0
1593 ; GFX908-NEXT: ds_read_b32 v3, v1
1594 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 3, v0
1595 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
1596 ; GFX908-NEXT: v_and_b32_e32 v0, 24, v2
1597 ; GFX908-NEXT: v_lshlrev_b32_e64 v2, v2, s4
1598 ; GFX908-NEXT: v_not_b32_e32 v2, v2
1599 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1600 ; GFX908-NEXT: .LBB10_1: ; %atomicrmw.start
1601 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1602 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
1603 ; GFX908-NEXT: v_lshrrev_b32_e32 v4, v0, v3
1604 ; GFX908-NEXT: v_max_f16_e32 v4, v4, v4
1605 ; GFX908-NEXT: v_min_f16_e32 v4, 4.0, v4
1606 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, v0, v4
1607 ; GFX908-NEXT: v_and_or_b32 v4, v3, v2, v4
1608 ; GFX908-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
1609 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
1610 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1611 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1612 ; GFX908-NEXT: v_mov_b32_e32 v3, v4
1613 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1614 ; GFX908-NEXT: s_cbranch_execnz .LBB10_1
1615 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1616 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1617 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1619 ; GFX8-LABEL: local_atomic_fmin_noret_f16:
1621 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1622 ; GFX8-NEXT: v_and_b32_e32 v1, -4, v0
1623 ; GFX8-NEXT: s_mov_b32 m0, -1
1624 ; GFX8-NEXT: ds_read_b32 v3, v1
1625 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 3, v0
1626 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
1627 ; GFX8-NEXT: v_and_b32_e32 v0, 24, v2
1628 ; GFX8-NEXT: v_lshlrev_b32_e64 v2, v2, s4
1629 ; GFX8-NEXT: v_not_b32_e32 v2, v2
1630 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1631 ; GFX8-NEXT: .LBB10_1: ; %atomicrmw.start
1632 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1633 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1634 ; GFX8-NEXT: v_lshrrev_b32_e32 v4, v0, v3
1635 ; GFX8-NEXT: v_max_f16_e32 v4, v4, v4
1636 ; GFX8-NEXT: v_min_f16_e32 v4, 4.0, v4
1637 ; GFX8-NEXT: v_and_b32_e32 v5, v3, v2
1638 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, v0, v4
1639 ; GFX8-NEXT: v_or_b32_e32 v4, v5, v4
1640 ; GFX8-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
1641 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1642 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1643 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1644 ; GFX8-NEXT: v_mov_b32_e32 v3, v4
1645 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1646 ; GFX8-NEXT: s_cbranch_execnz .LBB10_1
1647 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1648 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1649 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1651 ; GFX7-LABEL: local_atomic_fmin_noret_f16:
1653 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1654 ; GFX7-NEXT: v_and_b32_e32 v1, -4, v0
1655 ; GFX7-NEXT: s_mov_b32 m0, -1
1656 ; GFX7-NEXT: ds_read_b32 v3, v1
1657 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v0
1658 ; GFX7-NEXT: v_and_b32_e32 v0, 24, v2
1659 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v2
1660 ; GFX7-NEXT: v_not_b32_e32 v2, v2
1661 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
1662 ; GFX7-NEXT: .LBB10_1: ; %atomicrmw.start
1663 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1664 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1665 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, v0, v3
1666 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v4
1667 ; GFX7-NEXT: v_and_b32_e32 v5, v3, v2
1668 ; GFX7-NEXT: v_min_f32_e32 v4, 4.0, v4
1669 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
1670 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, v0, v4
1671 ; GFX7-NEXT: v_or_b32_e32 v4, v5, v4
1672 ; GFX7-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
1673 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1674 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1675 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1676 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
1677 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
1678 ; GFX7-NEXT: s_cbranch_execnz .LBB10_1
1679 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1680 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
1681 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1683 ; GFX6-LABEL: local_atomic_fmin_noret_f16:
1685 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1686 ; GFX6-NEXT: v_and_b32_e32 v1, -4, v0
1687 ; GFX6-NEXT: s_mov_b32 m0, -1
1688 ; GFX6-NEXT: ds_read_b32 v3, v1
1689 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 3, v0
1690 ; GFX6-NEXT: v_and_b32_e32 v0, 24, v2
1691 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v2
1692 ; GFX6-NEXT: v_not_b32_e32 v2, v2
1693 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
1694 ; GFX6-NEXT: .LBB10_1: ; %atomicrmw.start
1695 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
1696 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1697 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, v0, v3
1698 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v4
1699 ; GFX6-NEXT: v_and_b32_e32 v5, v3, v2
1700 ; GFX6-NEXT: v_min_f32_e32 v4, 4.0, v4
1701 ; GFX6-NEXT: v_cvt_f16_f32_e32 v4, v4
1702 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, v0, v4
1703 ; GFX6-NEXT: v_or_b32_e32 v4, v5, v4
1704 ; GFX6-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
1705 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1706 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1707 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1708 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
1709 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
1710 ; GFX6-NEXT: s_cbranch_execnz .LBB10_1
1711 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
1712 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
1713 ; GFX6-NEXT: s_setpc_b64 s[30:31]
1714 %result = atomicrmw fmin ptr addrspace(3) %ptr, half 4.0 seq_cst
1718 define void @local_atomic_fmin_noret_f16__offset(ptr addrspace(3) %ptr) nounwind {
1719 ; GFX12-LABEL: local_atomic_fmin_noret_f16__offset:
1721 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1722 ; GFX12-NEXT: s_wait_expcnt 0x0
1723 ; GFX12-NEXT: s_wait_samplecnt 0x0
1724 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1725 ; GFX12-NEXT: s_wait_kmcnt 0x0
1726 ; GFX12-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
1727 ; GFX12-NEXT: s_mov_b32 s0, 0
1728 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
1729 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v1
1730 ; GFX12-NEXT: v_and_b32_e32 v1, 3, v1
1731 ; GFX12-NEXT: ds_load_b32 v3, v0
1732 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1733 ; GFX12-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
1734 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
1735 ; GFX12-NEXT: v_not_b32_e32 v2, v2
1736 ; GFX12-NEXT: .LBB11_1: ; %atomicrmw.start
1737 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
1738 ; GFX12-NEXT: s_wait_dscnt 0x0
1739 ; GFX12-NEXT: v_lshrrev_b32_e32 v4, v1, v3
1740 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1741 ; GFX12-NEXT: v_max_num_f16_e32 v4, v4, v4
1742 ; GFX12-NEXT: v_min_num_f16_e32 v4, 4.0, v4
1743 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1744 ; GFX12-NEXT: v_and_b32_e32 v4, 0xffff, v4
1745 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, v1, v4
1746 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
1747 ; GFX12-NEXT: v_and_or_b32 v4, v3, v2, v4
1748 ; GFX12-NEXT: global_wb scope:SCOPE_SE
1749 ; GFX12-NEXT: s_wait_storecnt 0x0
1750 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v4, v0, v4, v3
1751 ; GFX12-NEXT: s_wait_dscnt 0x0
1752 ; GFX12-NEXT: global_inv scope:SCOPE_SE
1753 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
1754 ; GFX12-NEXT: v_mov_b32_e32 v3, v4
1755 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
1756 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1757 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1758 ; GFX12-NEXT: s_cbranch_execnz .LBB11_1
1759 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
1760 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
1761 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1763 ; GFX940-LABEL: local_atomic_fmin_noret_f16__offset:
1765 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1766 ; GFX940-NEXT: v_add_u32_e32 v1, 0xfffe, v0
1767 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v1
1768 ; GFX940-NEXT: ds_read_b32 v3, v0
1769 ; GFX940-NEXT: v_and_b32_e32 v1, 3, v1
1770 ; GFX940-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1771 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
1772 ; GFX940-NEXT: v_lshlrev_b32_e64 v2, v1, s0
1773 ; GFX940-NEXT: v_not_b32_e32 v2, v2
1774 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
1775 ; GFX940-NEXT: .LBB11_1: ; %atomicrmw.start
1776 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
1777 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
1778 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v1, v3
1779 ; GFX940-NEXT: v_max_f16_e32 v4, v4, v4
1780 ; GFX940-NEXT: v_min_f16_e32 v4, 4.0, v4
1781 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v1, v4
1782 ; GFX940-NEXT: v_and_or_b32 v4, v3, v2, v4
1783 ; GFX940-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
1784 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
1785 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1786 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
1787 ; GFX940-NEXT: v_mov_b32_e32 v3, v4
1788 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
1789 ; GFX940-NEXT: s_cbranch_execnz .LBB11_1
1790 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
1791 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
1792 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1794 ; GFX11-LABEL: local_atomic_fmin_noret_f16__offset:
1796 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1797 ; GFX11-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
1798 ; GFX11-NEXT: s_mov_b32 s0, 0
1799 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
1800 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v1
1801 ; GFX11-NEXT: v_and_b32_e32 v1, 3, v1
1802 ; GFX11-NEXT: ds_load_b32 v3, v0
1803 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1804 ; GFX11-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
1805 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
1806 ; GFX11-NEXT: v_not_b32_e32 v2, v2
1807 ; GFX11-NEXT: .LBB11_1: ; %atomicrmw.start
1808 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
1809 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1810 ; GFX11-NEXT: v_lshrrev_b32_e32 v4, v1, v3
1811 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1812 ; GFX11-NEXT: v_max_f16_e32 v4, v4, v4
1813 ; GFX11-NEXT: v_min_f16_e32 v4, 4.0, v4
1814 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1815 ; GFX11-NEXT: v_and_b32_e32 v4, 0xffff, v4
1816 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, v1, v4
1817 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
1818 ; GFX11-NEXT: v_and_or_b32 v4, v3, v2, v4
1819 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1820 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v4, v0, v4, v3
1821 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1822 ; GFX11-NEXT: buffer_gl0_inv
1823 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
1824 ; GFX11-NEXT: v_mov_b32_e32 v3, v4
1825 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
1826 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1827 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1828 ; GFX11-NEXT: s_cbranch_execnz .LBB11_1
1829 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
1830 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
1831 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1833 ; GFX10-LABEL: local_atomic_fmin_noret_f16__offset:
1835 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1836 ; GFX10-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
1837 ; GFX10-NEXT: s_mov_b32 s4, 0
1838 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v1
1839 ; GFX10-NEXT: v_and_b32_e32 v1, 3, v1
1840 ; GFX10-NEXT: ds_read_b32 v3, v0
1841 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1842 ; GFX10-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
1843 ; GFX10-NEXT: v_not_b32_e32 v2, v2
1844 ; GFX10-NEXT: .LBB11_1: ; %atomicrmw.start
1845 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1846 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1847 ; GFX10-NEXT: v_lshrrev_b32_e32 v4, v1, v3
1848 ; GFX10-NEXT: v_max_f16_e32 v4, v4, v4
1849 ; GFX10-NEXT: v_min_f16_e32 v4, 4.0, v4
1850 ; GFX10-NEXT: v_lshlrev_b32_sdwa v4, v1, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
1851 ; GFX10-NEXT: v_and_or_b32 v4, v3, v2, v4
1852 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1853 ; GFX10-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
1854 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1855 ; GFX10-NEXT: buffer_gl0_inv
1856 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
1857 ; GFX10-NEXT: v_mov_b32_e32 v3, v4
1858 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1859 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1860 ; GFX10-NEXT: s_cbranch_execnz .LBB11_1
1861 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1862 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1863 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1865 ; GFX90A-LABEL: local_atomic_fmin_noret_f16__offset:
1867 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1868 ; GFX90A-NEXT: v_add_u32_e32 v1, 0xfffe, v0
1869 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v1
1870 ; GFX90A-NEXT: ds_read_b32 v3, v0
1871 ; GFX90A-NEXT: v_and_b32_e32 v1, 3, v1
1872 ; GFX90A-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1873 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
1874 ; GFX90A-NEXT: v_lshlrev_b32_e64 v2, v1, s4
1875 ; GFX90A-NEXT: v_not_b32_e32 v2, v2
1876 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1877 ; GFX90A-NEXT: .LBB11_1: ; %atomicrmw.start
1878 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1879 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
1880 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v1, v3
1881 ; GFX90A-NEXT: v_max_f16_e32 v4, v4, v4
1882 ; GFX90A-NEXT: v_min_f16_e32 v4, 4.0, v4
1883 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v1, v4
1884 ; GFX90A-NEXT: v_and_or_b32 v4, v3, v2, v4
1885 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
1886 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
1887 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1888 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1889 ; GFX90A-NEXT: v_mov_b32_e32 v3, v4
1890 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1891 ; GFX90A-NEXT: s_cbranch_execnz .LBB11_1
1892 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1893 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1894 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1896 ; GFX908-LABEL: local_atomic_fmin_noret_f16__offset:
1898 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1899 ; GFX908-NEXT: v_add_u32_e32 v1, 0xfffe, v0
1900 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v1
1901 ; GFX908-NEXT: ds_read_b32 v3, v0
1902 ; GFX908-NEXT: v_and_b32_e32 v1, 3, v1
1903 ; GFX908-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1904 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
1905 ; GFX908-NEXT: v_lshlrev_b32_e64 v2, v1, s4
1906 ; GFX908-NEXT: v_not_b32_e32 v2, v2
1907 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1908 ; GFX908-NEXT: .LBB11_1: ; %atomicrmw.start
1909 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1910 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
1911 ; GFX908-NEXT: v_lshrrev_b32_e32 v4, v1, v3
1912 ; GFX908-NEXT: v_max_f16_e32 v4, v4, v4
1913 ; GFX908-NEXT: v_min_f16_e32 v4, 4.0, v4
1914 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, v1, v4
1915 ; GFX908-NEXT: v_and_or_b32 v4, v3, v2, v4
1916 ; GFX908-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
1917 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
1918 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1919 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1920 ; GFX908-NEXT: v_mov_b32_e32 v3, v4
1921 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1922 ; GFX908-NEXT: s_cbranch_execnz .LBB11_1
1923 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1924 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1925 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1927 ; GFX8-LABEL: local_atomic_fmin_noret_f16__offset:
1929 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1930 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, 0xfffe, v0
1931 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v1
1932 ; GFX8-NEXT: s_mov_b32 m0, -1
1933 ; GFX8-NEXT: ds_read_b32 v3, v0
1934 ; GFX8-NEXT: v_and_b32_e32 v1, 3, v1
1935 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1936 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
1937 ; GFX8-NEXT: v_lshlrev_b32_e64 v2, v1, s4
1938 ; GFX8-NEXT: v_not_b32_e32 v2, v2
1939 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1940 ; GFX8-NEXT: .LBB11_1: ; %atomicrmw.start
1941 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1942 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1943 ; GFX8-NEXT: v_lshrrev_b32_e32 v4, v1, v3
1944 ; GFX8-NEXT: v_max_f16_e32 v4, v4, v4
1945 ; GFX8-NEXT: v_min_f16_e32 v4, 4.0, v4
1946 ; GFX8-NEXT: v_and_b32_e32 v5, v3, v2
1947 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, v1, v4
1948 ; GFX8-NEXT: v_or_b32_e32 v4, v5, v4
1949 ; GFX8-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
1950 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1951 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1952 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1953 ; GFX8-NEXT: v_mov_b32_e32 v3, v4
1954 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1955 ; GFX8-NEXT: s_cbranch_execnz .LBB11_1
1956 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1957 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1958 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1960 ; GFX7-LABEL: local_atomic_fmin_noret_f16__offset:
1962 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1963 ; GFX7-NEXT: v_add_i32_e32 v1, vcc, 0xfffe, v0
1964 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v1
1965 ; GFX7-NEXT: s_mov_b32 m0, -1
1966 ; GFX7-NEXT: ds_read_b32 v3, v0
1967 ; GFX7-NEXT: v_and_b32_e32 v1, 3, v1
1968 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 3, v1
1969 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v1
1970 ; GFX7-NEXT: v_not_b32_e32 v2, v2
1971 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
1972 ; GFX7-NEXT: .LBB11_1: ; %atomicrmw.start
1973 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1974 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1975 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, v1, v3
1976 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v4
1977 ; GFX7-NEXT: v_and_b32_e32 v5, v3, v2
1978 ; GFX7-NEXT: v_min_f32_e32 v4, 4.0, v4
1979 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
1980 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, v1, v4
1981 ; GFX7-NEXT: v_or_b32_e32 v4, v5, v4
1982 ; GFX7-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
1983 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1984 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
1985 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1986 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
1987 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
1988 ; GFX7-NEXT: s_cbranch_execnz .LBB11_1
1989 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1990 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
1991 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1993 ; GFX6-LABEL: local_atomic_fmin_noret_f16__offset:
1995 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1996 ; GFX6-NEXT: v_add_i32_e32 v1, vcc, 0xfffe, v0
1997 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v1
1998 ; GFX6-NEXT: s_mov_b32 m0, -1
1999 ; GFX6-NEXT: ds_read_b32 v3, v0
2000 ; GFX6-NEXT: v_and_b32_e32 v1, 3, v1
2001 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 3, v1
2002 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v1
2003 ; GFX6-NEXT: v_not_b32_e32 v2, v2
2004 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
2005 ; GFX6-NEXT: .LBB11_1: ; %atomicrmw.start
2006 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
2007 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2008 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, v1, v3
2009 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v4
2010 ; GFX6-NEXT: v_and_b32_e32 v5, v3, v2
2011 ; GFX6-NEXT: v_min_f32_e32 v4, 4.0, v4
2012 ; GFX6-NEXT: v_cvt_f16_f32_e32 v4, v4
2013 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, v1, v4
2014 ; GFX6-NEXT: v_or_b32_e32 v4, v5, v4
2015 ; GFX6-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
2016 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2017 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
2018 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2019 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
2020 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
2021 ; GFX6-NEXT: s_cbranch_execnz .LBB11_1
2022 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
2023 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
2024 ; GFX6-NEXT: s_setpc_b64 s[30:31]
2025 %gep = getelementptr half, ptr addrspace(3) %ptr, i32 32767
2026 %unused = atomicrmw fmin ptr addrspace(3) %gep, half 4.0 seq_cst
2030 define half @local_atomic_fmin_ret_f16__offset__align4(ptr addrspace(3) %ptr) nounwind {
2031 ; GFX12-LABEL: local_atomic_fmin_ret_f16__offset__align4:
2033 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2034 ; GFX12-NEXT: s_wait_expcnt 0x0
2035 ; GFX12-NEXT: s_wait_samplecnt 0x0
2036 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2037 ; GFX12-NEXT: s_wait_kmcnt 0x0
2038 ; GFX12-NEXT: ds_load_b32 v1, v0 offset:65534
2039 ; GFX12-NEXT: s_mov_b32 s0, 0
2040 ; GFX12-NEXT: .LBB12_1: ; %atomicrmw.start
2041 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
2042 ; GFX12-NEXT: s_wait_dscnt 0x0
2043 ; GFX12-NEXT: v_mov_b32_e32 v2, v1
2044 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2045 ; GFX12-NEXT: v_max_num_f16_e32 v1, v2, v2
2046 ; GFX12-NEXT: v_min_num_f16_e32 v1, 4.0, v1
2047 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2048 ; GFX12-NEXT: v_and_b32_e32 v1, 0xffff, v1
2049 ; GFX12-NEXT: v_and_or_b32 v1, 0xffff0000, v2, v1
2050 ; GFX12-NEXT: global_wb scope:SCOPE_SE
2051 ; GFX12-NEXT: s_wait_storecnt 0x0
2052 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:65534
2053 ; GFX12-NEXT: s_wait_dscnt 0x0
2054 ; GFX12-NEXT: global_inv scope:SCOPE_SE
2055 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v1, v2
2056 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
2057 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2058 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2059 ; GFX12-NEXT: s_cbranch_execnz .LBB12_1
2060 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
2061 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
2062 ; GFX12-NEXT: v_mov_b32_e32 v0, v1
2063 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2065 ; GFX940-LABEL: local_atomic_fmin_ret_f16__offset__align4:
2067 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2068 ; GFX940-NEXT: ds_read_b32 v1, v0 offset:65534
2069 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
2070 ; GFX940-NEXT: s_mov_b32 s2, 0xffff0000
2071 ; GFX940-NEXT: .LBB12_1: ; %atomicrmw.start
2072 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
2073 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
2074 ; GFX940-NEXT: v_mov_b32_e32 v2, v1
2075 ; GFX940-NEXT: v_max_f16_e32 v1, v2, v2
2076 ; GFX940-NEXT: v_min_f16_e32 v1, 4.0, v1
2077 ; GFX940-NEXT: v_and_or_b32 v1, v2, s2, v1
2078 ; GFX940-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
2079 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
2080 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
2081 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
2082 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
2083 ; GFX940-NEXT: s_cbranch_execnz .LBB12_1
2084 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
2085 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
2086 ; GFX940-NEXT: v_mov_b32_e32 v0, v1
2087 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2089 ; GFX11-LABEL: local_atomic_fmin_ret_f16__offset__align4:
2091 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2092 ; GFX11-NEXT: ds_load_b32 v1, v0 offset:65534
2093 ; GFX11-NEXT: s_mov_b32 s0, 0
2094 ; GFX11-NEXT: .LBB12_1: ; %atomicrmw.start
2095 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
2096 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2097 ; GFX11-NEXT: v_mov_b32_e32 v2, v1
2098 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2099 ; GFX11-NEXT: v_max_f16_e32 v1, v2, v2
2100 ; GFX11-NEXT: v_min_f16_e32 v1, 4.0, v1
2101 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2102 ; GFX11-NEXT: v_and_b32_e32 v1, 0xffff, v1
2103 ; GFX11-NEXT: v_and_or_b32 v1, 0xffff0000, v2, v1
2104 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2105 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:65534
2106 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2107 ; GFX11-NEXT: buffer_gl0_inv
2108 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v1, v2
2109 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2110 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2111 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2112 ; GFX11-NEXT: s_cbranch_execnz .LBB12_1
2113 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
2114 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
2115 ; GFX11-NEXT: v_mov_b32_e32 v0, v1
2116 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2118 ; GFX10-LABEL: local_atomic_fmin_ret_f16__offset__align4:
2120 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2121 ; GFX10-NEXT: ds_read_b32 v1, v0 offset:65534
2122 ; GFX10-NEXT: s_mov_b32 s4, 0
2123 ; GFX10-NEXT: .LBB12_1: ; %atomicrmw.start
2124 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2125 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2126 ; GFX10-NEXT: v_mov_b32_e32 v2, v1
2127 ; GFX10-NEXT: v_max_f16_e32 v1, v2, v2
2128 ; GFX10-NEXT: v_min_f16_e32 v1, 4.0, v1
2129 ; GFX10-NEXT: v_and_b32_e32 v1, 0xffff, v1
2130 ; GFX10-NEXT: v_and_or_b32 v1, 0xffff0000, v2, v1
2131 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2132 ; GFX10-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
2133 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2134 ; GFX10-NEXT: buffer_gl0_inv
2135 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v1, v2
2136 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2137 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2138 ; GFX10-NEXT: s_cbranch_execnz .LBB12_1
2139 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2140 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2141 ; GFX10-NEXT: v_mov_b32_e32 v0, v1
2142 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2144 ; GFX90A-LABEL: local_atomic_fmin_ret_f16__offset__align4:
2146 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2147 ; GFX90A-NEXT: ds_read_b32 v1, v0 offset:65534
2148 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
2149 ; GFX90A-NEXT: s_mov_b32 s6, 0xffff0000
2150 ; GFX90A-NEXT: .LBB12_1: ; %atomicrmw.start
2151 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
2152 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2153 ; GFX90A-NEXT: v_mov_b32_e32 v2, v1
2154 ; GFX90A-NEXT: v_max_f16_e32 v1, v2, v2
2155 ; GFX90A-NEXT: v_min_f16_e32 v1, 4.0, v1
2156 ; GFX90A-NEXT: v_and_or_b32 v1, v2, s6, v1
2157 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
2158 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2159 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
2160 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2161 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
2162 ; GFX90A-NEXT: s_cbranch_execnz .LBB12_1
2163 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
2164 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2165 ; GFX90A-NEXT: v_mov_b32_e32 v0, v1
2166 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2168 ; GFX908-LABEL: local_atomic_fmin_ret_f16__offset__align4:
2170 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2171 ; GFX908-NEXT: ds_read_b32 v1, v0 offset:65534
2172 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2173 ; GFX908-NEXT: s_mov_b32 s6, 0xffff0000
2174 ; GFX908-NEXT: .LBB12_1: ; %atomicrmw.start
2175 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2176 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
2177 ; GFX908-NEXT: v_mov_b32_e32 v2, v1
2178 ; GFX908-NEXT: v_max_f16_e32 v1, v2, v2
2179 ; GFX908-NEXT: v_min_f16_e32 v1, 4.0, v1
2180 ; GFX908-NEXT: v_and_or_b32 v1, v2, s6, v1
2181 ; GFX908-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
2182 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
2183 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
2184 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2185 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2186 ; GFX908-NEXT: s_cbranch_execnz .LBB12_1
2187 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2188 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2189 ; GFX908-NEXT: v_mov_b32_e32 v0, v1
2190 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2192 ; GFX8-LABEL: local_atomic_fmin_ret_f16__offset__align4:
2194 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2195 ; GFX8-NEXT: s_mov_b32 m0, -1
2196 ; GFX8-NEXT: ds_read_b32 v1, v0 offset:65534
2197 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2198 ; GFX8-NEXT: .LBB12_1: ; %atomicrmw.start
2199 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2200 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2201 ; GFX8-NEXT: v_mov_b32_e32 v2, v1
2202 ; GFX8-NEXT: v_max_f16_e32 v1, v2, v2
2203 ; GFX8-NEXT: v_and_b32_e32 v3, 0xffff0000, v2
2204 ; GFX8-NEXT: v_min_f16_e32 v1, 4.0, v1
2205 ; GFX8-NEXT: v_or_b32_e32 v1, v3, v1
2206 ; GFX8-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
2207 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2208 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
2209 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2210 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2211 ; GFX8-NEXT: s_cbranch_execnz .LBB12_1
2212 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2213 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2214 ; GFX8-NEXT: v_mov_b32_e32 v0, v1
2215 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2217 ; GFX7-LABEL: local_atomic_fmin_ret_f16__offset__align4:
2219 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2220 ; GFX7-NEXT: s_mov_b32 m0, -1
2221 ; GFX7-NEXT: ds_read_b32 v1, v0 offset:65534
2222 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
2223 ; GFX7-NEXT: .LBB12_1: ; %atomicrmw.start
2224 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2225 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2226 ; GFX7-NEXT: v_mov_b32_e32 v2, v1
2227 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v2
2228 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v2
2229 ; GFX7-NEXT: v_min_f32_e32 v1, 4.0, v1
2230 ; GFX7-NEXT: v_cvt_f16_f32_e32 v1, v1
2231 ; GFX7-NEXT: v_or_b32_e32 v1, v3, v1
2232 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
2233 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2234 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
2235 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2236 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
2237 ; GFX7-NEXT: s_cbranch_execnz .LBB12_1
2238 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2239 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
2240 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v1
2241 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2243 ; GFX6-LABEL: local_atomic_fmin_ret_f16__offset__align4:
2245 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2246 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffe, v0
2247 ; GFX6-NEXT: s_mov_b32 m0, -1
2248 ; GFX6-NEXT: ds_read_b32 v1, v0
2249 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
2250 ; GFX6-NEXT: .LBB12_1: ; %atomicrmw.start
2251 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
2252 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2253 ; GFX6-NEXT: v_mov_b32_e32 v2, v1
2254 ; GFX6-NEXT: v_cvt_f32_f16_e32 v1, v2
2255 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v2
2256 ; GFX6-NEXT: v_min_f32_e32 v1, 4.0, v1
2257 ; GFX6-NEXT: v_cvt_f16_f32_e32 v1, v1
2258 ; GFX6-NEXT: v_or_b32_e32 v1, v3, v1
2259 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1
2260 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2261 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
2262 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2263 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
2264 ; GFX6-NEXT: s_cbranch_execnz .LBB12_1
2265 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
2266 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
2267 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v1
2268 ; GFX6-NEXT: s_setpc_b64 s[30:31]
2269 %gep = getelementptr half, ptr addrspace(3) %ptr, i32 32767
2270 %result = atomicrmw fmin ptr addrspace(3) %gep, half 4.0 seq_cst, align 4
2274 define void @local_atomic_fmin_noret_f16__offset__align4(ptr addrspace(3) %ptr) nounwind {
2275 ; GFX12-LABEL: local_atomic_fmin_noret_f16__offset__align4:
2277 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2278 ; GFX12-NEXT: s_wait_expcnt 0x0
2279 ; GFX12-NEXT: s_wait_samplecnt 0x0
2280 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2281 ; GFX12-NEXT: s_wait_kmcnt 0x0
2282 ; GFX12-NEXT: ds_load_b32 v1, v0 offset:65534
2283 ; GFX12-NEXT: s_mov_b32 s0, 0
2284 ; GFX12-NEXT: .LBB13_1: ; %atomicrmw.start
2285 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
2286 ; GFX12-NEXT: s_wait_dscnt 0x0
2287 ; GFX12-NEXT: v_max_num_f16_e32 v2, v1, v1
2288 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2289 ; GFX12-NEXT: v_min_num_f16_e32 v2, 4.0, v2
2290 ; GFX12-NEXT: v_and_b32_e32 v2, 0xffff, v2
2291 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
2292 ; GFX12-NEXT: v_and_or_b32 v2, 0xffff0000, v1, v2
2293 ; GFX12-NEXT: global_wb scope:SCOPE_SE
2294 ; GFX12-NEXT: s_wait_storecnt 0x0
2295 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v1 offset:65534
2296 ; GFX12-NEXT: s_wait_dscnt 0x0
2297 ; GFX12-NEXT: global_inv scope:SCOPE_SE
2298 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v1
2299 ; GFX12-NEXT: v_mov_b32_e32 v1, v2
2300 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
2301 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2302 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2303 ; GFX12-NEXT: s_cbranch_execnz .LBB13_1
2304 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
2305 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
2306 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2308 ; GFX940-LABEL: local_atomic_fmin_noret_f16__offset__align4:
2310 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2311 ; GFX940-NEXT: ds_read_b32 v1, v0 offset:65534
2312 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
2313 ; GFX940-NEXT: s_mov_b32 s2, 0xffff0000
2314 ; GFX940-NEXT: .LBB13_1: ; %atomicrmw.start
2315 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
2316 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
2317 ; GFX940-NEXT: v_max_f16_e32 v2, v1, v1
2318 ; GFX940-NEXT: v_min_f16_e32 v2, 4.0, v2
2319 ; GFX940-NEXT: v_and_or_b32 v2, v1, s2, v2
2320 ; GFX940-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
2321 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
2322 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
2323 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
2324 ; GFX940-NEXT: v_mov_b32_e32 v1, v2
2325 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
2326 ; GFX940-NEXT: s_cbranch_execnz .LBB13_1
2327 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
2328 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
2329 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2331 ; GFX11-LABEL: local_atomic_fmin_noret_f16__offset__align4:
2333 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2334 ; GFX11-NEXT: ds_load_b32 v1, v0 offset:65534
2335 ; GFX11-NEXT: s_mov_b32 s0, 0
2336 ; GFX11-NEXT: .LBB13_1: ; %atomicrmw.start
2337 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
2338 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2339 ; GFX11-NEXT: v_max_f16_e32 v2, v1, v1
2340 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2341 ; GFX11-NEXT: v_min_f16_e32 v2, 4.0, v2
2342 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff, v2
2343 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
2344 ; GFX11-NEXT: v_and_or_b32 v2, 0xffff0000, v1, v2
2345 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2346 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v1 offset:65534
2347 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2348 ; GFX11-NEXT: buffer_gl0_inv
2349 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v1
2350 ; GFX11-NEXT: v_mov_b32_e32 v1, v2
2351 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2352 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2353 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2354 ; GFX11-NEXT: s_cbranch_execnz .LBB13_1
2355 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
2356 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
2357 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2359 ; GFX10-LABEL: local_atomic_fmin_noret_f16__offset__align4:
2361 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2362 ; GFX10-NEXT: ds_read_b32 v1, v0 offset:65534
2363 ; GFX10-NEXT: s_mov_b32 s4, 0
2364 ; GFX10-NEXT: .LBB13_1: ; %atomicrmw.start
2365 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2366 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2367 ; GFX10-NEXT: v_max_f16_e32 v2, v1, v1
2368 ; GFX10-NEXT: v_min_f16_e32 v2, 4.0, v2
2369 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff, v2
2370 ; GFX10-NEXT: v_and_or_b32 v2, 0xffff0000, v1, v2
2371 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2372 ; GFX10-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
2373 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2374 ; GFX10-NEXT: buffer_gl0_inv
2375 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v1
2376 ; GFX10-NEXT: v_mov_b32_e32 v1, v2
2377 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2378 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2379 ; GFX10-NEXT: s_cbranch_execnz .LBB13_1
2380 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2381 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2382 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2384 ; GFX90A-LABEL: local_atomic_fmin_noret_f16__offset__align4:
2386 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2387 ; GFX90A-NEXT: ds_read_b32 v1, v0 offset:65534
2388 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
2389 ; GFX90A-NEXT: s_mov_b32 s6, 0xffff0000
2390 ; GFX90A-NEXT: .LBB13_1: ; %atomicrmw.start
2391 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
2392 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2393 ; GFX90A-NEXT: v_max_f16_e32 v2, v1, v1
2394 ; GFX90A-NEXT: v_min_f16_e32 v2, 4.0, v2
2395 ; GFX90A-NEXT: v_and_or_b32 v2, v1, s6, v2
2396 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
2397 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2398 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
2399 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2400 ; GFX90A-NEXT: v_mov_b32_e32 v1, v2
2401 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
2402 ; GFX90A-NEXT: s_cbranch_execnz .LBB13_1
2403 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
2404 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2405 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2407 ; GFX908-LABEL: local_atomic_fmin_noret_f16__offset__align4:
2409 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2410 ; GFX908-NEXT: ds_read_b32 v1, v0 offset:65534
2411 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2412 ; GFX908-NEXT: s_mov_b32 s6, 0xffff0000
2413 ; GFX908-NEXT: .LBB13_1: ; %atomicrmw.start
2414 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2415 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
2416 ; GFX908-NEXT: v_max_f16_e32 v2, v1, v1
2417 ; GFX908-NEXT: v_min_f16_e32 v2, 4.0, v2
2418 ; GFX908-NEXT: v_and_or_b32 v2, v1, s6, v2
2419 ; GFX908-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
2420 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
2421 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
2422 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2423 ; GFX908-NEXT: v_mov_b32_e32 v1, v2
2424 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2425 ; GFX908-NEXT: s_cbranch_execnz .LBB13_1
2426 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2427 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2428 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2430 ; GFX8-LABEL: local_atomic_fmin_noret_f16__offset__align4:
2432 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2433 ; GFX8-NEXT: s_mov_b32 m0, -1
2434 ; GFX8-NEXT: ds_read_b32 v1, v0 offset:65534
2435 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2436 ; GFX8-NEXT: .LBB13_1: ; %atomicrmw.start
2437 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2438 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2439 ; GFX8-NEXT: v_max_f16_e32 v2, v1, v1
2440 ; GFX8-NEXT: v_and_b32_e32 v3, 0xffff0000, v1
2441 ; GFX8-NEXT: v_min_f16_e32 v2, 4.0, v2
2442 ; GFX8-NEXT: v_or_b32_e32 v2, v3, v2
2443 ; GFX8-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
2444 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2445 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
2446 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2447 ; GFX8-NEXT: v_mov_b32_e32 v1, v2
2448 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2449 ; GFX8-NEXT: s_cbranch_execnz .LBB13_1
2450 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2451 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2452 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2454 ; GFX7-LABEL: local_atomic_fmin_noret_f16__offset__align4:
2456 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2457 ; GFX7-NEXT: s_mov_b32 m0, -1
2458 ; GFX7-NEXT: ds_read_b32 v1, v0 offset:65534
2459 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
2460 ; GFX7-NEXT: .LBB13_1: ; %atomicrmw.start
2461 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2462 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2463 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v1
2464 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v1
2465 ; GFX7-NEXT: v_min_f32_e32 v2, 4.0, v2
2466 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
2467 ; GFX7-NEXT: v_or_b32_e32 v2, v3, v2
2468 ; GFX7-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
2469 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2470 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
2471 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2472 ; GFX7-NEXT: v_mov_b32_e32 v1, v2
2473 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
2474 ; GFX7-NEXT: s_cbranch_execnz .LBB13_1
2475 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2476 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
2477 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2479 ; GFX6-LABEL: local_atomic_fmin_noret_f16__offset__align4:
2481 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2482 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffe, v0
2483 ; GFX6-NEXT: s_mov_b32 m0, -1
2484 ; GFX6-NEXT: ds_read_b32 v1, v0
2485 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
2486 ; GFX6-NEXT: .LBB13_1: ; %atomicrmw.start
2487 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
2488 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2489 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v1
2490 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v1
2491 ; GFX6-NEXT: v_min_f32_e32 v2, 4.0, v2
2492 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
2493 ; GFX6-NEXT: v_or_b32_e32 v2, v3, v2
2494 ; GFX6-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2
2495 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2496 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
2497 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2498 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
2499 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
2500 ; GFX6-NEXT: s_cbranch_execnz .LBB13_1
2501 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
2502 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
2503 ; GFX6-NEXT: s_setpc_b64 s[30:31]
2504 %gep = getelementptr half, ptr addrspace(3) %ptr, i32 32767
2505 %unused = atomicrmw fmin ptr addrspace(3) %gep, half 4.0 seq_cst, align 4
2509 ; --------------------------------------------------------------------
2511 ; --------------------------------------------------------------------
2513 define bfloat @local_atomic_fmin_ret_bf16(ptr addrspace(3) %ptr) nounwind {
2514 ; GFX12-LABEL: local_atomic_fmin_ret_bf16:
2516 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2517 ; GFX12-NEXT: s_wait_expcnt 0x0
2518 ; GFX12-NEXT: s_wait_samplecnt 0x0
2519 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2520 ; GFX12-NEXT: s_wait_kmcnt 0x0
2521 ; GFX12-NEXT: v_and_b32_e32 v1, -4, v0
2522 ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 3, v0
2523 ; GFX12-NEXT: s_mov_b32 s0, 0
2524 ; GFX12-NEXT: ds_load_b32 v3, v1
2525 ; GFX12-NEXT: v_lshlrev_b32_e64 v2, v0, 0xffff
2526 ; GFX12-NEXT: v_and_b32_e32 v0, 24, v0
2527 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2)
2528 ; GFX12-NEXT: v_not_b32_e32 v2, v2
2529 ; GFX12-NEXT: .LBB14_1: ; %atomicrmw.start
2530 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
2531 ; GFX12-NEXT: s_wait_dscnt 0x0
2532 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
2533 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2534 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v0, v4
2535 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v3
2536 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2537 ; GFX12-NEXT: v_min_num_f32_e32 v3, 4.0, v3
2538 ; GFX12-NEXT: v_bfe_u32 v5, v3, 16, 1
2539 ; GFX12-NEXT: v_or_b32_e32 v6, 0x400000, v3
2540 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
2541 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
2542 ; GFX12-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
2543 ; GFX12-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
2544 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2545 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, 16, v3
2546 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v0, v3
2547 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
2548 ; GFX12-NEXT: v_and_or_b32 v3, v4, v2, v3
2549 ; GFX12-NEXT: global_wb scope:SCOPE_SE
2550 ; GFX12-NEXT: s_wait_storecnt 0x0
2551 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v3, v1, v3, v4
2552 ; GFX12-NEXT: s_wait_dscnt 0x0
2553 ; GFX12-NEXT: global_inv scope:SCOPE_SE
2554 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2555 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
2556 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2557 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2558 ; GFX12-NEXT: s_cbranch_execnz .LBB14_1
2559 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
2560 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
2561 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2562 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2564 ; GFX940-LABEL: local_atomic_fmin_ret_bf16:
2566 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2567 ; GFX940-NEXT: v_and_b32_e32 v1, -4, v0
2568 ; GFX940-NEXT: ds_read_b32 v3, v1
2569 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 3, v0
2570 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
2571 ; GFX940-NEXT: v_and_b32_e32 v0, 24, v2
2572 ; GFX940-NEXT: v_lshlrev_b32_e64 v2, v2, s0
2573 ; GFX940-NEXT: v_not_b32_e32 v2, v2
2574 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
2575 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
2576 ; GFX940-NEXT: .LBB14_1: ; %atomicrmw.start
2577 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
2578 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
2579 ; GFX940-NEXT: v_mov_b32_e32 v4, v3
2580 ; GFX940-NEXT: v_lshrrev_b32_sdwa v3, v0, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
2581 ; GFX940-NEXT: s_nop 0
2582 ; GFX940-NEXT: v_min_f32_e32 v3, 4.0, v3
2583 ; GFX940-NEXT: v_bfe_u32 v5, v3, 16, 1
2584 ; GFX940-NEXT: v_or_b32_e32 v6, 0x400000, v3
2585 ; GFX940-NEXT: v_add3_u32 v5, v5, v3, s2
2586 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
2587 ; GFX940-NEXT: s_nop 1
2588 ; GFX940-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc
2589 ; GFX940-NEXT: v_lshlrev_b32_sdwa v3, v0, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
2590 ; GFX940-NEXT: v_and_or_b32 v3, v4, v2, v3
2591 ; GFX940-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
2592 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
2593 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2594 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
2595 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
2596 ; GFX940-NEXT: s_cbranch_execnz .LBB14_1
2597 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
2598 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
2599 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2600 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2602 ; GFX11-LABEL: local_atomic_fmin_ret_bf16:
2604 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2605 ; GFX11-NEXT: v_and_b32_e32 v1, -4, v0
2606 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
2607 ; GFX11-NEXT: s_mov_b32 s0, 0
2608 ; GFX11-NEXT: ds_load_b32 v3, v1
2609 ; GFX11-NEXT: v_lshlrev_b32_e64 v2, v0, 0xffff
2610 ; GFX11-NEXT: v_and_b32_e32 v0, 24, v0
2611 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2)
2612 ; GFX11-NEXT: v_not_b32_e32 v2, v2
2613 ; GFX11-NEXT: .p2align 6
2614 ; GFX11-NEXT: .LBB14_1: ; %atomicrmw.start
2615 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
2616 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2617 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
2618 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2619 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v0, v4
2620 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v3
2621 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2622 ; GFX11-NEXT: v_min_f32_e32 v3, 4.0, v3
2623 ; GFX11-NEXT: v_bfe_u32 v5, v3, 16, 1
2624 ; GFX11-NEXT: v_or_b32_e32 v6, 0x400000, v3
2625 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
2626 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
2627 ; GFX11-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
2628 ; GFX11-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
2629 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2630 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v3
2631 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v0, v3
2632 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
2633 ; GFX11-NEXT: v_and_or_b32 v3, v4, v2, v3
2634 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2635 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v3, v1, v3, v4
2636 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2637 ; GFX11-NEXT: buffer_gl0_inv
2638 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2639 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2640 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2641 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2642 ; GFX11-NEXT: s_cbranch_execnz .LBB14_1
2643 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
2644 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
2645 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2646 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2648 ; GFX10-LABEL: local_atomic_fmin_ret_bf16:
2650 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2651 ; GFX10-NEXT: v_and_b32_e32 v1, -4, v0
2652 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 3, v0
2653 ; GFX10-NEXT: s_mov_b32 s4, 0
2654 ; GFX10-NEXT: ds_read_b32 v3, v1
2655 ; GFX10-NEXT: v_lshlrev_b32_e64 v2, v0, 0xffff
2656 ; GFX10-NEXT: v_and_b32_e32 v0, 24, v0
2657 ; GFX10-NEXT: v_not_b32_e32 v2, v2
2658 ; GFX10-NEXT: .LBB14_1: ; %atomicrmw.start
2659 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2660 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2661 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
2662 ; GFX10-NEXT: v_lshrrev_b32_sdwa v3, v0, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
2663 ; GFX10-NEXT: v_min_f32_e32 v3, 4.0, v3
2664 ; GFX10-NEXT: v_bfe_u32 v5, v3, 16, 1
2665 ; GFX10-NEXT: v_or_b32_e32 v6, 0x400000, v3
2666 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
2667 ; GFX10-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
2668 ; GFX10-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
2669 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v0, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
2670 ; GFX10-NEXT: v_and_or_b32 v3, v4, v2, v3
2671 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2672 ; GFX10-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
2673 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2674 ; GFX10-NEXT: buffer_gl0_inv
2675 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2676 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2677 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2678 ; GFX10-NEXT: s_cbranch_execnz .LBB14_1
2679 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2680 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2681 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2682 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2684 ; GFX90A-LABEL: local_atomic_fmin_ret_bf16:
2686 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2687 ; GFX90A-NEXT: v_and_b32_e32 v1, -4, v0
2688 ; GFX90A-NEXT: ds_read_b32 v3, v1
2689 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 3, v0
2690 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
2691 ; GFX90A-NEXT: v_and_b32_e32 v0, 24, v2
2692 ; GFX90A-NEXT: v_lshlrev_b32_e64 v2, v2, s4
2693 ; GFX90A-NEXT: v_not_b32_e32 v2, v2
2694 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
2695 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
2696 ; GFX90A-NEXT: .LBB14_1: ; %atomicrmw.start
2697 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
2698 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2699 ; GFX90A-NEXT: v_mov_b32_e32 v4, v3
2700 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v3, v0, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
2701 ; GFX90A-NEXT: v_min_f32_e32 v3, 4.0, v3
2702 ; GFX90A-NEXT: v_bfe_u32 v5, v3, 16, 1
2703 ; GFX90A-NEXT: v_or_b32_e32 v6, 0x400000, v3
2704 ; GFX90A-NEXT: v_add3_u32 v5, v5, v3, s6
2705 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
2706 ; GFX90A-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc
2707 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v3, v0, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
2708 ; GFX90A-NEXT: v_and_or_b32 v3, v4, v2, v3
2709 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
2710 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2711 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2712 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2713 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
2714 ; GFX90A-NEXT: s_cbranch_execnz .LBB14_1
2715 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
2716 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2717 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2718 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2720 ; GFX908-LABEL: local_atomic_fmin_ret_bf16:
2722 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2723 ; GFX908-NEXT: v_and_b32_e32 v1, -4, v0
2724 ; GFX908-NEXT: ds_read_b32 v3, v1
2725 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 3, v0
2726 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
2727 ; GFX908-NEXT: v_and_b32_e32 v0, 24, v2
2728 ; GFX908-NEXT: v_lshlrev_b32_e64 v2, v2, s4
2729 ; GFX908-NEXT: v_not_b32_e32 v2, v2
2730 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2731 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
2732 ; GFX908-NEXT: .LBB14_1: ; %atomicrmw.start
2733 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2734 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
2735 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
2736 ; GFX908-NEXT: v_lshrrev_b32_sdwa v3, v0, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
2737 ; GFX908-NEXT: v_min_f32_e32 v3, 4.0, v3
2738 ; GFX908-NEXT: v_bfe_u32 v5, v3, 16, 1
2739 ; GFX908-NEXT: v_or_b32_e32 v6, 0x400000, v3
2740 ; GFX908-NEXT: v_add3_u32 v5, v5, v3, s6
2741 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
2742 ; GFX908-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc
2743 ; GFX908-NEXT: v_lshlrev_b32_sdwa v3, v0, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
2744 ; GFX908-NEXT: v_and_or_b32 v3, v4, v2, v3
2745 ; GFX908-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
2746 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
2747 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2748 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2749 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2750 ; GFX908-NEXT: s_cbranch_execnz .LBB14_1
2751 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2752 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2753 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2754 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2756 ; GFX8-LABEL: local_atomic_fmin_ret_bf16:
2758 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2759 ; GFX8-NEXT: v_and_b32_e32 v1, -4, v0
2760 ; GFX8-NEXT: s_mov_b32 m0, -1
2761 ; GFX8-NEXT: ds_read_b32 v3, v1
2762 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 3, v0
2763 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
2764 ; GFX8-NEXT: v_and_b32_e32 v0, 24, v2
2765 ; GFX8-NEXT: v_lshlrev_b32_e64 v2, v2, s4
2766 ; GFX8-NEXT: v_not_b32_e32 v2, v2
2767 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2768 ; GFX8-NEXT: .LBB14_1: ; %atomicrmw.start
2769 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2770 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2771 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
2772 ; GFX8-NEXT: v_lshrrev_b32_sdwa v3, v0, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
2773 ; GFX8-NEXT: v_min_f32_e32 v3, 4.0, v3
2774 ; GFX8-NEXT: v_bfe_u32 v6, v3, 16, 1
2775 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v3
2776 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
2777 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v3
2778 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
2779 ; GFX8-NEXT: v_cndmask_b32_e32 v3, v6, v7, vcc
2780 ; GFX8-NEXT: v_and_b32_e32 v5, v4, v2
2781 ; GFX8-NEXT: v_lshlrev_b32_sdwa v3, v0, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
2782 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
2783 ; GFX8-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
2784 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2785 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2786 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2787 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2788 ; GFX8-NEXT: s_cbranch_execnz .LBB14_1
2789 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2790 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2791 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2792 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2794 ; GFX7-LABEL: local_atomic_fmin_ret_bf16:
2796 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2797 ; GFX7-NEXT: v_and_b32_e32 v1, -4, v0
2798 ; GFX7-NEXT: s_mov_b32 m0, -1
2799 ; GFX7-NEXT: ds_read_b32 v3, v1
2800 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v0
2801 ; GFX7-NEXT: v_and_b32_e32 v0, 24, v2
2802 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v2
2803 ; GFX7-NEXT: v_not_b32_e32 v2, v2
2804 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
2805 ; GFX7-NEXT: .LBB14_1: ; %atomicrmw.start
2806 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2807 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2808 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
2809 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, v0, v4
2810 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
2811 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
2812 ; GFX7-NEXT: v_min_f32_e32 v3, 4.0, v3
2813 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v3
2814 ; GFX7-NEXT: v_and_b32_e32 v5, v4, v2
2815 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, v0, v3
2816 ; GFX7-NEXT: v_or_b32_e32 v3, v5, v3
2817 ; GFX7-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
2818 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2819 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2820 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2821 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
2822 ; GFX7-NEXT: s_cbranch_execnz .LBB14_1
2823 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2824 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
2825 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2826 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
2827 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2829 ; GFX6-LABEL: local_atomic_fmin_ret_bf16:
2831 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2832 ; GFX6-NEXT: v_and_b32_e32 v1, -4, v0
2833 ; GFX6-NEXT: s_mov_b32 m0, -1
2834 ; GFX6-NEXT: ds_read_b32 v3, v1
2835 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 3, v0
2836 ; GFX6-NEXT: v_and_b32_e32 v0, 24, v2
2837 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v2
2838 ; GFX6-NEXT: v_not_b32_e32 v2, v2
2839 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
2840 ; GFX6-NEXT: .LBB14_1: ; %atomicrmw.start
2841 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
2842 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2843 ; GFX6-NEXT: v_mov_b32_e32 v4, v3
2844 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, v0, v4
2845 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
2846 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
2847 ; GFX6-NEXT: v_min_f32_e32 v3, 4.0, v3
2848 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v3
2849 ; GFX6-NEXT: v_and_b32_e32 v5, v4, v2
2850 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, v0, v3
2851 ; GFX6-NEXT: v_or_b32_e32 v3, v5, v3
2852 ; GFX6-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
2853 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2854 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2855 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2856 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
2857 ; GFX6-NEXT: s_cbranch_execnz .LBB14_1
2858 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
2859 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
2860 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2861 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v0
2862 ; GFX6-NEXT: s_setpc_b64 s[30:31]
2863 %result = atomicrmw fmin ptr addrspace(3) %ptr, bfloat 4.0 seq_cst
2867 define bfloat @local_atomic_fmin_ret_bf16__offset(ptr addrspace(3) %ptr) nounwind {
2868 ; GFX12-LABEL: local_atomic_fmin_ret_bf16__offset:
2870 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2871 ; GFX12-NEXT: s_wait_expcnt 0x0
2872 ; GFX12-NEXT: s_wait_samplecnt 0x0
2873 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2874 ; GFX12-NEXT: s_wait_kmcnt 0x0
2875 ; GFX12-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
2876 ; GFX12-NEXT: s_mov_b32 s0, 0
2877 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
2878 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v1
2879 ; GFX12-NEXT: v_and_b32_e32 v1, 3, v1
2880 ; GFX12-NEXT: ds_load_b32 v3, v0
2881 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 3, v1
2882 ; GFX12-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
2883 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
2884 ; GFX12-NEXT: v_not_b32_e32 v2, v2
2885 ; GFX12-NEXT: .LBB15_1: ; %atomicrmw.start
2886 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
2887 ; GFX12-NEXT: s_wait_dscnt 0x0
2888 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
2889 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2890 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v1, v4
2891 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v3
2892 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2893 ; GFX12-NEXT: v_min_num_f32_e32 v3, 4.0, v3
2894 ; GFX12-NEXT: v_bfe_u32 v5, v3, 16, 1
2895 ; GFX12-NEXT: v_or_b32_e32 v6, 0x400000, v3
2896 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
2897 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
2898 ; GFX12-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
2899 ; GFX12-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
2900 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2901 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, 16, v3
2902 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v1, v3
2903 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
2904 ; GFX12-NEXT: v_and_or_b32 v3, v4, v2, v3
2905 ; GFX12-NEXT: global_wb scope:SCOPE_SE
2906 ; GFX12-NEXT: s_wait_storecnt 0x0
2907 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v3, v0, v3, v4
2908 ; GFX12-NEXT: s_wait_dscnt 0x0
2909 ; GFX12-NEXT: global_inv scope:SCOPE_SE
2910 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2911 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
2912 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2913 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2914 ; GFX12-NEXT: s_cbranch_execnz .LBB15_1
2915 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
2916 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
2917 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v1, v3
2918 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2920 ; GFX940-LABEL: local_atomic_fmin_ret_bf16__offset:
2922 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2923 ; GFX940-NEXT: v_add_u32_e32 v0, 0xfffe, v0
2924 ; GFX940-NEXT: v_and_b32_e32 v1, -4, v0
2925 ; GFX940-NEXT: ds_read_b32 v3, v1
2926 ; GFX940-NEXT: v_and_b32_e32 v0, 3, v0
2927 ; GFX940-NEXT: v_lshlrev_b32_e32 v0, 3, v0
2928 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
2929 ; GFX940-NEXT: v_lshlrev_b32_e64 v2, v0, s0
2930 ; GFX940-NEXT: v_not_b32_e32 v2, v2
2931 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
2932 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
2933 ; GFX940-NEXT: .LBB15_1: ; %atomicrmw.start
2934 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
2935 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
2936 ; GFX940-NEXT: v_mov_b32_e32 v4, v3
2937 ; GFX940-NEXT: v_lshrrev_b32_sdwa v3, v0, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
2938 ; GFX940-NEXT: s_nop 0
2939 ; GFX940-NEXT: v_min_f32_e32 v3, 4.0, v3
2940 ; GFX940-NEXT: v_bfe_u32 v5, v3, 16, 1
2941 ; GFX940-NEXT: v_or_b32_e32 v6, 0x400000, v3
2942 ; GFX940-NEXT: v_add3_u32 v5, v5, v3, s2
2943 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
2944 ; GFX940-NEXT: s_nop 1
2945 ; GFX940-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc
2946 ; GFX940-NEXT: v_lshlrev_b32_sdwa v3, v0, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
2947 ; GFX940-NEXT: v_and_or_b32 v3, v4, v2, v3
2948 ; GFX940-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
2949 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
2950 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2951 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
2952 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
2953 ; GFX940-NEXT: s_cbranch_execnz .LBB15_1
2954 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
2955 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
2956 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v0, v3
2957 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2959 ; GFX11-LABEL: local_atomic_fmin_ret_bf16__offset:
2961 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2962 ; GFX11-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
2963 ; GFX11-NEXT: s_mov_b32 s0, 0
2964 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
2965 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v1
2966 ; GFX11-NEXT: v_and_b32_e32 v1, 3, v1
2967 ; GFX11-NEXT: ds_load_b32 v3, v0
2968 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 3, v1
2969 ; GFX11-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
2970 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
2971 ; GFX11-NEXT: v_not_b32_e32 v2, v2
2972 ; GFX11-NEXT: .p2align 6
2973 ; GFX11-NEXT: .LBB15_1: ; %atomicrmw.start
2974 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
2975 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2976 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
2977 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2978 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v1, v4
2979 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v3
2980 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2981 ; GFX11-NEXT: v_min_f32_e32 v3, 4.0, v3
2982 ; GFX11-NEXT: v_bfe_u32 v5, v3, 16, 1
2983 ; GFX11-NEXT: v_or_b32_e32 v6, 0x400000, v3
2984 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
2985 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
2986 ; GFX11-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
2987 ; GFX11-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
2988 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2989 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v3
2990 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v1, v3
2991 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
2992 ; GFX11-NEXT: v_and_or_b32 v3, v4, v2, v3
2993 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2994 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v3, v0, v3, v4
2995 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2996 ; GFX11-NEXT: buffer_gl0_inv
2997 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2998 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2999 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3000 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3001 ; GFX11-NEXT: s_cbranch_execnz .LBB15_1
3002 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3003 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3004 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v1, v3
3005 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3007 ; GFX10-LABEL: local_atomic_fmin_ret_bf16__offset:
3009 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3010 ; GFX10-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
3011 ; GFX10-NEXT: s_mov_b32 s4, 0
3012 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v1
3013 ; GFX10-NEXT: v_and_b32_e32 v1, 3, v1
3014 ; GFX10-NEXT: ds_read_b32 v3, v0
3015 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3016 ; GFX10-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
3017 ; GFX10-NEXT: v_not_b32_e32 v2, v2
3018 ; GFX10-NEXT: .LBB15_1: ; %atomicrmw.start
3019 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
3020 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
3021 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
3022 ; GFX10-NEXT: v_lshrrev_b32_sdwa v3, v1, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3023 ; GFX10-NEXT: v_min_f32_e32 v3, 4.0, v3
3024 ; GFX10-NEXT: v_bfe_u32 v5, v3, 16, 1
3025 ; GFX10-NEXT: v_or_b32_e32 v6, 0x400000, v3
3026 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
3027 ; GFX10-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
3028 ; GFX10-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
3029 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v1, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3030 ; GFX10-NEXT: v_and_or_b32 v3, v4, v2, v3
3031 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3032 ; GFX10-NEXT: ds_cmpst_rtn_b32 v3, v0, v4, v3
3033 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
3034 ; GFX10-NEXT: buffer_gl0_inv
3035 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
3036 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
3037 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
3038 ; GFX10-NEXT: s_cbranch_execnz .LBB15_1
3039 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
3040 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
3041 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v1, v3
3042 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3044 ; GFX90A-LABEL: local_atomic_fmin_ret_bf16__offset:
3046 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3047 ; GFX90A-NEXT: v_add_u32_e32 v0, 0xfffe, v0
3048 ; GFX90A-NEXT: v_and_b32_e32 v1, -4, v0
3049 ; GFX90A-NEXT: ds_read_b32 v3, v1
3050 ; GFX90A-NEXT: v_and_b32_e32 v0, 3, v0
3051 ; GFX90A-NEXT: v_lshlrev_b32_e32 v0, 3, v0
3052 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
3053 ; GFX90A-NEXT: v_lshlrev_b32_e64 v2, v0, s4
3054 ; GFX90A-NEXT: v_not_b32_e32 v2, v2
3055 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
3056 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
3057 ; GFX90A-NEXT: .LBB15_1: ; %atomicrmw.start
3058 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
3059 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
3060 ; GFX90A-NEXT: v_mov_b32_e32 v4, v3
3061 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v3, v0, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3062 ; GFX90A-NEXT: v_min_f32_e32 v3, 4.0, v3
3063 ; GFX90A-NEXT: v_bfe_u32 v5, v3, 16, 1
3064 ; GFX90A-NEXT: v_or_b32_e32 v6, 0x400000, v3
3065 ; GFX90A-NEXT: v_add3_u32 v5, v5, v3, s6
3066 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
3067 ; GFX90A-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc
3068 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v3, v0, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3069 ; GFX90A-NEXT: v_and_or_b32 v3, v4, v2, v3
3070 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
3071 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
3072 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3073 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3074 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
3075 ; GFX90A-NEXT: s_cbranch_execnz .LBB15_1
3076 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
3077 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3078 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v0, v3
3079 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3081 ; GFX908-LABEL: local_atomic_fmin_ret_bf16__offset:
3083 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3084 ; GFX908-NEXT: v_add_u32_e32 v0, 0xfffe, v0
3085 ; GFX908-NEXT: v_and_b32_e32 v1, -4, v0
3086 ; GFX908-NEXT: ds_read_b32 v3, v1
3087 ; GFX908-NEXT: v_and_b32_e32 v0, 3, v0
3088 ; GFX908-NEXT: v_lshlrev_b32_e32 v0, 3, v0
3089 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
3090 ; GFX908-NEXT: v_lshlrev_b32_e64 v2, v0, s4
3091 ; GFX908-NEXT: v_not_b32_e32 v2, v2
3092 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3093 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
3094 ; GFX908-NEXT: .LBB15_1: ; %atomicrmw.start
3095 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3096 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
3097 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
3098 ; GFX908-NEXT: v_lshrrev_b32_sdwa v3, v0, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3099 ; GFX908-NEXT: v_min_f32_e32 v3, 4.0, v3
3100 ; GFX908-NEXT: v_bfe_u32 v5, v3, 16, 1
3101 ; GFX908-NEXT: v_or_b32_e32 v6, 0x400000, v3
3102 ; GFX908-NEXT: v_add3_u32 v5, v5, v3, s6
3103 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
3104 ; GFX908-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc
3105 ; GFX908-NEXT: v_lshlrev_b32_sdwa v3, v0, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3106 ; GFX908-NEXT: v_and_or_b32 v3, v4, v2, v3
3107 ; GFX908-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
3108 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
3109 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3110 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3111 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3112 ; GFX908-NEXT: s_cbranch_execnz .LBB15_1
3113 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3114 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3115 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v0, v3
3116 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3118 ; GFX8-LABEL: local_atomic_fmin_ret_bf16__offset:
3120 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3121 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffe, v0
3122 ; GFX8-NEXT: v_and_b32_e32 v1, -4, v0
3123 ; GFX8-NEXT: s_mov_b32 m0, -1
3124 ; GFX8-NEXT: ds_read_b32 v3, v1
3125 ; GFX8-NEXT: v_and_b32_e32 v0, 3, v0
3126 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 3, v0
3127 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
3128 ; GFX8-NEXT: v_lshlrev_b32_e64 v2, v0, s4
3129 ; GFX8-NEXT: v_not_b32_e32 v2, v2
3130 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3131 ; GFX8-NEXT: .LBB15_1: ; %atomicrmw.start
3132 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3133 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
3134 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
3135 ; GFX8-NEXT: v_lshrrev_b32_sdwa v3, v0, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3136 ; GFX8-NEXT: v_min_f32_e32 v3, 4.0, v3
3137 ; GFX8-NEXT: v_bfe_u32 v6, v3, 16, 1
3138 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v3
3139 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
3140 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v3
3141 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
3142 ; GFX8-NEXT: v_cndmask_b32_e32 v3, v6, v7, vcc
3143 ; GFX8-NEXT: v_and_b32_e32 v5, v4, v2
3144 ; GFX8-NEXT: v_lshlrev_b32_sdwa v3, v0, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3145 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
3146 ; GFX8-NEXT: ds_cmpst_rtn_b32 v3, v1, v4, v3
3147 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
3148 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3149 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3150 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3151 ; GFX8-NEXT: s_cbranch_execnz .LBB15_1
3152 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3153 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3154 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v0, v3
3155 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3157 ; GFX7-LABEL: local_atomic_fmin_ret_bf16__offset:
3159 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3160 ; GFX7-NEXT: v_add_i32_e32 v1, vcc, 0xfffe, v0
3161 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v1
3162 ; GFX7-NEXT: s_mov_b32 m0, -1
3163 ; GFX7-NEXT: ds_read_b32 v3, v0
3164 ; GFX7-NEXT: v_and_b32_e32 v1, 3, v1
3165 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3166 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v1
3167 ; GFX7-NEXT: v_not_b32_e32 v2, v2
3168 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
3169 ; GFX7-NEXT: .LBB15_1: ; %atomicrmw.start
3170 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
3171 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3172 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
3173 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, v1, v4
3174 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
3175 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
3176 ; GFX7-NEXT: v_min_f32_e32 v3, 4.0, v3
3177 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v3
3178 ; GFX7-NEXT: v_and_b32_e32 v5, v4, v2
3179 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, v1, v3
3180 ; GFX7-NEXT: v_or_b32_e32 v3, v5, v3
3181 ; GFX7-NEXT: ds_cmpst_rtn_b32 v3, v0, v4, v3
3182 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3183 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3184 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3185 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
3186 ; GFX7-NEXT: s_cbranch_execnz .LBB15_1
3187 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
3188 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
3189 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v1, v3
3190 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
3191 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3193 ; GFX6-LABEL: local_atomic_fmin_ret_bf16__offset:
3195 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3196 ; GFX6-NEXT: v_add_i32_e32 v1, vcc, 0xfffe, v0
3197 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v1
3198 ; GFX6-NEXT: s_mov_b32 m0, -1
3199 ; GFX6-NEXT: ds_read_b32 v3, v0
3200 ; GFX6-NEXT: v_and_b32_e32 v1, 3, v1
3201 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3202 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v1
3203 ; GFX6-NEXT: v_not_b32_e32 v2, v2
3204 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
3205 ; GFX6-NEXT: .LBB15_1: ; %atomicrmw.start
3206 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
3207 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3208 ; GFX6-NEXT: v_mov_b32_e32 v4, v3
3209 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, v1, v4
3210 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
3211 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
3212 ; GFX6-NEXT: v_min_f32_e32 v3, 4.0, v3
3213 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v3
3214 ; GFX6-NEXT: v_and_b32_e32 v5, v4, v2
3215 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, v1, v3
3216 ; GFX6-NEXT: v_or_b32_e32 v3, v5, v3
3217 ; GFX6-NEXT: ds_cmpst_rtn_b32 v3, v0, v4, v3
3218 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3219 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3220 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3221 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
3222 ; GFX6-NEXT: s_cbranch_execnz .LBB15_1
3223 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
3224 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
3225 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v1, v3
3226 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v0
3227 ; GFX6-NEXT: s_setpc_b64 s[30:31]
3228 %gep = getelementptr bfloat, ptr addrspace(3) %ptr, i32 32767
3229 %result = atomicrmw fmin ptr addrspace(3) %gep, bfloat 4.0 seq_cst
3233 define void @local_atomic_fmin_noret_bf16(ptr addrspace(3) %ptr) nounwind {
3234 ; GFX12-LABEL: local_atomic_fmin_noret_bf16:
3236 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3237 ; GFX12-NEXT: s_wait_expcnt 0x0
3238 ; GFX12-NEXT: s_wait_samplecnt 0x0
3239 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3240 ; GFX12-NEXT: s_wait_kmcnt 0x0
3241 ; GFX12-NEXT: v_and_b32_e32 v1, -4, v0
3242 ; GFX12-NEXT: v_lshlrev_b32_e32 v0, 3, v0
3243 ; GFX12-NEXT: s_mov_b32 s0, 0
3244 ; GFX12-NEXT: ds_load_b32 v2, v1
3245 ; GFX12-NEXT: v_lshlrev_b32_e64 v3, v0, 0xffff
3246 ; GFX12-NEXT: v_and_b32_e32 v0, 24, v0
3247 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2)
3248 ; GFX12-NEXT: v_not_b32_e32 v3, v3
3249 ; GFX12-NEXT: .LBB16_1: ; %atomicrmw.start
3250 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3251 ; GFX12-NEXT: s_wait_dscnt 0x0
3252 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
3253 ; GFX12-NEXT: v_lshrrev_b32_e32 v4, v0, v2
3254 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v4
3255 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3256 ; GFX12-NEXT: v_min_num_f32_e32 v4, 4.0, v4
3257 ; GFX12-NEXT: v_bfe_u32 v5, v4, 16, 1
3258 ; GFX12-NEXT: v_or_b32_e32 v6, 0x400000, v4
3259 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v4, v4
3260 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
3261 ; GFX12-NEXT: v_add3_u32 v5, v5, v4, 0x7fff
3262 ; GFX12-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc_lo
3263 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3264 ; GFX12-NEXT: v_lshrrev_b32_e32 v4, 16, v4
3265 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, v0, v4
3266 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3267 ; GFX12-NEXT: v_and_or_b32 v4, v2, v3, v4
3268 ; GFX12-NEXT: global_wb scope:SCOPE_SE
3269 ; GFX12-NEXT: s_wait_storecnt 0x0
3270 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v4, v1, v4, v2
3271 ; GFX12-NEXT: s_wait_dscnt 0x0
3272 ; GFX12-NEXT: global_inv scope:SCOPE_SE
3273 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v2
3274 ; GFX12-NEXT: v_mov_b32_e32 v2, v4
3275 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3276 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3277 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3278 ; GFX12-NEXT: s_cbranch_execnz .LBB16_1
3279 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3280 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3281 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3283 ; GFX940-LABEL: local_atomic_fmin_noret_bf16:
3285 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3286 ; GFX940-NEXT: v_and_b32_e32 v1, -4, v0
3287 ; GFX940-NEXT: ds_read_b32 v3, v1
3288 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 3, v0
3289 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
3290 ; GFX940-NEXT: v_and_b32_e32 v0, 24, v2
3291 ; GFX940-NEXT: v_lshlrev_b32_e64 v2, v2, s0
3292 ; GFX940-NEXT: v_not_b32_e32 v2, v2
3293 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
3294 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
3295 ; GFX940-NEXT: .LBB16_1: ; %atomicrmw.start
3296 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
3297 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
3298 ; GFX940-NEXT: v_lshrrev_b32_sdwa v4, v0, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3299 ; GFX940-NEXT: s_nop 0
3300 ; GFX940-NEXT: v_min_f32_e32 v4, 4.0, v4
3301 ; GFX940-NEXT: v_bfe_u32 v5, v4, 16, 1
3302 ; GFX940-NEXT: v_or_b32_e32 v6, 0x400000, v4
3303 ; GFX940-NEXT: v_add3_u32 v5, v5, v4, s2
3304 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
3305 ; GFX940-NEXT: s_nop 1
3306 ; GFX940-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc
3307 ; GFX940-NEXT: v_lshlrev_b32_sdwa v4, v0, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3308 ; GFX940-NEXT: v_and_or_b32 v4, v3, v2, v4
3309 ; GFX940-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
3310 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
3311 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3312 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
3313 ; GFX940-NEXT: v_mov_b32_e32 v3, v4
3314 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
3315 ; GFX940-NEXT: s_cbranch_execnz .LBB16_1
3316 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
3317 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
3318 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3320 ; GFX11-LABEL: local_atomic_fmin_noret_bf16:
3322 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3323 ; GFX11-NEXT: v_and_b32_e32 v1, -4, v0
3324 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
3325 ; GFX11-NEXT: s_mov_b32 s0, 0
3326 ; GFX11-NEXT: ds_load_b32 v2, v1
3327 ; GFX11-NEXT: v_lshlrev_b32_e64 v3, v0, 0xffff
3328 ; GFX11-NEXT: v_and_b32_e32 v0, 24, v0
3329 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2)
3330 ; GFX11-NEXT: v_not_b32_e32 v3, v3
3331 ; GFX11-NEXT: .p2align 6
3332 ; GFX11-NEXT: .LBB16_1: ; %atomicrmw.start
3333 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
3334 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
3335 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
3336 ; GFX11-NEXT: v_lshrrev_b32_e32 v4, v0, v2
3337 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v4
3338 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3339 ; GFX11-NEXT: v_min_f32_e32 v4, 4.0, v4
3340 ; GFX11-NEXT: v_bfe_u32 v5, v4, 16, 1
3341 ; GFX11-NEXT: v_or_b32_e32 v6, 0x400000, v4
3342 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v4, v4
3343 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
3344 ; GFX11-NEXT: v_add3_u32 v5, v5, v4, 0x7fff
3345 ; GFX11-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc_lo
3346 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3347 ; GFX11-NEXT: v_lshrrev_b32_e32 v4, 16, v4
3348 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, v0, v4
3349 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
3350 ; GFX11-NEXT: v_and_or_b32 v4, v2, v3, v4
3351 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3352 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v4, v1, v4, v2
3353 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
3354 ; GFX11-NEXT: buffer_gl0_inv
3355 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v2
3356 ; GFX11-NEXT: v_mov_b32_e32 v2, v4
3357 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3358 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3359 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3360 ; GFX11-NEXT: s_cbranch_execnz .LBB16_1
3361 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3362 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3363 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3365 ; GFX10-LABEL: local_atomic_fmin_noret_bf16:
3367 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3368 ; GFX10-NEXT: v_and_b32_e32 v1, -4, v0
3369 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 3, v0
3370 ; GFX10-NEXT: s_mov_b32 s4, 0
3371 ; GFX10-NEXT: ds_read_b32 v2, v1
3372 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v0, 0xffff
3373 ; GFX10-NEXT: v_and_b32_e32 v0, 24, v0
3374 ; GFX10-NEXT: v_not_b32_e32 v3, v3
3375 ; GFX10-NEXT: .LBB16_1: ; %atomicrmw.start
3376 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
3377 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
3378 ; GFX10-NEXT: v_lshrrev_b32_sdwa v4, v0, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3379 ; GFX10-NEXT: v_min_f32_e32 v4, 4.0, v4
3380 ; GFX10-NEXT: v_bfe_u32 v5, v4, 16, 1
3381 ; GFX10-NEXT: v_or_b32_e32 v6, 0x400000, v4
3382 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v4, v4
3383 ; GFX10-NEXT: v_add3_u32 v5, v5, v4, 0x7fff
3384 ; GFX10-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc_lo
3385 ; GFX10-NEXT: v_lshlrev_b32_sdwa v4, v0, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3386 ; GFX10-NEXT: v_and_or_b32 v4, v2, v3, v4
3387 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3388 ; GFX10-NEXT: ds_cmpst_rtn_b32 v4, v1, v2, v4
3389 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
3390 ; GFX10-NEXT: buffer_gl0_inv
3391 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v2
3392 ; GFX10-NEXT: v_mov_b32_e32 v2, v4
3393 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
3394 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
3395 ; GFX10-NEXT: s_cbranch_execnz .LBB16_1
3396 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
3397 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
3398 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3400 ; GFX90A-LABEL: local_atomic_fmin_noret_bf16:
3402 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3403 ; GFX90A-NEXT: v_and_b32_e32 v1, -4, v0
3404 ; GFX90A-NEXT: ds_read_b32 v3, v1
3405 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 3, v0
3406 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
3407 ; GFX90A-NEXT: v_and_b32_e32 v0, 24, v2
3408 ; GFX90A-NEXT: v_lshlrev_b32_e64 v2, v2, s4
3409 ; GFX90A-NEXT: v_not_b32_e32 v2, v2
3410 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
3411 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
3412 ; GFX90A-NEXT: .LBB16_1: ; %atomicrmw.start
3413 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
3414 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
3415 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v4, v0, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3416 ; GFX90A-NEXT: v_min_f32_e32 v4, 4.0, v4
3417 ; GFX90A-NEXT: v_bfe_u32 v5, v4, 16, 1
3418 ; GFX90A-NEXT: v_or_b32_e32 v6, 0x400000, v4
3419 ; GFX90A-NEXT: v_add3_u32 v5, v5, v4, s6
3420 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
3421 ; GFX90A-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc
3422 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v4, v0, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3423 ; GFX90A-NEXT: v_and_or_b32 v4, v3, v2, v4
3424 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
3425 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
3426 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3427 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3428 ; GFX90A-NEXT: v_mov_b32_e32 v3, v4
3429 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
3430 ; GFX90A-NEXT: s_cbranch_execnz .LBB16_1
3431 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
3432 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3433 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3435 ; GFX908-LABEL: local_atomic_fmin_noret_bf16:
3437 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3438 ; GFX908-NEXT: v_and_b32_e32 v1, -4, v0
3439 ; GFX908-NEXT: ds_read_b32 v3, v1
3440 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 3, v0
3441 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
3442 ; GFX908-NEXT: v_and_b32_e32 v0, 24, v2
3443 ; GFX908-NEXT: v_lshlrev_b32_e64 v2, v2, s4
3444 ; GFX908-NEXT: v_not_b32_e32 v2, v2
3445 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3446 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
3447 ; GFX908-NEXT: .LBB16_1: ; %atomicrmw.start
3448 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3449 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
3450 ; GFX908-NEXT: v_lshrrev_b32_sdwa v4, v0, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3451 ; GFX908-NEXT: v_min_f32_e32 v4, 4.0, v4
3452 ; GFX908-NEXT: v_bfe_u32 v5, v4, 16, 1
3453 ; GFX908-NEXT: v_or_b32_e32 v6, 0x400000, v4
3454 ; GFX908-NEXT: v_add3_u32 v5, v5, v4, s6
3455 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
3456 ; GFX908-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc
3457 ; GFX908-NEXT: v_lshlrev_b32_sdwa v4, v0, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3458 ; GFX908-NEXT: v_and_or_b32 v4, v3, v2, v4
3459 ; GFX908-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
3460 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
3461 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3462 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3463 ; GFX908-NEXT: v_mov_b32_e32 v3, v4
3464 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3465 ; GFX908-NEXT: s_cbranch_execnz .LBB16_1
3466 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3467 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3468 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3470 ; GFX8-LABEL: local_atomic_fmin_noret_bf16:
3472 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3473 ; GFX8-NEXT: v_and_b32_e32 v1, -4, v0
3474 ; GFX8-NEXT: s_mov_b32 m0, -1
3475 ; GFX8-NEXT: ds_read_b32 v3, v1
3476 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 3, v0
3477 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
3478 ; GFX8-NEXT: v_and_b32_e32 v0, 24, v2
3479 ; GFX8-NEXT: v_lshlrev_b32_e64 v2, v2, s4
3480 ; GFX8-NEXT: v_not_b32_e32 v2, v2
3481 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3482 ; GFX8-NEXT: .LBB16_1: ; %atomicrmw.start
3483 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3484 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
3485 ; GFX8-NEXT: v_lshrrev_b32_sdwa v4, v0, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3486 ; GFX8-NEXT: v_min_f32_e32 v4, 4.0, v4
3487 ; GFX8-NEXT: v_bfe_u32 v6, v4, 16, 1
3488 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v4
3489 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
3490 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v4
3491 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
3492 ; GFX8-NEXT: v_cndmask_b32_e32 v4, v6, v7, vcc
3493 ; GFX8-NEXT: v_and_b32_e32 v5, v3, v2
3494 ; GFX8-NEXT: v_lshlrev_b32_sdwa v4, v0, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3495 ; GFX8-NEXT: v_or_b32_e32 v4, v5, v4
3496 ; GFX8-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
3497 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
3498 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3499 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3500 ; GFX8-NEXT: v_mov_b32_e32 v3, v4
3501 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3502 ; GFX8-NEXT: s_cbranch_execnz .LBB16_1
3503 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3504 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3505 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3507 ; GFX7-LABEL: local_atomic_fmin_noret_bf16:
3509 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3510 ; GFX7-NEXT: v_and_b32_e32 v1, -4, v0
3511 ; GFX7-NEXT: s_mov_b32 m0, -1
3512 ; GFX7-NEXT: ds_read_b32 v3, v1
3513 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v0
3514 ; GFX7-NEXT: v_and_b32_e32 v0, 24, v2
3515 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v2
3516 ; GFX7-NEXT: v_not_b32_e32 v2, v2
3517 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
3518 ; GFX7-NEXT: .LBB16_1: ; %atomicrmw.start
3519 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
3520 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3521 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, v0, v3
3522 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v4
3523 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
3524 ; GFX7-NEXT: v_min_f32_e32 v4, 4.0, v4
3525 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
3526 ; GFX7-NEXT: v_and_b32_e32 v5, v3, v2
3527 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, v0, v4
3528 ; GFX7-NEXT: v_or_b32_e32 v4, v5, v4
3529 ; GFX7-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
3530 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3531 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3532 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3533 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
3534 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
3535 ; GFX7-NEXT: s_cbranch_execnz .LBB16_1
3536 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
3537 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
3538 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3540 ; GFX6-LABEL: local_atomic_fmin_noret_bf16:
3542 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3543 ; GFX6-NEXT: v_and_b32_e32 v1, -4, v0
3544 ; GFX6-NEXT: s_mov_b32 m0, -1
3545 ; GFX6-NEXT: ds_read_b32 v3, v1
3546 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 3, v0
3547 ; GFX6-NEXT: v_and_b32_e32 v0, 24, v2
3548 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v2
3549 ; GFX6-NEXT: v_not_b32_e32 v2, v2
3550 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
3551 ; GFX6-NEXT: .LBB16_1: ; %atomicrmw.start
3552 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
3553 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3554 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, v0, v3
3555 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v4
3556 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v4
3557 ; GFX6-NEXT: v_min_f32_e32 v4, 4.0, v4
3558 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v4
3559 ; GFX6-NEXT: v_and_b32_e32 v5, v3, v2
3560 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, v0, v4
3561 ; GFX6-NEXT: v_or_b32_e32 v4, v5, v4
3562 ; GFX6-NEXT: ds_cmpst_rtn_b32 v4, v1, v3, v4
3563 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3564 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3565 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3566 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
3567 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
3568 ; GFX6-NEXT: s_cbranch_execnz .LBB16_1
3569 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
3570 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
3571 ; GFX6-NEXT: s_setpc_b64 s[30:31]
3572 %result = atomicrmw fmin ptr addrspace(3) %ptr, bfloat 4.0 seq_cst
3576 define void @local_atomic_fmin_noret_bf16__offset(ptr addrspace(3) %ptr) nounwind {
3577 ; GFX12-LABEL: local_atomic_fmin_noret_bf16__offset:
3579 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3580 ; GFX12-NEXT: s_wait_expcnt 0x0
3581 ; GFX12-NEXT: s_wait_samplecnt 0x0
3582 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3583 ; GFX12-NEXT: s_wait_kmcnt 0x0
3584 ; GFX12-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
3585 ; GFX12-NEXT: s_mov_b32 s0, 0
3586 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
3587 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v1
3588 ; GFX12-NEXT: v_and_b32_e32 v1, 3, v1
3589 ; GFX12-NEXT: ds_load_b32 v3, v0
3590 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3591 ; GFX12-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
3592 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3593 ; GFX12-NEXT: v_not_b32_e32 v2, v2
3594 ; GFX12-NEXT: .LBB17_1: ; %atomicrmw.start
3595 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3596 ; GFX12-NEXT: s_wait_dscnt 0x0
3597 ; GFX12-NEXT: v_lshrrev_b32_e32 v4, v1, v3
3598 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3599 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v4
3600 ; GFX12-NEXT: v_min_num_f32_e32 v4, 4.0, v4
3601 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
3602 ; GFX12-NEXT: v_bfe_u32 v5, v4, 16, 1
3603 ; GFX12-NEXT: v_or_b32_e32 v6, 0x400000, v4
3604 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v4, v4
3605 ; GFX12-NEXT: v_add3_u32 v5, v5, v4, 0x7fff
3606 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3607 ; GFX12-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc_lo
3608 ; GFX12-NEXT: v_lshrrev_b32_e32 v4, 16, v4
3609 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3610 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, v1, v4
3611 ; GFX12-NEXT: v_and_or_b32 v4, v3, v2, v4
3612 ; GFX12-NEXT: global_wb scope:SCOPE_SE
3613 ; GFX12-NEXT: s_wait_storecnt 0x0
3614 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v4, v0, v4, v3
3615 ; GFX12-NEXT: s_wait_dscnt 0x0
3616 ; GFX12-NEXT: global_inv scope:SCOPE_SE
3617 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
3618 ; GFX12-NEXT: v_mov_b32_e32 v3, v4
3619 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3620 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3621 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3622 ; GFX12-NEXT: s_cbranch_execnz .LBB17_1
3623 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3624 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3625 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3627 ; GFX940-LABEL: local_atomic_fmin_noret_bf16__offset:
3629 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3630 ; GFX940-NEXT: v_add_u32_e32 v1, 0xfffe, v0
3631 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v1
3632 ; GFX940-NEXT: ds_read_b32 v3, v0
3633 ; GFX940-NEXT: v_and_b32_e32 v1, 3, v1
3634 ; GFX940-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3635 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
3636 ; GFX940-NEXT: v_lshlrev_b32_e64 v2, v1, s0
3637 ; GFX940-NEXT: v_not_b32_e32 v2, v2
3638 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
3639 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
3640 ; GFX940-NEXT: .LBB17_1: ; %atomicrmw.start
3641 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
3642 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
3643 ; GFX940-NEXT: v_lshrrev_b32_sdwa v4, v1, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3644 ; GFX940-NEXT: s_nop 0
3645 ; GFX940-NEXT: v_min_f32_e32 v4, 4.0, v4
3646 ; GFX940-NEXT: v_bfe_u32 v5, v4, 16, 1
3647 ; GFX940-NEXT: v_or_b32_e32 v6, 0x400000, v4
3648 ; GFX940-NEXT: v_add3_u32 v5, v5, v4, s2
3649 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
3650 ; GFX940-NEXT: s_nop 1
3651 ; GFX940-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc
3652 ; GFX940-NEXT: v_lshlrev_b32_sdwa v4, v1, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3653 ; GFX940-NEXT: v_and_or_b32 v4, v3, v2, v4
3654 ; GFX940-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
3655 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
3656 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3657 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
3658 ; GFX940-NEXT: v_mov_b32_e32 v3, v4
3659 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
3660 ; GFX940-NEXT: s_cbranch_execnz .LBB17_1
3661 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
3662 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
3663 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3665 ; GFX11-LABEL: local_atomic_fmin_noret_bf16__offset:
3667 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3668 ; GFX11-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
3669 ; GFX11-NEXT: s_mov_b32 s0, 0
3670 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
3671 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v1
3672 ; GFX11-NEXT: v_and_b32_e32 v1, 3, v1
3673 ; GFX11-NEXT: ds_load_b32 v3, v0
3674 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3675 ; GFX11-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
3676 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
3677 ; GFX11-NEXT: v_not_b32_e32 v2, v2
3678 ; GFX11-NEXT: .p2align 6
3679 ; GFX11-NEXT: .LBB17_1: ; %atomicrmw.start
3680 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
3681 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
3682 ; GFX11-NEXT: v_lshrrev_b32_e32 v4, v1, v3
3683 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3684 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v4
3685 ; GFX11-NEXT: v_min_f32_e32 v4, 4.0, v4
3686 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
3687 ; GFX11-NEXT: v_bfe_u32 v5, v4, 16, 1
3688 ; GFX11-NEXT: v_or_b32_e32 v6, 0x400000, v4
3689 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v4, v4
3690 ; GFX11-NEXT: v_add3_u32 v5, v5, v4, 0x7fff
3691 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3692 ; GFX11-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc_lo
3693 ; GFX11-NEXT: v_lshrrev_b32_e32 v4, 16, v4
3694 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3695 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, v1, v4
3696 ; GFX11-NEXT: v_and_or_b32 v4, v3, v2, v4
3697 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3698 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v4, v0, v4, v3
3699 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
3700 ; GFX11-NEXT: buffer_gl0_inv
3701 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
3702 ; GFX11-NEXT: v_mov_b32_e32 v3, v4
3703 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3704 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3705 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3706 ; GFX11-NEXT: s_cbranch_execnz .LBB17_1
3707 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3708 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3709 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3711 ; GFX10-LABEL: local_atomic_fmin_noret_bf16__offset:
3713 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3714 ; GFX10-NEXT: v_add_nc_u32_e32 v1, 0xfffe, v0
3715 ; GFX10-NEXT: s_mov_b32 s4, 0
3716 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v1
3717 ; GFX10-NEXT: v_and_b32_e32 v1, 3, v1
3718 ; GFX10-NEXT: ds_read_b32 v3, v0
3719 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3720 ; GFX10-NEXT: v_lshlrev_b32_e64 v2, v1, 0xffff
3721 ; GFX10-NEXT: v_not_b32_e32 v2, v2
3722 ; GFX10-NEXT: .LBB17_1: ; %atomicrmw.start
3723 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
3724 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
3725 ; GFX10-NEXT: v_lshrrev_b32_sdwa v4, v1, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3726 ; GFX10-NEXT: v_min_f32_e32 v4, 4.0, v4
3727 ; GFX10-NEXT: v_bfe_u32 v5, v4, 16, 1
3728 ; GFX10-NEXT: v_or_b32_e32 v6, 0x400000, v4
3729 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v4, v4
3730 ; GFX10-NEXT: v_add3_u32 v5, v5, v4, 0x7fff
3731 ; GFX10-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc_lo
3732 ; GFX10-NEXT: v_lshlrev_b32_sdwa v4, v1, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3733 ; GFX10-NEXT: v_and_or_b32 v4, v3, v2, v4
3734 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3735 ; GFX10-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
3736 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
3737 ; GFX10-NEXT: buffer_gl0_inv
3738 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
3739 ; GFX10-NEXT: v_mov_b32_e32 v3, v4
3740 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
3741 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
3742 ; GFX10-NEXT: s_cbranch_execnz .LBB17_1
3743 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
3744 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
3745 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3747 ; GFX90A-LABEL: local_atomic_fmin_noret_bf16__offset:
3749 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3750 ; GFX90A-NEXT: v_add_u32_e32 v1, 0xfffe, v0
3751 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v1
3752 ; GFX90A-NEXT: ds_read_b32 v3, v0
3753 ; GFX90A-NEXT: v_and_b32_e32 v1, 3, v1
3754 ; GFX90A-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3755 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
3756 ; GFX90A-NEXT: v_lshlrev_b32_e64 v2, v1, s4
3757 ; GFX90A-NEXT: v_not_b32_e32 v2, v2
3758 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
3759 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
3760 ; GFX90A-NEXT: .LBB17_1: ; %atomicrmw.start
3761 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
3762 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
3763 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v4, v1, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3764 ; GFX90A-NEXT: v_min_f32_e32 v4, 4.0, v4
3765 ; GFX90A-NEXT: v_bfe_u32 v5, v4, 16, 1
3766 ; GFX90A-NEXT: v_or_b32_e32 v6, 0x400000, v4
3767 ; GFX90A-NEXT: v_add3_u32 v5, v5, v4, s6
3768 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
3769 ; GFX90A-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc
3770 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v4, v1, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3771 ; GFX90A-NEXT: v_and_or_b32 v4, v3, v2, v4
3772 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
3773 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
3774 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3775 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3776 ; GFX90A-NEXT: v_mov_b32_e32 v3, v4
3777 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
3778 ; GFX90A-NEXT: s_cbranch_execnz .LBB17_1
3779 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
3780 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3781 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3783 ; GFX908-LABEL: local_atomic_fmin_noret_bf16__offset:
3785 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3786 ; GFX908-NEXT: v_add_u32_e32 v1, 0xfffe, v0
3787 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v1
3788 ; GFX908-NEXT: ds_read_b32 v3, v0
3789 ; GFX908-NEXT: v_and_b32_e32 v1, 3, v1
3790 ; GFX908-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3791 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
3792 ; GFX908-NEXT: v_lshlrev_b32_e64 v2, v1, s4
3793 ; GFX908-NEXT: v_not_b32_e32 v2, v2
3794 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3795 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
3796 ; GFX908-NEXT: .LBB17_1: ; %atomicrmw.start
3797 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3798 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
3799 ; GFX908-NEXT: v_lshrrev_b32_sdwa v4, v1, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3800 ; GFX908-NEXT: v_min_f32_e32 v4, 4.0, v4
3801 ; GFX908-NEXT: v_bfe_u32 v5, v4, 16, 1
3802 ; GFX908-NEXT: v_or_b32_e32 v6, 0x400000, v4
3803 ; GFX908-NEXT: v_add3_u32 v5, v5, v4, s6
3804 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
3805 ; GFX908-NEXT: v_cndmask_b32_e32 v4, v5, v6, vcc
3806 ; GFX908-NEXT: v_lshlrev_b32_sdwa v4, v1, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3807 ; GFX908-NEXT: v_and_or_b32 v4, v3, v2, v4
3808 ; GFX908-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
3809 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
3810 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3811 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3812 ; GFX908-NEXT: v_mov_b32_e32 v3, v4
3813 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3814 ; GFX908-NEXT: s_cbranch_execnz .LBB17_1
3815 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3816 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3817 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3819 ; GFX8-LABEL: local_atomic_fmin_noret_bf16__offset:
3821 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3822 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, 0xfffe, v0
3823 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v1
3824 ; GFX8-NEXT: s_mov_b32 m0, -1
3825 ; GFX8-NEXT: ds_read_b32 v3, v0
3826 ; GFX8-NEXT: v_and_b32_e32 v1, 3, v1
3827 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3828 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
3829 ; GFX8-NEXT: v_lshlrev_b32_e64 v2, v1, s4
3830 ; GFX8-NEXT: v_not_b32_e32 v2, v2
3831 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3832 ; GFX8-NEXT: .LBB17_1: ; %atomicrmw.start
3833 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3834 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
3835 ; GFX8-NEXT: v_lshrrev_b32_sdwa v4, v1, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
3836 ; GFX8-NEXT: v_min_f32_e32 v4, 4.0, v4
3837 ; GFX8-NEXT: v_bfe_u32 v6, v4, 16, 1
3838 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v4
3839 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
3840 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v4
3841 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
3842 ; GFX8-NEXT: v_cndmask_b32_e32 v4, v6, v7, vcc
3843 ; GFX8-NEXT: v_and_b32_e32 v5, v3, v2
3844 ; GFX8-NEXT: v_lshlrev_b32_sdwa v4, v1, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
3845 ; GFX8-NEXT: v_or_b32_e32 v4, v5, v4
3846 ; GFX8-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
3847 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
3848 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3849 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3850 ; GFX8-NEXT: v_mov_b32_e32 v3, v4
3851 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3852 ; GFX8-NEXT: s_cbranch_execnz .LBB17_1
3853 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3854 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3855 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3857 ; GFX7-LABEL: local_atomic_fmin_noret_bf16__offset:
3859 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3860 ; GFX7-NEXT: v_add_i32_e32 v1, vcc, 0xfffe, v0
3861 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v1
3862 ; GFX7-NEXT: s_mov_b32 m0, -1
3863 ; GFX7-NEXT: ds_read_b32 v3, v0
3864 ; GFX7-NEXT: v_and_b32_e32 v1, 3, v1
3865 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3866 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v1
3867 ; GFX7-NEXT: v_not_b32_e32 v2, v2
3868 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
3869 ; GFX7-NEXT: .LBB17_1: ; %atomicrmw.start
3870 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
3871 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3872 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, v1, v3
3873 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v4
3874 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
3875 ; GFX7-NEXT: v_min_f32_e32 v4, 4.0, v4
3876 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
3877 ; GFX7-NEXT: v_and_b32_e32 v5, v3, v2
3878 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, v1, v4
3879 ; GFX7-NEXT: v_or_b32_e32 v4, v5, v4
3880 ; GFX7-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
3881 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3882 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3883 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3884 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
3885 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
3886 ; GFX7-NEXT: s_cbranch_execnz .LBB17_1
3887 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
3888 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
3889 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3891 ; GFX6-LABEL: local_atomic_fmin_noret_bf16__offset:
3893 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3894 ; GFX6-NEXT: v_add_i32_e32 v1, vcc, 0xfffe, v0
3895 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v1
3896 ; GFX6-NEXT: s_mov_b32 m0, -1
3897 ; GFX6-NEXT: ds_read_b32 v3, v0
3898 ; GFX6-NEXT: v_and_b32_e32 v1, 3, v1
3899 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 3, v1
3900 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v1
3901 ; GFX6-NEXT: v_not_b32_e32 v2, v2
3902 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
3903 ; GFX6-NEXT: .LBB17_1: ; %atomicrmw.start
3904 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
3905 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3906 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, v1, v3
3907 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v4
3908 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v4
3909 ; GFX6-NEXT: v_min_f32_e32 v4, 4.0, v4
3910 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v4
3911 ; GFX6-NEXT: v_and_b32_e32 v5, v3, v2
3912 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, v1, v4
3913 ; GFX6-NEXT: v_or_b32_e32 v4, v5, v4
3914 ; GFX6-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
3915 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3916 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
3917 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3918 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
3919 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
3920 ; GFX6-NEXT: s_cbranch_execnz .LBB17_1
3921 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
3922 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
3923 ; GFX6-NEXT: s_setpc_b64 s[30:31]
3924 %gep = getelementptr bfloat, ptr addrspace(3) %ptr, i32 32767
3925 %unused = atomicrmw fmin ptr addrspace(3) %gep, bfloat 4.0 seq_cst
3929 define bfloat @local_atomic_fmin_ret_bf16__offset__align4(ptr addrspace(3) %ptr) nounwind {
3930 ; GFX12-LABEL: local_atomic_fmin_ret_bf16__offset__align4:
3932 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3933 ; GFX12-NEXT: s_wait_expcnt 0x0
3934 ; GFX12-NEXT: s_wait_samplecnt 0x0
3935 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3936 ; GFX12-NEXT: s_wait_kmcnt 0x0
3937 ; GFX12-NEXT: ds_load_b32 v1, v0 offset:65534
3938 ; GFX12-NEXT: s_mov_b32 s0, 0
3939 ; GFX12-NEXT: .LBB18_1: ; %atomicrmw.start
3940 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3941 ; GFX12-NEXT: s_wait_dscnt 0x0
3942 ; GFX12-NEXT: v_mov_b32_e32 v2, v1
3943 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3944 ; GFX12-NEXT: v_lshlrev_b32_e32 v1, 16, v2
3945 ; GFX12-NEXT: v_min_num_f32_e32 v1, 4.0, v1
3946 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
3947 ; GFX12-NEXT: v_bfe_u32 v3, v1, 16, 1
3948 ; GFX12-NEXT: v_or_b32_e32 v4, 0x400000, v1
3949 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v1, v1
3950 ; GFX12-NEXT: v_add3_u32 v3, v3, v1, 0x7fff
3951 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3952 ; GFX12-NEXT: v_cndmask_b32_e32 v1, v3, v4, vcc_lo
3953 ; GFX12-NEXT: v_lshrrev_b32_e32 v1, 16, v1
3954 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3955 ; GFX12-NEXT: v_and_or_b32 v1, 0xffff0000, v2, v1
3956 ; GFX12-NEXT: global_wb scope:SCOPE_SE
3957 ; GFX12-NEXT: s_wait_storecnt 0x0
3958 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:65534
3959 ; GFX12-NEXT: s_wait_dscnt 0x0
3960 ; GFX12-NEXT: global_inv scope:SCOPE_SE
3961 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v1, v2
3962 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3963 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3964 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3965 ; GFX12-NEXT: s_cbranch_execnz .LBB18_1
3966 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3967 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3968 ; GFX12-NEXT: v_mov_b32_e32 v0, v1
3969 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3971 ; GFX940-LABEL: local_atomic_fmin_ret_bf16__offset__align4:
3973 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3974 ; GFX940-NEXT: ds_read_b32 v1, v0 offset:65534
3975 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
3976 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
3977 ; GFX940-NEXT: s_mov_b32 s3, 0xffff0000
3978 ; GFX940-NEXT: .LBB18_1: ; %atomicrmw.start
3979 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
3980 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
3981 ; GFX940-NEXT: v_mov_b32_e32 v2, v1
3982 ; GFX940-NEXT: v_lshlrev_b32_e32 v1, 16, v2
3983 ; GFX940-NEXT: v_min_f32_e32 v1, 4.0, v1
3984 ; GFX940-NEXT: v_bfe_u32 v3, v1, 16, 1
3985 ; GFX940-NEXT: v_or_b32_e32 v4, 0x400000, v1
3986 ; GFX940-NEXT: v_add3_u32 v3, v3, v1, s2
3987 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v1, v1
3988 ; GFX940-NEXT: s_nop 1
3989 ; GFX940-NEXT: v_cndmask_b32_e32 v1, v3, v4, vcc
3990 ; GFX940-NEXT: v_lshrrev_b32_e32 v1, 16, v1
3991 ; GFX940-NEXT: v_and_or_b32 v1, v2, s3, v1
3992 ; GFX940-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
3993 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
3994 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
3995 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
3996 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
3997 ; GFX940-NEXT: s_cbranch_execnz .LBB18_1
3998 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
3999 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
4000 ; GFX940-NEXT: v_mov_b32_e32 v0, v1
4001 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4003 ; GFX11-LABEL: local_atomic_fmin_ret_bf16__offset__align4:
4005 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4006 ; GFX11-NEXT: ds_load_b32 v1, v0 offset:65534
4007 ; GFX11-NEXT: s_mov_b32 s0, 0
4008 ; GFX11-NEXT: .p2align 6
4009 ; GFX11-NEXT: .LBB18_1: ; %atomicrmw.start
4010 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
4011 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4012 ; GFX11-NEXT: v_mov_b32_e32 v2, v1
4013 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4014 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 16, v2
4015 ; GFX11-NEXT: v_min_f32_e32 v1, 4.0, v1
4016 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
4017 ; GFX11-NEXT: v_bfe_u32 v3, v1, 16, 1
4018 ; GFX11-NEXT: v_or_b32_e32 v4, 0x400000, v1
4019 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v1, v1
4020 ; GFX11-NEXT: v_add3_u32 v3, v3, v1, 0x7fff
4021 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4022 ; GFX11-NEXT: v_cndmask_b32_e32 v1, v3, v4, vcc_lo
4023 ; GFX11-NEXT: v_lshrrev_b32_e32 v1, 16, v1
4024 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
4025 ; GFX11-NEXT: v_and_or_b32 v1, 0xffff0000, v2, v1
4026 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4027 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:65534
4028 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4029 ; GFX11-NEXT: buffer_gl0_inv
4030 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v1, v2
4031 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
4032 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4033 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4034 ; GFX11-NEXT: s_cbranch_execnz .LBB18_1
4035 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
4036 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
4037 ; GFX11-NEXT: v_mov_b32_e32 v0, v1
4038 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4040 ; GFX10-LABEL: local_atomic_fmin_ret_bf16__offset__align4:
4042 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4043 ; GFX10-NEXT: ds_read_b32 v1, v0 offset:65534
4044 ; GFX10-NEXT: s_mov_b32 s4, 0
4045 ; GFX10-NEXT: .LBB18_1: ; %atomicrmw.start
4046 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4047 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
4048 ; GFX10-NEXT: v_mov_b32_e32 v2, v1
4049 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 16, v2
4050 ; GFX10-NEXT: v_min_f32_e32 v1, 4.0, v1
4051 ; GFX10-NEXT: v_bfe_u32 v3, v1, 16, 1
4052 ; GFX10-NEXT: v_or_b32_e32 v4, 0x400000, v1
4053 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v1, v1
4054 ; GFX10-NEXT: v_add3_u32 v3, v3, v1, 0x7fff
4055 ; GFX10-NEXT: v_cndmask_b32_e32 v1, v3, v4, vcc_lo
4056 ; GFX10-NEXT: v_lshrrev_b32_e32 v1, 16, v1
4057 ; GFX10-NEXT: v_and_or_b32 v1, 0xffff0000, v2, v1
4058 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4059 ; GFX10-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
4060 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
4061 ; GFX10-NEXT: buffer_gl0_inv
4062 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v1, v2
4063 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4064 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4065 ; GFX10-NEXT: s_cbranch_execnz .LBB18_1
4066 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4067 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4068 ; GFX10-NEXT: v_mov_b32_e32 v0, v1
4069 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4071 ; GFX90A-LABEL: local_atomic_fmin_ret_bf16__offset__align4:
4073 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4074 ; GFX90A-NEXT: ds_read_b32 v1, v0 offset:65534
4075 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
4076 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
4077 ; GFX90A-NEXT: s_mov_b32 s7, 0xffff0000
4078 ; GFX90A-NEXT: .LBB18_1: ; %atomicrmw.start
4079 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
4080 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4081 ; GFX90A-NEXT: v_mov_b32_e32 v2, v1
4082 ; GFX90A-NEXT: v_lshlrev_b32_e32 v1, 16, v2
4083 ; GFX90A-NEXT: v_min_f32_e32 v1, 4.0, v1
4084 ; GFX90A-NEXT: v_bfe_u32 v3, v1, 16, 1
4085 ; GFX90A-NEXT: v_or_b32_e32 v4, 0x400000, v1
4086 ; GFX90A-NEXT: v_add3_u32 v3, v3, v1, s6
4087 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v1, v1
4088 ; GFX90A-NEXT: v_cndmask_b32_e32 v1, v3, v4, vcc
4089 ; GFX90A-NEXT: v_lshrrev_b32_e32 v1, 16, v1
4090 ; GFX90A-NEXT: v_and_or_b32 v1, v2, s7, v1
4091 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
4092 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4093 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
4094 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4095 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
4096 ; GFX90A-NEXT: s_cbranch_execnz .LBB18_1
4097 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
4098 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4099 ; GFX90A-NEXT: v_mov_b32_e32 v0, v1
4100 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4102 ; GFX908-LABEL: local_atomic_fmin_ret_bf16__offset__align4:
4104 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4105 ; GFX908-NEXT: ds_read_b32 v1, v0 offset:65534
4106 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4107 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
4108 ; GFX908-NEXT: s_mov_b32 s7, 0xffff0000
4109 ; GFX908-NEXT: .LBB18_1: ; %atomicrmw.start
4110 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4111 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
4112 ; GFX908-NEXT: v_mov_b32_e32 v2, v1
4113 ; GFX908-NEXT: v_lshlrev_b32_e32 v1, 16, v2
4114 ; GFX908-NEXT: v_min_f32_e32 v1, 4.0, v1
4115 ; GFX908-NEXT: v_bfe_u32 v3, v1, 16, 1
4116 ; GFX908-NEXT: v_or_b32_e32 v4, 0x400000, v1
4117 ; GFX908-NEXT: v_add3_u32 v3, v3, v1, s6
4118 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v1, v1
4119 ; GFX908-NEXT: v_cndmask_b32_e32 v1, v3, v4, vcc
4120 ; GFX908-NEXT: v_lshrrev_b32_e32 v1, 16, v1
4121 ; GFX908-NEXT: v_and_or_b32 v1, v2, s7, v1
4122 ; GFX908-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
4123 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
4124 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
4125 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4126 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4127 ; GFX908-NEXT: s_cbranch_execnz .LBB18_1
4128 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4129 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4130 ; GFX908-NEXT: v_mov_b32_e32 v0, v1
4131 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4133 ; GFX8-LABEL: local_atomic_fmin_ret_bf16__offset__align4:
4135 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4136 ; GFX8-NEXT: s_mov_b32 m0, -1
4137 ; GFX8-NEXT: ds_read_b32 v1, v0 offset:65534
4138 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4139 ; GFX8-NEXT: .LBB18_1: ; %atomicrmw.start
4140 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4141 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
4142 ; GFX8-NEXT: v_mov_b32_e32 v2, v1
4143 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 16, v2
4144 ; GFX8-NEXT: v_min_f32_e32 v1, 4.0, v1
4145 ; GFX8-NEXT: v_bfe_u32 v4, v1, 16, 1
4146 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, v4, v1
4147 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7fff, v4
4148 ; GFX8-NEXT: v_or_b32_e32 v5, 0x400000, v1
4149 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v1, v1
4150 ; GFX8-NEXT: v_and_b32_e32 v3, 0xffff0000, v2
4151 ; GFX8-NEXT: v_cndmask_b32_e32 v1, v4, v5, vcc
4152 ; GFX8-NEXT: v_or_b32_sdwa v1, v3, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
4153 ; GFX8-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
4154 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
4155 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
4156 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4157 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4158 ; GFX8-NEXT: s_cbranch_execnz .LBB18_1
4159 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4160 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4161 ; GFX8-NEXT: v_mov_b32_e32 v0, v1
4162 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4164 ; GFX7-LABEL: local_atomic_fmin_ret_bf16__offset__align4:
4166 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4167 ; GFX7-NEXT: s_mov_b32 m0, -1
4168 ; GFX7-NEXT: ds_read_b32 v1, v0 offset:65534
4169 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
4170 ; GFX7-NEXT: .LBB18_1: ; %atomicrmw.start
4171 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4172 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4173 ; GFX7-NEXT: v_mov_b32_e32 v2, v1
4174 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 16, v2
4175 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v1
4176 ; GFX7-NEXT: v_min_f32_e32 v1, 4.0, v1
4177 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v2
4178 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
4179 ; GFX7-NEXT: v_or_b32_e32 v1, v3, v1
4180 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1 offset:65534
4181 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4182 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
4183 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4184 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
4185 ; GFX7-NEXT: s_cbranch_execnz .LBB18_1
4186 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4187 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
4188 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v1
4189 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4191 ; GFX6-LABEL: local_atomic_fmin_ret_bf16__offset__align4:
4193 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4194 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffe, v0
4195 ; GFX6-NEXT: s_mov_b32 m0, -1
4196 ; GFX6-NEXT: ds_read_b32 v1, v0
4197 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
4198 ; GFX6-NEXT: .LBB18_1: ; %atomicrmw.start
4199 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
4200 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4201 ; GFX6-NEXT: v_mov_b32_e32 v2, v1
4202 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 16, v2
4203 ; GFX6-NEXT: v_mul_f32_e32 v1, 1.0, v1
4204 ; GFX6-NEXT: v_min_f32_e32 v1, 4.0, v1
4205 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v2
4206 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v1
4207 ; GFX6-NEXT: v_or_b32_e32 v1, v3, v1
4208 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v2, v1
4209 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4210 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v1, v2
4211 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4212 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
4213 ; GFX6-NEXT: s_cbranch_execnz .LBB18_1
4214 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
4215 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
4216 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v1
4217 ; GFX6-NEXT: s_setpc_b64 s[30:31]
4218 %gep = getelementptr bfloat, ptr addrspace(3) %ptr, i32 32767
4219 %result = atomicrmw fmin ptr addrspace(3) %gep, bfloat 4.0 seq_cst, align 4
4223 define void @local_atomic_fmin_noret_bf16__offset__align4(ptr addrspace(3) %ptr) nounwind {
4224 ; GFX12-LABEL: local_atomic_fmin_noret_bf16__offset__align4:
4226 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4227 ; GFX12-NEXT: s_wait_expcnt 0x0
4228 ; GFX12-NEXT: s_wait_samplecnt 0x0
4229 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4230 ; GFX12-NEXT: s_wait_kmcnt 0x0
4231 ; GFX12-NEXT: ds_load_b32 v1, v0 offset:65534
4232 ; GFX12-NEXT: s_mov_b32 s0, 0
4233 ; GFX12-NEXT: .LBB19_1: ; %atomicrmw.start
4234 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
4235 ; GFX12-NEXT: s_wait_dscnt 0x0
4236 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v1
4237 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4238 ; GFX12-NEXT: v_min_num_f32_e32 v2, 4.0, v2
4239 ; GFX12-NEXT: v_bfe_u32 v3, v2, 16, 1
4240 ; GFX12-NEXT: v_or_b32_e32 v4, 0x400000, v2
4241 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
4242 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
4243 ; GFX12-NEXT: v_add3_u32 v3, v3, v2, 0x7fff
4244 ; GFX12-NEXT: v_cndmask_b32_e32 v2, v3, v4, vcc_lo
4245 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4246 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, 16, v2
4247 ; GFX12-NEXT: v_and_or_b32 v2, 0xffff0000, v1, v2
4248 ; GFX12-NEXT: global_wb scope:SCOPE_SE
4249 ; GFX12-NEXT: s_wait_storecnt 0x0
4250 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v1 offset:65534
4251 ; GFX12-NEXT: s_wait_dscnt 0x0
4252 ; GFX12-NEXT: global_inv scope:SCOPE_SE
4253 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v1
4254 ; GFX12-NEXT: v_mov_b32_e32 v1, v2
4255 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
4256 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4257 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4258 ; GFX12-NEXT: s_cbranch_execnz .LBB19_1
4259 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
4260 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
4261 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4263 ; GFX940-LABEL: local_atomic_fmin_noret_bf16__offset__align4:
4265 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4266 ; GFX940-NEXT: ds_read_b32 v1, v0 offset:65534
4267 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
4268 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
4269 ; GFX940-NEXT: s_mov_b32 s3, 0xffff0000
4270 ; GFX940-NEXT: .LBB19_1: ; %atomicrmw.start
4271 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
4272 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
4273 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v1
4274 ; GFX940-NEXT: v_min_f32_e32 v2, 4.0, v2
4275 ; GFX940-NEXT: v_bfe_u32 v3, v2, 16, 1
4276 ; GFX940-NEXT: v_or_b32_e32 v4, 0x400000, v2
4277 ; GFX940-NEXT: v_add3_u32 v3, v3, v2, s2
4278 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
4279 ; GFX940-NEXT: s_nop 1
4280 ; GFX940-NEXT: v_cndmask_b32_e32 v2, v3, v4, vcc
4281 ; GFX940-NEXT: v_lshrrev_b32_e32 v2, 16, v2
4282 ; GFX940-NEXT: v_and_or_b32 v2, v1, s3, v2
4283 ; GFX940-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
4284 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
4285 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
4286 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
4287 ; GFX940-NEXT: v_mov_b32_e32 v1, v2
4288 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
4289 ; GFX940-NEXT: s_cbranch_execnz .LBB19_1
4290 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
4291 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
4292 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4294 ; GFX11-LABEL: local_atomic_fmin_noret_bf16__offset__align4:
4296 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4297 ; GFX11-NEXT: ds_load_b32 v1, v0 offset:65534
4298 ; GFX11-NEXT: s_mov_b32 s0, 0
4299 ; GFX11-NEXT: .p2align 6
4300 ; GFX11-NEXT: .LBB19_1: ; %atomicrmw.start
4301 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
4302 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4303 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v1
4304 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4305 ; GFX11-NEXT: v_min_f32_e32 v2, 4.0, v2
4306 ; GFX11-NEXT: v_bfe_u32 v3, v2, 16, 1
4307 ; GFX11-NEXT: v_or_b32_e32 v4, 0x400000, v2
4308 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
4309 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
4310 ; GFX11-NEXT: v_add3_u32 v3, v3, v2, 0x7fff
4311 ; GFX11-NEXT: v_cndmask_b32_e32 v2, v3, v4, vcc_lo
4312 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4313 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, 16, v2
4314 ; GFX11-NEXT: v_and_or_b32 v2, 0xffff0000, v1, v2
4315 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4316 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v1 offset:65534
4317 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4318 ; GFX11-NEXT: buffer_gl0_inv
4319 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v1
4320 ; GFX11-NEXT: v_mov_b32_e32 v1, v2
4321 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
4322 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4323 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4324 ; GFX11-NEXT: s_cbranch_execnz .LBB19_1
4325 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
4326 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
4327 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4329 ; GFX10-LABEL: local_atomic_fmin_noret_bf16__offset__align4:
4331 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4332 ; GFX10-NEXT: ds_read_b32 v1, v0 offset:65534
4333 ; GFX10-NEXT: s_mov_b32 s4, 0
4334 ; GFX10-NEXT: .LBB19_1: ; %atomicrmw.start
4335 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4336 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
4337 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v1
4338 ; GFX10-NEXT: v_min_f32_e32 v2, 4.0, v2
4339 ; GFX10-NEXT: v_bfe_u32 v3, v2, 16, 1
4340 ; GFX10-NEXT: v_or_b32_e32 v4, 0x400000, v2
4341 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
4342 ; GFX10-NEXT: v_add3_u32 v3, v3, v2, 0x7fff
4343 ; GFX10-NEXT: v_cndmask_b32_e32 v2, v3, v4, vcc_lo
4344 ; GFX10-NEXT: v_lshrrev_b32_e32 v2, 16, v2
4345 ; GFX10-NEXT: v_and_or_b32 v2, 0xffff0000, v1, v2
4346 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4347 ; GFX10-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
4348 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
4349 ; GFX10-NEXT: buffer_gl0_inv
4350 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v1
4351 ; GFX10-NEXT: v_mov_b32_e32 v1, v2
4352 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4353 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4354 ; GFX10-NEXT: s_cbranch_execnz .LBB19_1
4355 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4356 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4357 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4359 ; GFX90A-LABEL: local_atomic_fmin_noret_bf16__offset__align4:
4361 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4362 ; GFX90A-NEXT: ds_read_b32 v1, v0 offset:65534
4363 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
4364 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
4365 ; GFX90A-NEXT: s_mov_b32 s7, 0xffff0000
4366 ; GFX90A-NEXT: .LBB19_1: ; %atomicrmw.start
4367 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
4368 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4369 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v1
4370 ; GFX90A-NEXT: v_min_f32_e32 v2, 4.0, v2
4371 ; GFX90A-NEXT: v_bfe_u32 v3, v2, 16, 1
4372 ; GFX90A-NEXT: v_or_b32_e32 v4, 0x400000, v2
4373 ; GFX90A-NEXT: v_add3_u32 v3, v3, v2, s6
4374 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
4375 ; GFX90A-NEXT: v_cndmask_b32_e32 v2, v3, v4, vcc
4376 ; GFX90A-NEXT: v_lshrrev_b32_e32 v2, 16, v2
4377 ; GFX90A-NEXT: v_and_or_b32 v2, v1, s7, v2
4378 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
4379 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4380 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
4381 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4382 ; GFX90A-NEXT: v_mov_b32_e32 v1, v2
4383 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
4384 ; GFX90A-NEXT: s_cbranch_execnz .LBB19_1
4385 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
4386 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4387 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4389 ; GFX908-LABEL: local_atomic_fmin_noret_bf16__offset__align4:
4391 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4392 ; GFX908-NEXT: ds_read_b32 v1, v0 offset:65534
4393 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4394 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
4395 ; GFX908-NEXT: s_mov_b32 s7, 0xffff0000
4396 ; GFX908-NEXT: .LBB19_1: ; %atomicrmw.start
4397 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4398 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
4399 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v1
4400 ; GFX908-NEXT: v_min_f32_e32 v2, 4.0, v2
4401 ; GFX908-NEXT: v_bfe_u32 v3, v2, 16, 1
4402 ; GFX908-NEXT: v_or_b32_e32 v4, 0x400000, v2
4403 ; GFX908-NEXT: v_add3_u32 v3, v3, v2, s6
4404 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
4405 ; GFX908-NEXT: v_cndmask_b32_e32 v2, v3, v4, vcc
4406 ; GFX908-NEXT: v_lshrrev_b32_e32 v2, 16, v2
4407 ; GFX908-NEXT: v_and_or_b32 v2, v1, s7, v2
4408 ; GFX908-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
4409 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
4410 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
4411 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4412 ; GFX908-NEXT: v_mov_b32_e32 v1, v2
4413 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4414 ; GFX908-NEXT: s_cbranch_execnz .LBB19_1
4415 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4416 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4417 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4419 ; GFX8-LABEL: local_atomic_fmin_noret_bf16__offset__align4:
4421 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4422 ; GFX8-NEXT: s_mov_b32 m0, -1
4423 ; GFX8-NEXT: ds_read_b32 v1, v0 offset:65534
4424 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4425 ; GFX8-NEXT: .LBB19_1: ; %atomicrmw.start
4426 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4427 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
4428 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v1
4429 ; GFX8-NEXT: v_min_f32_e32 v2, 4.0, v2
4430 ; GFX8-NEXT: v_bfe_u32 v4, v2, 16, 1
4431 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, v4, v2
4432 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7fff, v4
4433 ; GFX8-NEXT: v_or_b32_e32 v5, 0x400000, v2
4434 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
4435 ; GFX8-NEXT: v_and_b32_e32 v3, 0xffff0000, v1
4436 ; GFX8-NEXT: v_cndmask_b32_e32 v2, v4, v5, vcc
4437 ; GFX8-NEXT: v_or_b32_sdwa v2, v3, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
4438 ; GFX8-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
4439 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
4440 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
4441 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4442 ; GFX8-NEXT: v_mov_b32_e32 v1, v2
4443 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4444 ; GFX8-NEXT: s_cbranch_execnz .LBB19_1
4445 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4446 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4447 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4449 ; GFX7-LABEL: local_atomic_fmin_noret_bf16__offset__align4:
4451 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4452 ; GFX7-NEXT: s_mov_b32 m0, -1
4453 ; GFX7-NEXT: ds_read_b32 v1, v0 offset:65534
4454 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
4455 ; GFX7-NEXT: .LBB19_1: ; %atomicrmw.start
4456 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4457 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4458 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v1
4459 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
4460 ; GFX7-NEXT: v_min_f32_e32 v2, 4.0, v2
4461 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v1
4462 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
4463 ; GFX7-NEXT: v_or_b32_e32 v2, v3, v2
4464 ; GFX7-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2 offset:65534
4465 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4466 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
4467 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4468 ; GFX7-NEXT: v_mov_b32_e32 v1, v2
4469 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
4470 ; GFX7-NEXT: s_cbranch_execnz .LBB19_1
4471 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4472 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
4473 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4475 ; GFX6-LABEL: local_atomic_fmin_noret_bf16__offset__align4:
4477 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4478 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffe, v0
4479 ; GFX6-NEXT: s_mov_b32 m0, -1
4480 ; GFX6-NEXT: ds_read_b32 v1, v0
4481 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
4482 ; GFX6-NEXT: .LBB19_1: ; %atomicrmw.start
4483 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
4484 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4485 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v1
4486 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
4487 ; GFX6-NEXT: v_min_f32_e32 v2, 4.0, v2
4488 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v1
4489 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
4490 ; GFX6-NEXT: v_or_b32_e32 v2, v3, v2
4491 ; GFX6-NEXT: ds_cmpst_rtn_b32 v2, v0, v1, v2
4492 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4493 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v2, v1
4494 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4495 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
4496 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
4497 ; GFX6-NEXT: s_cbranch_execnz .LBB19_1
4498 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
4499 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
4500 ; GFX6-NEXT: s_setpc_b64 s[30:31]
4501 %gep = getelementptr bfloat, ptr addrspace(3) %ptr, i32 32767
4502 %unused = atomicrmw fmin ptr addrspace(3) %gep, bfloat 4.0 seq_cst, align 4
4506 ; --------------------------------------------------------------------
4508 ; --------------------------------------------------------------------
4510 define <2 x half> @local_atomic_fmin_ret_v2f16(ptr addrspace(3) %ptr, <2 x half> %val) {
4511 ; GFX12-LABEL: local_atomic_fmin_ret_v2f16:
4513 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4514 ; GFX12-NEXT: s_wait_expcnt 0x0
4515 ; GFX12-NEXT: s_wait_samplecnt 0x0
4516 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4517 ; GFX12-NEXT: s_wait_kmcnt 0x0
4518 ; GFX12-NEXT: ds_load_b32 v2, v0
4519 ; GFX12-NEXT: v_pk_max_num_f16 v1, v1, v1
4520 ; GFX12-NEXT: s_mov_b32 s0, 0
4521 ; GFX12-NEXT: .LBB20_1: ; %atomicrmw.start
4522 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
4523 ; GFX12-NEXT: s_wait_dscnt 0x0
4524 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
4525 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4526 ; GFX12-NEXT: v_pk_max_num_f16 v2, v3, v3
4527 ; GFX12-NEXT: v_pk_min_num_f16 v2, v2, v1
4528 ; GFX12-NEXT: global_wb scope:SCOPE_SE
4529 ; GFX12-NEXT: s_wait_storecnt 0x0
4530 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v3
4531 ; GFX12-NEXT: s_wait_dscnt 0x0
4532 ; GFX12-NEXT: global_inv scope:SCOPE_SE
4533 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
4534 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
4535 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4536 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4537 ; GFX12-NEXT: s_cbranch_execnz .LBB20_1
4538 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
4539 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
4540 ; GFX12-NEXT: v_mov_b32_e32 v0, v2
4541 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4543 ; GFX940-LABEL: local_atomic_fmin_ret_v2f16:
4545 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4546 ; GFX940-NEXT: ds_read_b32 v2, v0
4547 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
4548 ; GFX940-NEXT: v_pk_max_f16 v1, v1, v1
4549 ; GFX940-NEXT: .LBB20_1: ; %atomicrmw.start
4550 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
4551 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
4552 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
4553 ; GFX940-NEXT: v_pk_max_f16 v2, v3, v3
4554 ; GFX940-NEXT: s_nop 0
4555 ; GFX940-NEXT: v_pk_min_f16 v2, v2, v1
4556 ; GFX940-NEXT: ds_cmpst_rtn_b32 v2, v0, v3, v2
4557 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
4558 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
4559 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
4560 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
4561 ; GFX940-NEXT: s_cbranch_execnz .LBB20_1
4562 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
4563 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
4564 ; GFX940-NEXT: v_mov_b32_e32 v0, v2
4565 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4567 ; GFX11-LABEL: local_atomic_fmin_ret_v2f16:
4569 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4570 ; GFX11-NEXT: ds_load_b32 v2, v0
4571 ; GFX11-NEXT: v_pk_max_f16 v1, v1, v1
4572 ; GFX11-NEXT: s_mov_b32 s0, 0
4573 ; GFX11-NEXT: .LBB20_1: ; %atomicrmw.start
4574 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
4575 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4576 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
4577 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4578 ; GFX11-NEXT: v_pk_max_f16 v2, v3, v3
4579 ; GFX11-NEXT: v_pk_min_f16 v2, v2, v1
4580 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4581 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v3
4582 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4583 ; GFX11-NEXT: buffer_gl0_inv
4584 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
4585 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
4586 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4587 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4588 ; GFX11-NEXT: s_cbranch_execnz .LBB20_1
4589 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
4590 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
4591 ; GFX11-NEXT: v_mov_b32_e32 v0, v2
4592 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4594 ; GFX10-LABEL: local_atomic_fmin_ret_v2f16:
4596 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4597 ; GFX10-NEXT: ds_read_b32 v2, v0
4598 ; GFX10-NEXT: v_pk_max_f16 v1, v1, v1
4599 ; GFX10-NEXT: s_mov_b32 s4, 0
4600 ; GFX10-NEXT: .LBB20_1: ; %atomicrmw.start
4601 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4602 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
4603 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
4604 ; GFX10-NEXT: v_pk_max_f16 v2, v3, v3
4605 ; GFX10-NEXT: v_pk_min_f16 v2, v2, v1
4606 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4607 ; GFX10-NEXT: ds_cmpst_rtn_b32 v2, v0, v3, v2
4608 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
4609 ; GFX10-NEXT: buffer_gl0_inv
4610 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
4611 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4612 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4613 ; GFX10-NEXT: s_cbranch_execnz .LBB20_1
4614 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4615 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4616 ; GFX10-NEXT: v_mov_b32_e32 v0, v2
4617 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4619 ; GFX90A-LABEL: local_atomic_fmin_ret_v2f16:
4621 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4622 ; GFX90A-NEXT: ds_read_b32 v2, v0
4623 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
4624 ; GFX90A-NEXT: v_pk_max_f16 v1, v1, v1
4625 ; GFX90A-NEXT: .LBB20_1: ; %atomicrmw.start
4626 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
4627 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4628 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
4629 ; GFX90A-NEXT: v_pk_max_f16 v2, v3, v3
4630 ; GFX90A-NEXT: v_pk_min_f16 v2, v2, v1
4631 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v2, v0, v3, v2
4632 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4633 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
4634 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4635 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
4636 ; GFX90A-NEXT: s_cbranch_execnz .LBB20_1
4637 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
4638 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4639 ; GFX90A-NEXT: v_mov_b32_e32 v0, v2
4640 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4642 ; GFX908-LABEL: local_atomic_fmin_ret_v2f16:
4644 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4645 ; GFX908-NEXT: ds_read_b32 v2, v0
4646 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4647 ; GFX908-NEXT: v_pk_max_f16 v1, v1, v1
4648 ; GFX908-NEXT: .LBB20_1: ; %atomicrmw.start
4649 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4650 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
4651 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
4652 ; GFX908-NEXT: v_pk_max_f16 v2, v3, v3
4653 ; GFX908-NEXT: v_pk_min_f16 v2, v2, v1
4654 ; GFX908-NEXT: ds_cmpst_rtn_b32 v2, v0, v3, v2
4655 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
4656 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
4657 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4658 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4659 ; GFX908-NEXT: s_cbranch_execnz .LBB20_1
4660 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4661 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4662 ; GFX908-NEXT: v_mov_b32_e32 v0, v2
4663 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4665 ; GFX8-LABEL: local_atomic_fmin_ret_v2f16:
4667 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4668 ; GFX8-NEXT: s_mov_b32 m0, -1
4669 ; GFX8-NEXT: ds_read_b32 v2, v0
4670 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4671 ; GFX8-NEXT: v_max_f16_sdwa v3, v1, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
4672 ; GFX8-NEXT: v_max_f16_e32 v1, v1, v1
4673 ; GFX8-NEXT: .LBB20_1: ; %atomicrmw.start
4674 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4675 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
4676 ; GFX8-NEXT: v_mov_b32_e32 v4, v2
4677 ; GFX8-NEXT: v_max_f16_sdwa v2, v4, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
4678 ; GFX8-NEXT: v_max_f16_e32 v5, v4, v4
4679 ; GFX8-NEXT: v_min_f16_sdwa v2, v2, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
4680 ; GFX8-NEXT: v_min_f16_e32 v5, v5, v1
4681 ; GFX8-NEXT: v_or_b32_e32 v2, v5, v2
4682 ; GFX8-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2
4683 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
4684 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
4685 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4686 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4687 ; GFX8-NEXT: s_cbranch_execnz .LBB20_1
4688 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4689 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4690 ; GFX8-NEXT: v_mov_b32_e32 v0, v2
4691 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4693 ; GFX7-LABEL: local_atomic_fmin_ret_v2f16:
4695 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4696 ; GFX7-NEXT: s_mov_b32 m0, -1
4697 ; GFX7-NEXT: ds_read_b32 v3, v0
4698 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v2
4699 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v1
4700 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
4701 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4702 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v3
4703 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v2
4704 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
4705 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v4
4706 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
4707 ; GFX7-NEXT: .LBB20_1: ; %atomicrmw.start
4708 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4709 ; GFX7-NEXT: v_cvt_f16_f32_e32 v1, v1
4710 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
4711 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v1
4712 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v2
4713 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 16, v1
4714 ; GFX7-NEXT: v_or_b32_e32 v7, v2, v1
4715 ; GFX7-NEXT: v_min_f32_e32 v5, v5, v3
4716 ; GFX7-NEXT: v_min_f32_e32 v6, v6, v4
4717 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
4718 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
4719 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 16, v5
4720 ; GFX7-NEXT: v_or_b32_e32 v1, v6, v1
4721 ; GFX7-NEXT: ds_cmpst_rtn_b32 v5, v0, v7, v1
4722 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4723 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v5
4724 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
4725 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
4726 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
4727 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4728 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
4729 ; GFX7-NEXT: s_cbranch_execnz .LBB20_1
4730 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4731 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
4732 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
4733 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4735 ; GFX6-LABEL: local_atomic_fmin_ret_v2f16:
4737 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4738 ; GFX6-NEXT: s_mov_b32 m0, -1
4739 ; GFX6-NEXT: ds_read_b32 v3, v0
4740 ; GFX6-NEXT: v_cvt_f16_f32_e32 v4, v2
4741 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v1
4742 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
4743 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4744 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v3
4745 ; GFX6-NEXT: v_cvt_f32_f16_e32 v1, v2
4746 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v3
4747 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v4
4748 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v5
4749 ; GFX6-NEXT: .LBB20_1: ; %atomicrmw.start
4750 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
4751 ; GFX6-NEXT: v_cvt_f16_f32_e32 v1, v1
4752 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
4753 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v1
4754 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v2
4755 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 16, v1
4756 ; GFX6-NEXT: v_or_b32_e32 v7, v2, v1
4757 ; GFX6-NEXT: v_min_f32_e32 v5, v5, v3
4758 ; GFX6-NEXT: v_min_f32_e32 v6, v6, v4
4759 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v5
4760 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v6
4761 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 16, v5
4762 ; GFX6-NEXT: v_or_b32_e32 v1, v6, v1
4763 ; GFX6-NEXT: ds_cmpst_rtn_b32 v5, v0, v7, v1
4764 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4765 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v5
4766 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v5
4767 ; GFX6-NEXT: v_cvt_f32_f16_e32 v1, v1
4768 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
4769 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4770 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
4771 ; GFX6-NEXT: s_cbranch_execnz .LBB20_1
4772 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
4773 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
4774 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
4775 ; GFX6-NEXT: s_setpc_b64 s[30:31]
4776 %gep = getelementptr <2 x half>, ptr addrspace(3) %ptr, i32 16383
4777 %result = atomicrmw fmin ptr addrspace(3) %ptr, <2 x half> %val seq_cst
4778 ret <2 x half> %result
4781 define <2 x half> @local_atomic_fmin_ret_v2f16__offset(ptr addrspace(3) %ptr, <2 x half> %val) {
4782 ; GFX12-LABEL: local_atomic_fmin_ret_v2f16__offset:
4784 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4785 ; GFX12-NEXT: s_wait_expcnt 0x0
4786 ; GFX12-NEXT: s_wait_samplecnt 0x0
4787 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4788 ; GFX12-NEXT: s_wait_kmcnt 0x0
4789 ; GFX12-NEXT: ds_load_b32 v2, v0 offset:65532
4790 ; GFX12-NEXT: v_pk_max_num_f16 v1, v1, v1
4791 ; GFX12-NEXT: s_mov_b32 s0, 0
4792 ; GFX12-NEXT: .LBB21_1: ; %atomicrmw.start
4793 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
4794 ; GFX12-NEXT: s_wait_dscnt 0x0
4795 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
4796 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4797 ; GFX12-NEXT: v_pk_max_num_f16 v2, v3, v3
4798 ; GFX12-NEXT: v_pk_min_num_f16 v2, v2, v1
4799 ; GFX12-NEXT: global_wb scope:SCOPE_SE
4800 ; GFX12-NEXT: s_wait_storecnt 0x0
4801 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v3 offset:65532
4802 ; GFX12-NEXT: s_wait_dscnt 0x0
4803 ; GFX12-NEXT: global_inv scope:SCOPE_SE
4804 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
4805 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
4806 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4807 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4808 ; GFX12-NEXT: s_cbranch_execnz .LBB21_1
4809 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
4810 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
4811 ; GFX12-NEXT: v_mov_b32_e32 v0, v2
4812 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4814 ; GFX940-LABEL: local_atomic_fmin_ret_v2f16__offset:
4816 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4817 ; GFX940-NEXT: ds_read_b32 v2, v0 offset:65532
4818 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
4819 ; GFX940-NEXT: v_pk_max_f16 v1, v1, v1
4820 ; GFX940-NEXT: .LBB21_1: ; %atomicrmw.start
4821 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
4822 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
4823 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
4824 ; GFX940-NEXT: v_pk_max_f16 v2, v3, v3
4825 ; GFX940-NEXT: s_nop 0
4826 ; GFX940-NEXT: v_pk_min_f16 v2, v2, v1
4827 ; GFX940-NEXT: ds_cmpst_rtn_b32 v2, v0, v3, v2 offset:65532
4828 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
4829 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
4830 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
4831 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
4832 ; GFX940-NEXT: s_cbranch_execnz .LBB21_1
4833 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
4834 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
4835 ; GFX940-NEXT: v_mov_b32_e32 v0, v2
4836 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4838 ; GFX11-LABEL: local_atomic_fmin_ret_v2f16__offset:
4840 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4841 ; GFX11-NEXT: ds_load_b32 v2, v0 offset:65532
4842 ; GFX11-NEXT: v_pk_max_f16 v1, v1, v1
4843 ; GFX11-NEXT: s_mov_b32 s0, 0
4844 ; GFX11-NEXT: .LBB21_1: ; %atomicrmw.start
4845 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
4846 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4847 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
4848 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4849 ; GFX11-NEXT: v_pk_max_f16 v2, v3, v3
4850 ; GFX11-NEXT: v_pk_min_f16 v2, v2, v1
4851 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4852 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v3 offset:65532
4853 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4854 ; GFX11-NEXT: buffer_gl0_inv
4855 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
4856 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
4857 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4858 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4859 ; GFX11-NEXT: s_cbranch_execnz .LBB21_1
4860 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
4861 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
4862 ; GFX11-NEXT: v_mov_b32_e32 v0, v2
4863 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4865 ; GFX10-LABEL: local_atomic_fmin_ret_v2f16__offset:
4867 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4868 ; GFX10-NEXT: ds_read_b32 v2, v0 offset:65532
4869 ; GFX10-NEXT: v_pk_max_f16 v1, v1, v1
4870 ; GFX10-NEXT: s_mov_b32 s4, 0
4871 ; GFX10-NEXT: .LBB21_1: ; %atomicrmw.start
4872 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4873 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
4874 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
4875 ; GFX10-NEXT: v_pk_max_f16 v2, v3, v3
4876 ; GFX10-NEXT: v_pk_min_f16 v2, v2, v1
4877 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4878 ; GFX10-NEXT: ds_cmpst_rtn_b32 v2, v0, v3, v2 offset:65532
4879 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
4880 ; GFX10-NEXT: buffer_gl0_inv
4881 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
4882 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4883 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4884 ; GFX10-NEXT: s_cbranch_execnz .LBB21_1
4885 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4886 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4887 ; GFX10-NEXT: v_mov_b32_e32 v0, v2
4888 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4890 ; GFX90A-LABEL: local_atomic_fmin_ret_v2f16__offset:
4892 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4893 ; GFX90A-NEXT: ds_read_b32 v2, v0 offset:65532
4894 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
4895 ; GFX90A-NEXT: v_pk_max_f16 v1, v1, v1
4896 ; GFX90A-NEXT: .LBB21_1: ; %atomicrmw.start
4897 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
4898 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4899 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
4900 ; GFX90A-NEXT: v_pk_max_f16 v2, v3, v3
4901 ; GFX90A-NEXT: v_pk_min_f16 v2, v2, v1
4902 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v2, v0, v3, v2 offset:65532
4903 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4904 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
4905 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4906 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
4907 ; GFX90A-NEXT: s_cbranch_execnz .LBB21_1
4908 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
4909 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4910 ; GFX90A-NEXT: v_mov_b32_e32 v0, v2
4911 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4913 ; GFX908-LABEL: local_atomic_fmin_ret_v2f16__offset:
4915 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4916 ; GFX908-NEXT: ds_read_b32 v2, v0 offset:65532
4917 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4918 ; GFX908-NEXT: v_pk_max_f16 v1, v1, v1
4919 ; GFX908-NEXT: .LBB21_1: ; %atomicrmw.start
4920 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4921 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
4922 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
4923 ; GFX908-NEXT: v_pk_max_f16 v2, v3, v3
4924 ; GFX908-NEXT: v_pk_min_f16 v2, v2, v1
4925 ; GFX908-NEXT: ds_cmpst_rtn_b32 v2, v0, v3, v2 offset:65532
4926 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
4927 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
4928 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4929 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4930 ; GFX908-NEXT: s_cbranch_execnz .LBB21_1
4931 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4932 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4933 ; GFX908-NEXT: v_mov_b32_e32 v0, v2
4934 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4936 ; GFX8-LABEL: local_atomic_fmin_ret_v2f16__offset:
4938 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4939 ; GFX8-NEXT: s_mov_b32 m0, -1
4940 ; GFX8-NEXT: ds_read_b32 v2, v0 offset:65532
4941 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4942 ; GFX8-NEXT: v_max_f16_sdwa v3, v1, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
4943 ; GFX8-NEXT: v_max_f16_e32 v1, v1, v1
4944 ; GFX8-NEXT: .LBB21_1: ; %atomicrmw.start
4945 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4946 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
4947 ; GFX8-NEXT: v_mov_b32_e32 v4, v2
4948 ; GFX8-NEXT: v_max_f16_sdwa v2, v4, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
4949 ; GFX8-NEXT: v_max_f16_e32 v5, v4, v4
4950 ; GFX8-NEXT: v_min_f16_sdwa v2, v2, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
4951 ; GFX8-NEXT: v_min_f16_e32 v5, v5, v1
4952 ; GFX8-NEXT: v_or_b32_e32 v2, v5, v2
4953 ; GFX8-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2 offset:65532
4954 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
4955 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
4956 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4957 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4958 ; GFX8-NEXT: s_cbranch_execnz .LBB21_1
4959 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4960 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4961 ; GFX8-NEXT: v_mov_b32_e32 v0, v2
4962 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4964 ; GFX7-LABEL: local_atomic_fmin_ret_v2f16__offset:
4966 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4967 ; GFX7-NEXT: s_mov_b32 m0, -1
4968 ; GFX7-NEXT: ds_read_b32 v3, v0 offset:65532
4969 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v2
4970 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v1
4971 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
4972 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4973 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v3
4974 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v2
4975 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
4976 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v4
4977 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
4978 ; GFX7-NEXT: .LBB21_1: ; %atomicrmw.start
4979 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4980 ; GFX7-NEXT: v_cvt_f16_f32_e32 v1, v1
4981 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
4982 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v1
4983 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v2
4984 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 16, v1
4985 ; GFX7-NEXT: v_or_b32_e32 v7, v2, v1
4986 ; GFX7-NEXT: v_min_f32_e32 v5, v5, v3
4987 ; GFX7-NEXT: v_min_f32_e32 v6, v6, v4
4988 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
4989 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
4990 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 16, v5
4991 ; GFX7-NEXT: v_or_b32_e32 v1, v6, v1
4992 ; GFX7-NEXT: ds_cmpst_rtn_b32 v5, v0, v7, v1 offset:65532
4993 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4994 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v5
4995 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
4996 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
4997 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
4998 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4999 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
5000 ; GFX7-NEXT: s_cbranch_execnz .LBB21_1
5001 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5002 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
5003 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
5004 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5006 ; GFX6-LABEL: local_atomic_fmin_ret_v2f16__offset:
5008 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5009 ; GFX6-NEXT: v_add_i32_e32 v3, vcc, 0xfffc, v0
5010 ; GFX6-NEXT: s_mov_b32 m0, -1
5011 ; GFX6-NEXT: ds_read_b32 v4, v3
5012 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
5013 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v1
5014 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
5015 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5016 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v4
5017 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v4
5018 ; GFX6-NEXT: v_cvt_f32_f16_e32 v1, v1
5019 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v2
5020 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v5
5021 ; GFX6-NEXT: .LBB21_1: ; %atomicrmw.start
5022 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
5023 ; GFX6-NEXT: v_cvt_f16_f32_e32 v1, v1
5024 ; GFX6-NEXT: v_cvt_f16_f32_e32 v0, v0
5025 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v1
5026 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v0
5027 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 16, v1
5028 ; GFX6-NEXT: v_or_b32_e32 v7, v0, v1
5029 ; GFX6-NEXT: v_min_f32_e32 v5, v5, v2
5030 ; GFX6-NEXT: v_min_f32_e32 v6, v6, v4
5031 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v5
5032 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v6
5033 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v5
5034 ; GFX6-NEXT: v_or_b32_e32 v0, v6, v0
5035 ; GFX6-NEXT: ds_cmpst_rtn_b32 v5, v3, v7, v0
5036 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5037 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v5
5038 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v5
5039 ; GFX6-NEXT: v_cvt_f32_f16_e32 v1, v1
5040 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
5041 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5042 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
5043 ; GFX6-NEXT: s_cbranch_execnz .LBB21_1
5044 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
5045 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
5046 ; GFX6-NEXT: s_setpc_b64 s[30:31]
5047 %gep = getelementptr <2 x half>, ptr addrspace(3) %ptr, i32 16383
5048 %result = atomicrmw fmin ptr addrspace(3) %gep, <2 x half> %val seq_cst
5049 ret <2 x half> %result
5052 define void @local_atomic_fmin_noret_v2f16(ptr addrspace(3) %ptr, <2 x half> %val) {
5053 ; GFX12-LABEL: local_atomic_fmin_noret_v2f16:
5055 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5056 ; GFX12-NEXT: s_wait_expcnt 0x0
5057 ; GFX12-NEXT: s_wait_samplecnt 0x0
5058 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5059 ; GFX12-NEXT: s_wait_kmcnt 0x0
5060 ; GFX12-NEXT: ds_load_b32 v2, v0
5061 ; GFX12-NEXT: v_pk_max_num_f16 v1, v1, v1
5062 ; GFX12-NEXT: s_mov_b32 s0, 0
5063 ; GFX12-NEXT: .LBB22_1: ; %atomicrmw.start
5064 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
5065 ; GFX12-NEXT: s_wait_dscnt 0x0
5066 ; GFX12-NEXT: v_pk_max_num_f16 v3, v2, v2
5067 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
5068 ; GFX12-NEXT: v_pk_min_num_f16 v3, v3, v1
5069 ; GFX12-NEXT: global_wb scope:SCOPE_SE
5070 ; GFX12-NEXT: s_wait_storecnt 0x0
5071 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v3, v0, v3, v2
5072 ; GFX12-NEXT: s_wait_dscnt 0x0
5073 ; GFX12-NEXT: global_inv scope:SCOPE_SE
5074 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v2
5075 ; GFX12-NEXT: v_mov_b32_e32 v2, v3
5076 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
5077 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5078 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5079 ; GFX12-NEXT: s_cbranch_execnz .LBB22_1
5080 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
5081 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
5082 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5084 ; GFX940-LABEL: local_atomic_fmin_noret_v2f16:
5086 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5087 ; GFX940-NEXT: ds_read_b32 v2, v0
5088 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
5089 ; GFX940-NEXT: v_pk_max_f16 v1, v1, v1
5090 ; GFX940-NEXT: .LBB22_1: ; %atomicrmw.start
5091 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
5092 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
5093 ; GFX940-NEXT: v_pk_max_f16 v3, v2, v2
5094 ; GFX940-NEXT: s_nop 0
5095 ; GFX940-NEXT: v_pk_min_f16 v3, v3, v1
5096 ; GFX940-NEXT: ds_cmpst_rtn_b32 v3, v0, v2, v3
5097 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
5098 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v2
5099 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
5100 ; GFX940-NEXT: v_mov_b32_e32 v2, v3
5101 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
5102 ; GFX940-NEXT: s_cbranch_execnz .LBB22_1
5103 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
5104 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
5105 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5107 ; GFX11-LABEL: local_atomic_fmin_noret_v2f16:
5109 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5110 ; GFX11-NEXT: ds_load_b32 v2, v0
5111 ; GFX11-NEXT: v_pk_max_f16 v1, v1, v1
5112 ; GFX11-NEXT: s_mov_b32 s0, 0
5113 ; GFX11-NEXT: .LBB22_1: ; %atomicrmw.start
5114 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
5115 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
5116 ; GFX11-NEXT: v_pk_max_f16 v3, v2, v2
5117 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
5118 ; GFX11-NEXT: v_pk_min_f16 v3, v3, v1
5119 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5120 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v3, v0, v3, v2
5121 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
5122 ; GFX11-NEXT: buffer_gl0_inv
5123 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v2
5124 ; GFX11-NEXT: v_mov_b32_e32 v2, v3
5125 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
5126 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5127 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5128 ; GFX11-NEXT: s_cbranch_execnz .LBB22_1
5129 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
5130 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
5131 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5133 ; GFX10-LABEL: local_atomic_fmin_noret_v2f16:
5135 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5136 ; GFX10-NEXT: ds_read_b32 v2, v0
5137 ; GFX10-NEXT: v_pk_max_f16 v1, v1, v1
5138 ; GFX10-NEXT: s_mov_b32 s4, 0
5139 ; GFX10-NEXT: .LBB22_1: ; %atomicrmw.start
5140 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5141 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
5142 ; GFX10-NEXT: v_pk_max_f16 v3, v2, v2
5143 ; GFX10-NEXT: v_pk_min_f16 v3, v3, v1
5144 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5145 ; GFX10-NEXT: ds_cmpst_rtn_b32 v3, v0, v2, v3
5146 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
5147 ; GFX10-NEXT: buffer_gl0_inv
5148 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v2
5149 ; GFX10-NEXT: v_mov_b32_e32 v2, v3
5150 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5151 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5152 ; GFX10-NEXT: s_cbranch_execnz .LBB22_1
5153 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5154 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5155 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5157 ; GFX90A-LABEL: local_atomic_fmin_noret_v2f16:
5159 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5160 ; GFX90A-NEXT: ds_read_b32 v2, v0
5161 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
5162 ; GFX90A-NEXT: v_pk_max_f16 v1, v1, v1
5163 ; GFX90A-NEXT: .LBB22_1: ; %atomicrmw.start
5164 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
5165 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5166 ; GFX90A-NEXT: v_pk_max_f16 v3, v2, v2
5167 ; GFX90A-NEXT: v_pk_min_f16 v3, v3, v1
5168 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v3, v0, v2, v3
5169 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5170 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v2
5171 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5172 ; GFX90A-NEXT: v_mov_b32_e32 v2, v3
5173 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
5174 ; GFX90A-NEXT: s_cbranch_execnz .LBB22_1
5175 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
5176 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5177 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5179 ; GFX908-LABEL: local_atomic_fmin_noret_v2f16:
5181 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5182 ; GFX908-NEXT: ds_read_b32 v2, v0
5183 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
5184 ; GFX908-NEXT: v_pk_max_f16 v1, v1, v1
5185 ; GFX908-NEXT: .LBB22_1: ; %atomicrmw.start
5186 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
5187 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
5188 ; GFX908-NEXT: v_pk_max_f16 v3, v2, v2
5189 ; GFX908-NEXT: v_pk_min_f16 v3, v3, v1
5190 ; GFX908-NEXT: ds_cmpst_rtn_b32 v3, v0, v2, v3
5191 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
5192 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v2
5193 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5194 ; GFX908-NEXT: v_mov_b32_e32 v2, v3
5195 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
5196 ; GFX908-NEXT: s_cbranch_execnz .LBB22_1
5197 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
5198 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5199 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5201 ; GFX8-LABEL: local_atomic_fmin_noret_v2f16:
5203 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5204 ; GFX8-NEXT: s_mov_b32 m0, -1
5205 ; GFX8-NEXT: ds_read_b32 v3, v0
5206 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5207 ; GFX8-NEXT: v_max_f16_sdwa v2, v1, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
5208 ; GFX8-NEXT: v_max_f16_e32 v1, v1, v1
5209 ; GFX8-NEXT: .LBB22_1: ; %atomicrmw.start
5210 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5211 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
5212 ; GFX8-NEXT: v_max_f16_sdwa v4, v3, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
5213 ; GFX8-NEXT: v_max_f16_e32 v5, v3, v3
5214 ; GFX8-NEXT: v_min_f16_sdwa v4, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
5215 ; GFX8-NEXT: v_min_f16_e32 v5, v5, v1
5216 ; GFX8-NEXT: v_or_b32_e32 v4, v5, v4
5217 ; GFX8-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
5218 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
5219 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
5220 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5221 ; GFX8-NEXT: v_mov_b32_e32 v3, v4
5222 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5223 ; GFX8-NEXT: s_cbranch_execnz .LBB22_1
5224 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5225 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
5226 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5228 ; GFX7-LABEL: local_atomic_fmin_noret_v2f16:
5230 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5231 ; GFX7-NEXT: s_mov_b32 m0, -1
5232 ; GFX7-NEXT: ds_read_b32 v3, v0
5233 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
5234 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v1
5235 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
5236 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v2
5237 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5238 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v3
5239 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v4
5240 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
5241 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
5242 ; GFX7-NEXT: .LBB22_1: ; %atomicrmw.start
5243 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5244 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
5245 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
5246 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v4
5247 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v3
5248 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v4
5249 ; GFX7-NEXT: v_or_b32_e32 v7, v3, v4
5250 ; GFX7-NEXT: v_min_f32_e32 v5, v5, v1
5251 ; GFX7-NEXT: v_min_f32_e32 v6, v6, v2
5252 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
5253 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
5254 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
5255 ; GFX7-NEXT: v_or_b32_e32 v3, v6, v3
5256 ; GFX7-NEXT: ds_cmpst_rtn_b32 v5, v0, v7, v3
5257 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5258 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v5
5259 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v5
5260 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v4
5261 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
5262 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5263 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
5264 ; GFX7-NEXT: s_cbranch_execnz .LBB22_1
5265 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5266 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
5267 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5269 ; GFX6-LABEL: local_atomic_fmin_noret_v2f16:
5271 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5272 ; GFX6-NEXT: s_mov_b32 m0, -1
5273 ; GFX6-NEXT: ds_read_b32 v3, v0
5274 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
5275 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v1
5276 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
5277 ; GFX6-NEXT: v_cvt_f32_f16_e32 v1, v2
5278 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5279 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v3
5280 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v4
5281 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
5282 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v5
5283 ; GFX6-NEXT: .LBB22_1: ; %atomicrmw.start
5284 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
5285 ; GFX6-NEXT: v_cvt_f16_f32_e32 v4, v4
5286 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
5287 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v4
5288 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v3
5289 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v4
5290 ; GFX6-NEXT: v_or_b32_e32 v7, v3, v4
5291 ; GFX6-NEXT: v_min_f32_e32 v5, v5, v1
5292 ; GFX6-NEXT: v_min_f32_e32 v6, v6, v2
5293 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v5
5294 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v6
5295 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v5
5296 ; GFX6-NEXT: v_or_b32_e32 v3, v6, v3
5297 ; GFX6-NEXT: ds_cmpst_rtn_b32 v5, v0, v7, v3
5298 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5299 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v5
5300 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v5
5301 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v4
5302 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
5303 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5304 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
5305 ; GFX6-NEXT: s_cbranch_execnz .LBB22_1
5306 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
5307 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
5308 ; GFX6-NEXT: s_setpc_b64 s[30:31]
5309 %result = atomicrmw fmin ptr addrspace(3) %ptr, <2 x half> %val seq_cst
5313 define void @local_atomic_fmin_noret_v2f16__offset(ptr addrspace(3) %ptr, <2 x half> %val) {
5314 ; GFX12-LABEL: local_atomic_fmin_noret_v2f16__offset:
5316 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5317 ; GFX12-NEXT: s_wait_expcnt 0x0
5318 ; GFX12-NEXT: s_wait_samplecnt 0x0
5319 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5320 ; GFX12-NEXT: s_wait_kmcnt 0x0
5321 ; GFX12-NEXT: ds_load_b32 v2, v0 offset:65532
5322 ; GFX12-NEXT: v_pk_max_num_f16 v1, v1, v1
5323 ; GFX12-NEXT: s_mov_b32 s0, 0
5324 ; GFX12-NEXT: .LBB23_1: ; %atomicrmw.start
5325 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
5326 ; GFX12-NEXT: s_wait_dscnt 0x0
5327 ; GFX12-NEXT: v_pk_max_num_f16 v3, v2, v2
5328 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
5329 ; GFX12-NEXT: v_pk_min_num_f16 v3, v3, v1
5330 ; GFX12-NEXT: global_wb scope:SCOPE_SE
5331 ; GFX12-NEXT: s_wait_storecnt 0x0
5332 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v3, v0, v3, v2 offset:65532
5333 ; GFX12-NEXT: s_wait_dscnt 0x0
5334 ; GFX12-NEXT: global_inv scope:SCOPE_SE
5335 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v2
5336 ; GFX12-NEXT: v_mov_b32_e32 v2, v3
5337 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
5338 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5339 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5340 ; GFX12-NEXT: s_cbranch_execnz .LBB23_1
5341 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
5342 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
5343 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5345 ; GFX940-LABEL: local_atomic_fmin_noret_v2f16__offset:
5347 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5348 ; GFX940-NEXT: ds_read_b32 v2, v0 offset:65532
5349 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
5350 ; GFX940-NEXT: v_pk_max_f16 v1, v1, v1
5351 ; GFX940-NEXT: .LBB23_1: ; %atomicrmw.start
5352 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
5353 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
5354 ; GFX940-NEXT: v_pk_max_f16 v3, v2, v2
5355 ; GFX940-NEXT: s_nop 0
5356 ; GFX940-NEXT: v_pk_min_f16 v3, v3, v1
5357 ; GFX940-NEXT: ds_cmpst_rtn_b32 v3, v0, v2, v3 offset:65532
5358 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
5359 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v2
5360 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
5361 ; GFX940-NEXT: v_mov_b32_e32 v2, v3
5362 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
5363 ; GFX940-NEXT: s_cbranch_execnz .LBB23_1
5364 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
5365 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
5366 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5368 ; GFX11-LABEL: local_atomic_fmin_noret_v2f16__offset:
5370 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5371 ; GFX11-NEXT: ds_load_b32 v2, v0 offset:65532
5372 ; GFX11-NEXT: v_pk_max_f16 v1, v1, v1
5373 ; GFX11-NEXT: s_mov_b32 s0, 0
5374 ; GFX11-NEXT: .LBB23_1: ; %atomicrmw.start
5375 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
5376 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
5377 ; GFX11-NEXT: v_pk_max_f16 v3, v2, v2
5378 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
5379 ; GFX11-NEXT: v_pk_min_f16 v3, v3, v1
5380 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5381 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v3, v0, v3, v2 offset:65532
5382 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
5383 ; GFX11-NEXT: buffer_gl0_inv
5384 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v2
5385 ; GFX11-NEXT: v_mov_b32_e32 v2, v3
5386 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
5387 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5388 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5389 ; GFX11-NEXT: s_cbranch_execnz .LBB23_1
5390 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
5391 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
5392 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5394 ; GFX10-LABEL: local_atomic_fmin_noret_v2f16__offset:
5396 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5397 ; GFX10-NEXT: ds_read_b32 v2, v0 offset:65532
5398 ; GFX10-NEXT: v_pk_max_f16 v1, v1, v1
5399 ; GFX10-NEXT: s_mov_b32 s4, 0
5400 ; GFX10-NEXT: .LBB23_1: ; %atomicrmw.start
5401 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5402 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
5403 ; GFX10-NEXT: v_pk_max_f16 v3, v2, v2
5404 ; GFX10-NEXT: v_pk_min_f16 v3, v3, v1
5405 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5406 ; GFX10-NEXT: ds_cmpst_rtn_b32 v3, v0, v2, v3 offset:65532
5407 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
5408 ; GFX10-NEXT: buffer_gl0_inv
5409 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v2
5410 ; GFX10-NEXT: v_mov_b32_e32 v2, v3
5411 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5412 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5413 ; GFX10-NEXT: s_cbranch_execnz .LBB23_1
5414 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5415 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5416 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5418 ; GFX90A-LABEL: local_atomic_fmin_noret_v2f16__offset:
5420 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5421 ; GFX90A-NEXT: ds_read_b32 v2, v0 offset:65532
5422 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
5423 ; GFX90A-NEXT: v_pk_max_f16 v1, v1, v1
5424 ; GFX90A-NEXT: .LBB23_1: ; %atomicrmw.start
5425 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
5426 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5427 ; GFX90A-NEXT: v_pk_max_f16 v3, v2, v2
5428 ; GFX90A-NEXT: v_pk_min_f16 v3, v3, v1
5429 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v3, v0, v2, v3 offset:65532
5430 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5431 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v2
5432 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5433 ; GFX90A-NEXT: v_mov_b32_e32 v2, v3
5434 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
5435 ; GFX90A-NEXT: s_cbranch_execnz .LBB23_1
5436 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
5437 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5438 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5440 ; GFX908-LABEL: local_atomic_fmin_noret_v2f16__offset:
5442 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5443 ; GFX908-NEXT: ds_read_b32 v2, v0 offset:65532
5444 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
5445 ; GFX908-NEXT: v_pk_max_f16 v1, v1, v1
5446 ; GFX908-NEXT: .LBB23_1: ; %atomicrmw.start
5447 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
5448 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
5449 ; GFX908-NEXT: v_pk_max_f16 v3, v2, v2
5450 ; GFX908-NEXT: v_pk_min_f16 v3, v3, v1
5451 ; GFX908-NEXT: ds_cmpst_rtn_b32 v3, v0, v2, v3 offset:65532
5452 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
5453 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v2
5454 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5455 ; GFX908-NEXT: v_mov_b32_e32 v2, v3
5456 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
5457 ; GFX908-NEXT: s_cbranch_execnz .LBB23_1
5458 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
5459 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5460 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5462 ; GFX8-LABEL: local_atomic_fmin_noret_v2f16__offset:
5464 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5465 ; GFX8-NEXT: s_mov_b32 m0, -1
5466 ; GFX8-NEXT: ds_read_b32 v3, v0 offset:65532
5467 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5468 ; GFX8-NEXT: v_max_f16_sdwa v2, v1, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
5469 ; GFX8-NEXT: v_max_f16_e32 v1, v1, v1
5470 ; GFX8-NEXT: .LBB23_1: ; %atomicrmw.start
5471 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5472 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
5473 ; GFX8-NEXT: v_max_f16_sdwa v4, v3, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
5474 ; GFX8-NEXT: v_max_f16_e32 v5, v3, v3
5475 ; GFX8-NEXT: v_min_f16_sdwa v4, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
5476 ; GFX8-NEXT: v_min_f16_e32 v5, v5, v1
5477 ; GFX8-NEXT: v_or_b32_e32 v4, v5, v4
5478 ; GFX8-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4 offset:65532
5479 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
5480 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
5481 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5482 ; GFX8-NEXT: v_mov_b32_e32 v3, v4
5483 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5484 ; GFX8-NEXT: s_cbranch_execnz .LBB23_1
5485 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5486 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
5487 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5489 ; GFX7-LABEL: local_atomic_fmin_noret_v2f16__offset:
5491 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5492 ; GFX7-NEXT: s_mov_b32 m0, -1
5493 ; GFX7-NEXT: ds_read_b32 v3, v0 offset:65532
5494 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
5495 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v1
5496 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
5497 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v2
5498 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5499 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v3
5500 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v4
5501 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
5502 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
5503 ; GFX7-NEXT: .LBB23_1: ; %atomicrmw.start
5504 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5505 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
5506 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
5507 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v4
5508 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v3
5509 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v4
5510 ; GFX7-NEXT: v_or_b32_e32 v7, v3, v4
5511 ; GFX7-NEXT: v_min_f32_e32 v5, v5, v1
5512 ; GFX7-NEXT: v_min_f32_e32 v6, v6, v2
5513 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
5514 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
5515 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
5516 ; GFX7-NEXT: v_or_b32_e32 v3, v6, v3
5517 ; GFX7-NEXT: ds_cmpst_rtn_b32 v5, v0, v7, v3 offset:65532
5518 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5519 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v5
5520 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v5
5521 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v4
5522 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
5523 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5524 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
5525 ; GFX7-NEXT: s_cbranch_execnz .LBB23_1
5526 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5527 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
5528 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5530 ; GFX6-LABEL: local_atomic_fmin_noret_v2f16__offset:
5532 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5533 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffc, v0
5534 ; GFX6-NEXT: s_mov_b32 m0, -1
5535 ; GFX6-NEXT: ds_read_b32 v4, v0
5536 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
5537 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v1
5538 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
5539 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5540 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v4
5541 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v4
5542 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v1
5543 ; GFX6-NEXT: v_cvt_f32_f16_e32 v1, v2
5544 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v5
5545 ; GFX6-NEXT: .LBB23_1: ; %atomicrmw.start
5546 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
5547 ; GFX6-NEXT: v_cvt_f16_f32_e32 v4, v4
5548 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
5549 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v4
5550 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v3
5551 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v4
5552 ; GFX6-NEXT: v_or_b32_e32 v7, v3, v4
5553 ; GFX6-NEXT: v_min_f32_e32 v5, v5, v1
5554 ; GFX6-NEXT: v_min_f32_e32 v6, v6, v2
5555 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v5
5556 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v6
5557 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v5
5558 ; GFX6-NEXT: v_or_b32_e32 v3, v6, v3
5559 ; GFX6-NEXT: ds_cmpst_rtn_b32 v5, v0, v7, v3
5560 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5561 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v5
5562 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v5
5563 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v4
5564 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
5565 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5566 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
5567 ; GFX6-NEXT: s_cbranch_execnz .LBB23_1
5568 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
5569 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
5570 ; GFX6-NEXT: s_setpc_b64 s[30:31]
5571 %gep = getelementptr <2 x half>, ptr addrspace(3) %ptr, i32 16383
5572 %result = atomicrmw fmin ptr addrspace(3) %gep, <2 x half> %val seq_cst
5576 ; --------------------------------------------------------------------
5578 ; --------------------------------------------------------------------
5580 define <2 x bfloat> @local_atomic_fmin_ret_v2bf16(ptr addrspace(3) %ptr, <2 x bfloat> %val) {
5581 ; GFX12-LABEL: local_atomic_fmin_ret_v2bf16:
5583 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5584 ; GFX12-NEXT: s_wait_expcnt 0x0
5585 ; GFX12-NEXT: s_wait_samplecnt 0x0
5586 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5587 ; GFX12-NEXT: s_wait_kmcnt 0x0
5588 ; GFX12-NEXT: ds_load_b32 v2, v0
5589 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v1
5590 ; GFX12-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
5591 ; GFX12-NEXT: s_mov_b32 s1, 0
5592 ; GFX12-NEXT: .LBB24_1: ; %atomicrmw.start
5593 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
5594 ; GFX12-NEXT: s_wait_dscnt 0x0
5595 ; GFX12-NEXT: v_mov_b32_e32 v4, v2
5596 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5597 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
5598 ; GFX12-NEXT: v_min_num_f32_e32 v5, v5, v1
5599 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
5600 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
5601 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v5
5602 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
5603 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
5604 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5605 ; GFX12-NEXT: v_dual_cndmask_b32 v5, v7, v9 :: v_dual_lshlrev_b32 v2, 16, v4
5606 ; GFX12-NEXT: v_min_num_f32_e32 v2, v2, v3
5607 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
5608 ; GFX12-NEXT: v_bfe_u32 v6, v2, 16, 1
5609 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v2
5610 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v2, v2
5611 ; GFX12-NEXT: v_add3_u32 v6, v6, v2, 0x7fff
5612 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5613 ; GFX12-NEXT: v_cndmask_b32_e64 v2, v6, v8, s0
5614 ; GFX12-NEXT: v_perm_b32 v2, v5, v2, 0x7060302
5615 ; GFX12-NEXT: global_wb scope:SCOPE_SE
5616 ; GFX12-NEXT: s_wait_storecnt 0x0
5617 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v4
5618 ; GFX12-NEXT: s_wait_dscnt 0x0
5619 ; GFX12-NEXT: global_inv scope:SCOPE_SE
5620 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v4
5621 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
5622 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5623 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
5624 ; GFX12-NEXT: s_cbranch_execnz .LBB24_1
5625 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
5626 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
5627 ; GFX12-NEXT: v_mov_b32_e32 v0, v2
5628 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5630 ; GFX940-LABEL: local_atomic_fmin_ret_v2bf16:
5632 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5633 ; GFX940-NEXT: ds_read_b32 v2, v0
5634 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
5635 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 16, v1
5636 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
5637 ; GFX940-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
5638 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
5639 ; GFX940-NEXT: .LBB24_1: ; %atomicrmw.start
5640 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
5641 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
5642 ; GFX940-NEXT: v_mov_b32_e32 v4, v2
5643 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v4
5644 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
5645 ; GFX940-NEXT: v_min_f32_e32 v2, v2, v3
5646 ; GFX940-NEXT: v_min_f32_e32 v5, v5, v1
5647 ; GFX940-NEXT: v_bfe_u32 v6, v2, 16, 1
5648 ; GFX940-NEXT: v_bfe_u32 v8, v5, 16, 1
5649 ; GFX940-NEXT: v_or_b32_e32 v7, 0x400000, v2
5650 ; GFX940-NEXT: v_or_b32_e32 v9, 0x400000, v5
5651 ; GFX940-NEXT: v_add3_u32 v6, v6, v2, s4
5652 ; GFX940-NEXT: v_add3_u32 v8, v8, v5, s4
5653 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
5654 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v2, v2
5655 ; GFX940-NEXT: s_nop 0
5656 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
5657 ; GFX940-NEXT: v_cndmask_b32_e64 v2, v6, v7, s[0:1]
5658 ; GFX940-NEXT: v_perm_b32 v2, v5, v2, s5
5659 ; GFX940-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2
5660 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
5661 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
5662 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
5663 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
5664 ; GFX940-NEXT: s_cbranch_execnz .LBB24_1
5665 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
5666 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
5667 ; GFX940-NEXT: v_mov_b32_e32 v0, v2
5668 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5670 ; GFX11-LABEL: local_atomic_fmin_ret_v2bf16:
5672 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5673 ; GFX11-NEXT: ds_load_b32 v2, v0
5674 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v1
5675 ; GFX11-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
5676 ; GFX11-NEXT: s_mov_b32 s1, 0
5677 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
5678 ; GFX11-NEXT: .p2align 6
5679 ; GFX11-NEXT: .LBB24_1: ; %atomicrmw.start
5680 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
5681 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
5682 ; GFX11-NEXT: v_mov_b32_e32 v4, v2
5683 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5684 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
5685 ; GFX11-NEXT: v_min_f32_e32 v5, v5, v1
5686 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
5687 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
5688 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v5
5689 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
5690 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
5691 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5692 ; GFX11-NEXT: v_dual_cndmask_b32 v5, v7, v9 :: v_dual_lshlrev_b32 v2, 16, v4
5693 ; GFX11-NEXT: v_min_f32_e32 v2, v2, v3
5694 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
5695 ; GFX11-NEXT: v_bfe_u32 v6, v2, 16, 1
5696 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v2
5697 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
5698 ; GFX11-NEXT: v_add3_u32 v6, v6, v2, 0x7fff
5699 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5700 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v6, v8, s0
5701 ; GFX11-NEXT: v_perm_b32 v2, v5, v2, 0x7060302
5702 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5703 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v4
5704 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
5705 ; GFX11-NEXT: buffer_gl0_inv
5706 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v4
5707 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
5708 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5709 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
5710 ; GFX11-NEXT: s_cbranch_execnz .LBB24_1
5711 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
5712 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
5713 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
5714 ; GFX11-NEXT: v_mov_b32_e32 v0, v2
5715 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5717 ; GFX10-LABEL: local_atomic_fmin_ret_v2bf16:
5719 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5720 ; GFX10-NEXT: ds_read_b32 v2, v0
5721 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v1
5722 ; GFX10-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
5723 ; GFX10-NEXT: s_mov_b32 s5, 0
5724 ; GFX10-NEXT: .LBB24_1: ; %atomicrmw.start
5725 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5726 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
5727 ; GFX10-NEXT: v_mov_b32_e32 v4, v2
5728 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v4
5729 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
5730 ; GFX10-NEXT: v_min_f32_e32 v2, v2, v3
5731 ; GFX10-NEXT: v_min_f32_e32 v5, v5, v1
5732 ; GFX10-NEXT: v_bfe_u32 v6, v2, 16, 1
5733 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
5734 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v2
5735 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v5
5736 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
5737 ; GFX10-NEXT: v_add3_u32 v6, v6, v2, 0x7fff
5738 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
5739 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
5740 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v9, vcc_lo
5741 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v6, v8, s4
5742 ; GFX10-NEXT: v_perm_b32 v2, v5, v2, 0x7060302
5743 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5744 ; GFX10-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2
5745 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
5746 ; GFX10-NEXT: buffer_gl0_inv
5747 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v4
5748 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
5749 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
5750 ; GFX10-NEXT: s_cbranch_execnz .LBB24_1
5751 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5752 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
5753 ; GFX10-NEXT: v_mov_b32_e32 v0, v2
5754 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5756 ; GFX90A-LABEL: local_atomic_fmin_ret_v2bf16:
5758 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5759 ; GFX90A-NEXT: ds_read_b32 v2, v0
5760 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
5761 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v1
5762 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
5763 ; GFX90A-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
5764 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
5765 ; GFX90A-NEXT: .LBB24_1: ; %atomicrmw.start
5766 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
5767 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5768 ; GFX90A-NEXT: v_mov_b32_e32 v4, v2
5769 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v4
5770 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
5771 ; GFX90A-NEXT: v_min_f32_e32 v2, v2, v3
5772 ; GFX90A-NEXT: v_min_f32_e32 v5, v5, v1
5773 ; GFX90A-NEXT: v_bfe_u32 v6, v2, 16, 1
5774 ; GFX90A-NEXT: v_bfe_u32 v8, v5, 16, 1
5775 ; GFX90A-NEXT: v_or_b32_e32 v7, 0x400000, v2
5776 ; GFX90A-NEXT: v_or_b32_e32 v9, 0x400000, v5
5777 ; GFX90A-NEXT: v_add3_u32 v6, v6, v2, s8
5778 ; GFX90A-NEXT: v_add3_u32 v8, v8, v5, s8
5779 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
5780 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
5781 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v6, v7, s[4:5]
5782 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
5783 ; GFX90A-NEXT: v_perm_b32 v2, v5, v2, s9
5784 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2
5785 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5786 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
5787 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
5788 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
5789 ; GFX90A-NEXT: s_cbranch_execnz .LBB24_1
5790 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
5791 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
5792 ; GFX90A-NEXT: v_mov_b32_e32 v0, v2
5793 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5795 ; GFX908-LABEL: local_atomic_fmin_ret_v2bf16:
5797 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5798 ; GFX908-NEXT: ds_read_b32 v2, v0
5799 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
5800 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v1
5801 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
5802 ; GFX908-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
5803 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
5804 ; GFX908-NEXT: .LBB24_1: ; %atomicrmw.start
5805 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
5806 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
5807 ; GFX908-NEXT: v_mov_b32_e32 v4, v2
5808 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v4
5809 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
5810 ; GFX908-NEXT: v_min_f32_e32 v2, v2, v3
5811 ; GFX908-NEXT: v_min_f32_e32 v5, v5, v1
5812 ; GFX908-NEXT: v_bfe_u32 v6, v2, 16, 1
5813 ; GFX908-NEXT: v_bfe_u32 v8, v5, 16, 1
5814 ; GFX908-NEXT: v_or_b32_e32 v7, 0x400000, v2
5815 ; GFX908-NEXT: v_or_b32_e32 v9, 0x400000, v5
5816 ; GFX908-NEXT: v_add3_u32 v6, v6, v2, s8
5817 ; GFX908-NEXT: v_add3_u32 v8, v8, v5, s8
5818 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
5819 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
5820 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v6, v7, s[4:5]
5821 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
5822 ; GFX908-NEXT: v_perm_b32 v2, v5, v2, s9
5823 ; GFX908-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2
5824 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
5825 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
5826 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
5827 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
5828 ; GFX908-NEXT: s_cbranch_execnz .LBB24_1
5829 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
5830 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
5831 ; GFX908-NEXT: v_mov_b32_e32 v0, v2
5832 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5834 ; GFX8-LABEL: local_atomic_fmin_ret_v2bf16:
5836 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5837 ; GFX8-NEXT: s_mov_b32 m0, -1
5838 ; GFX8-NEXT: ds_read_b32 v2, v0
5839 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
5840 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 16, v1
5841 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
5842 ; GFX8-NEXT: .LBB24_1: ; %atomicrmw.start
5843 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5844 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
5845 ; GFX8-NEXT: v_mov_b32_e32 v4, v2
5846 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v4
5847 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
5848 ; GFX8-NEXT: v_min_f32_e32 v2, v2, v3
5849 ; GFX8-NEXT: v_min_f32_e32 v5, v5, v1
5850 ; GFX8-NEXT: v_bfe_u32 v6, v2, 16, 1
5851 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
5852 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v2
5853 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
5854 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
5855 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
5856 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
5857 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
5858 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v2
5859 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
5860 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
5861 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v6, v7, s[4:5]
5862 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
5863 ; GFX8-NEXT: v_alignbit_b32 v2, v5, v2, 16
5864 ; GFX8-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2
5865 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
5866 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
5867 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
5868 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
5869 ; GFX8-NEXT: s_cbranch_execnz .LBB24_1
5870 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5871 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
5872 ; GFX8-NEXT: v_mov_b32_e32 v0, v2
5873 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5875 ; GFX7-LABEL: local_atomic_fmin_ret_v2bf16:
5877 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5878 ; GFX7-NEXT: s_mov_b32 m0, -1
5879 ; GFX7-NEXT: ds_read_b32 v3, v0
5880 ; GFX7-NEXT: v_mov_b32_e32 v4, v1
5881 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
5882 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
5883 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
5884 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5885 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v3
5886 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
5887 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
5888 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v4
5889 ; GFX7-NEXT: .LBB24_1: ; %atomicrmw.start
5890 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5891 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v1
5892 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
5893 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v1
5894 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
5895 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
5896 ; GFX7-NEXT: v_min_f32_e32 v5, v5, v2
5897 ; GFX7-NEXT: v_min_f32_e32 v6, v6, v4
5898 ; GFX7-NEXT: v_alignbit_b32 v1, v1, v3, 16
5899 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
5900 ; GFX7-NEXT: v_alignbit_b32 v3, v3, v6, 16
5901 ; GFX7-NEXT: ds_cmpst_rtn_b32 v3, v0, v1, v3
5902 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5903 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v1
5904 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v3
5905 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5906 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
5907 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
5908 ; GFX7-NEXT: s_cbranch_execnz .LBB24_1
5909 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5910 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
5911 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
5912 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5914 ; GFX6-LABEL: local_atomic_fmin_ret_v2bf16:
5916 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5917 ; GFX6-NEXT: s_mov_b32 m0, -1
5918 ; GFX6-NEXT: ds_read_b32 v3, v0
5919 ; GFX6-NEXT: v_mov_b32_e32 v4, v1
5920 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
5921 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v4
5922 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
5923 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5924 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff0000, v3
5925 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
5926 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
5927 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v4
5928 ; GFX6-NEXT: .LBB24_1: ; %atomicrmw.start
5929 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
5930 ; GFX6-NEXT: v_mul_f32_e32 v1, 1.0, v1
5931 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
5932 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v1
5933 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
5934 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v1
5935 ; GFX6-NEXT: v_min_f32_e32 v5, v5, v2
5936 ; GFX6-NEXT: v_min_f32_e32 v6, v6, v4
5937 ; GFX6-NEXT: v_alignbit_b32 v1, v1, v3, 16
5938 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v5
5939 ; GFX6-NEXT: v_alignbit_b32 v3, v3, v6, 16
5940 ; GFX6-NEXT: ds_cmpst_rtn_b32 v3, v0, v1, v3
5941 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5942 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v3, v1
5943 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff0000, v3
5944 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5945 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
5946 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
5947 ; GFX6-NEXT: s_cbranch_execnz .LBB24_1
5948 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
5949 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
5950 ; GFX6-NEXT: v_mov_b32_e32 v0, v3
5951 ; GFX6-NEXT: s_setpc_b64 s[30:31]
5952 %result = atomicrmw fmin ptr addrspace(3) %ptr, <2 x bfloat> %val seq_cst
5953 ret <2 x bfloat> %result
5956 define <2 x bfloat> @local_atomic_fmin_ret_v2bf16__offset(ptr addrspace(3) %ptr, <2 x bfloat> %val) {
5957 ; GFX12-LABEL: local_atomic_fmin_ret_v2bf16__offset:
5959 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5960 ; GFX12-NEXT: s_wait_expcnt 0x0
5961 ; GFX12-NEXT: s_wait_samplecnt 0x0
5962 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5963 ; GFX12-NEXT: s_wait_kmcnt 0x0
5964 ; GFX12-NEXT: ds_load_b32 v2, v0 offset:65532
5965 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v1
5966 ; GFX12-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
5967 ; GFX12-NEXT: s_mov_b32 s1, 0
5968 ; GFX12-NEXT: .LBB25_1: ; %atomicrmw.start
5969 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
5970 ; GFX12-NEXT: s_wait_dscnt 0x0
5971 ; GFX12-NEXT: v_mov_b32_e32 v4, v2
5972 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5973 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
5974 ; GFX12-NEXT: v_min_num_f32_e32 v5, v5, v1
5975 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
5976 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
5977 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v5
5978 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
5979 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
5980 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5981 ; GFX12-NEXT: v_dual_cndmask_b32 v5, v7, v9 :: v_dual_lshlrev_b32 v2, 16, v4
5982 ; GFX12-NEXT: v_min_num_f32_e32 v2, v2, v3
5983 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
5984 ; GFX12-NEXT: v_bfe_u32 v6, v2, 16, 1
5985 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v2
5986 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v2, v2
5987 ; GFX12-NEXT: v_add3_u32 v6, v6, v2, 0x7fff
5988 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5989 ; GFX12-NEXT: v_cndmask_b32_e64 v2, v6, v8, s0
5990 ; GFX12-NEXT: v_perm_b32 v2, v5, v2, 0x7060302
5991 ; GFX12-NEXT: global_wb scope:SCOPE_SE
5992 ; GFX12-NEXT: s_wait_storecnt 0x0
5993 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v4 offset:65532
5994 ; GFX12-NEXT: s_wait_dscnt 0x0
5995 ; GFX12-NEXT: global_inv scope:SCOPE_SE
5996 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v4
5997 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
5998 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5999 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
6000 ; GFX12-NEXT: s_cbranch_execnz .LBB25_1
6001 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6002 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
6003 ; GFX12-NEXT: v_mov_b32_e32 v0, v2
6004 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6006 ; GFX940-LABEL: local_atomic_fmin_ret_v2bf16__offset:
6008 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6009 ; GFX940-NEXT: ds_read_b32 v2, v0 offset:65532
6010 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
6011 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 16, v1
6012 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
6013 ; GFX940-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6014 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
6015 ; GFX940-NEXT: .LBB25_1: ; %atomicrmw.start
6016 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
6017 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
6018 ; GFX940-NEXT: v_mov_b32_e32 v4, v2
6019 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v4
6020 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
6021 ; GFX940-NEXT: v_min_f32_e32 v2, v2, v3
6022 ; GFX940-NEXT: v_min_f32_e32 v5, v5, v1
6023 ; GFX940-NEXT: v_bfe_u32 v6, v2, 16, 1
6024 ; GFX940-NEXT: v_bfe_u32 v8, v5, 16, 1
6025 ; GFX940-NEXT: v_or_b32_e32 v7, 0x400000, v2
6026 ; GFX940-NEXT: v_or_b32_e32 v9, 0x400000, v5
6027 ; GFX940-NEXT: v_add3_u32 v6, v6, v2, s4
6028 ; GFX940-NEXT: v_add3_u32 v8, v8, v5, s4
6029 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6030 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v2, v2
6031 ; GFX940-NEXT: s_nop 0
6032 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6033 ; GFX940-NEXT: v_cndmask_b32_e64 v2, v6, v7, s[0:1]
6034 ; GFX940-NEXT: v_perm_b32 v2, v5, v2, s5
6035 ; GFX940-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2 offset:65532
6036 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
6037 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
6038 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
6039 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
6040 ; GFX940-NEXT: s_cbranch_execnz .LBB25_1
6041 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
6042 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
6043 ; GFX940-NEXT: v_mov_b32_e32 v0, v2
6044 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6046 ; GFX11-LABEL: local_atomic_fmin_ret_v2bf16__offset:
6048 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6049 ; GFX11-NEXT: ds_load_b32 v2, v0 offset:65532
6050 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v1
6051 ; GFX11-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6052 ; GFX11-NEXT: s_mov_b32 s1, 0
6053 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
6054 ; GFX11-NEXT: .p2align 6
6055 ; GFX11-NEXT: .LBB25_1: ; %atomicrmw.start
6056 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6057 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
6058 ; GFX11-NEXT: v_mov_b32_e32 v4, v2
6059 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6060 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
6061 ; GFX11-NEXT: v_min_f32_e32 v5, v5, v1
6062 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
6063 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
6064 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v5
6065 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
6066 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
6067 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6068 ; GFX11-NEXT: v_dual_cndmask_b32 v5, v7, v9 :: v_dual_lshlrev_b32 v2, 16, v4
6069 ; GFX11-NEXT: v_min_f32_e32 v2, v2, v3
6070 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
6071 ; GFX11-NEXT: v_bfe_u32 v6, v2, 16, 1
6072 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v2
6073 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
6074 ; GFX11-NEXT: v_add3_u32 v6, v6, v2, 0x7fff
6075 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6076 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v6, v8, s0
6077 ; GFX11-NEXT: v_perm_b32 v2, v5, v2, 0x7060302
6078 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6079 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v2, v0, v2, v4 offset:65532
6080 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
6081 ; GFX11-NEXT: buffer_gl0_inv
6082 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v4
6083 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
6084 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6085 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
6086 ; GFX11-NEXT: s_cbranch_execnz .LBB25_1
6087 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6088 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
6089 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
6090 ; GFX11-NEXT: v_mov_b32_e32 v0, v2
6091 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6093 ; GFX10-LABEL: local_atomic_fmin_ret_v2bf16__offset:
6095 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6096 ; GFX10-NEXT: ds_read_b32 v2, v0 offset:65532
6097 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v1
6098 ; GFX10-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6099 ; GFX10-NEXT: s_mov_b32 s5, 0
6100 ; GFX10-NEXT: .LBB25_1: ; %atomicrmw.start
6101 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6102 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
6103 ; GFX10-NEXT: v_mov_b32_e32 v4, v2
6104 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v4
6105 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
6106 ; GFX10-NEXT: v_min_f32_e32 v2, v2, v3
6107 ; GFX10-NEXT: v_min_f32_e32 v5, v5, v1
6108 ; GFX10-NEXT: v_bfe_u32 v6, v2, 16, 1
6109 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
6110 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v2
6111 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v5
6112 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
6113 ; GFX10-NEXT: v_add3_u32 v6, v6, v2, 0x7fff
6114 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
6115 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
6116 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v9, vcc_lo
6117 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v6, v8, s4
6118 ; GFX10-NEXT: v_perm_b32 v2, v5, v2, 0x7060302
6119 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6120 ; GFX10-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2 offset:65532
6121 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
6122 ; GFX10-NEXT: buffer_gl0_inv
6123 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v4
6124 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
6125 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
6126 ; GFX10-NEXT: s_cbranch_execnz .LBB25_1
6127 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6128 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
6129 ; GFX10-NEXT: v_mov_b32_e32 v0, v2
6130 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6132 ; GFX90A-LABEL: local_atomic_fmin_ret_v2bf16__offset:
6134 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6135 ; GFX90A-NEXT: ds_read_b32 v2, v0 offset:65532
6136 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
6137 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v1
6138 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
6139 ; GFX90A-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6140 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
6141 ; GFX90A-NEXT: .LBB25_1: ; %atomicrmw.start
6142 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
6143 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
6144 ; GFX90A-NEXT: v_mov_b32_e32 v4, v2
6145 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v4
6146 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
6147 ; GFX90A-NEXT: v_min_f32_e32 v2, v2, v3
6148 ; GFX90A-NEXT: v_min_f32_e32 v5, v5, v1
6149 ; GFX90A-NEXT: v_bfe_u32 v6, v2, 16, 1
6150 ; GFX90A-NEXT: v_bfe_u32 v8, v5, 16, 1
6151 ; GFX90A-NEXT: v_or_b32_e32 v7, 0x400000, v2
6152 ; GFX90A-NEXT: v_or_b32_e32 v9, 0x400000, v5
6153 ; GFX90A-NEXT: v_add3_u32 v6, v6, v2, s8
6154 ; GFX90A-NEXT: v_add3_u32 v8, v8, v5, s8
6155 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6156 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
6157 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v6, v7, s[4:5]
6158 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6159 ; GFX90A-NEXT: v_perm_b32 v2, v5, v2, s9
6160 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2 offset:65532
6161 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
6162 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
6163 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
6164 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
6165 ; GFX90A-NEXT: s_cbranch_execnz .LBB25_1
6166 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
6167 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
6168 ; GFX90A-NEXT: v_mov_b32_e32 v0, v2
6169 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6171 ; GFX908-LABEL: local_atomic_fmin_ret_v2bf16__offset:
6173 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6174 ; GFX908-NEXT: ds_read_b32 v2, v0 offset:65532
6175 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
6176 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v1
6177 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
6178 ; GFX908-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6179 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
6180 ; GFX908-NEXT: .LBB25_1: ; %atomicrmw.start
6181 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6182 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
6183 ; GFX908-NEXT: v_mov_b32_e32 v4, v2
6184 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v4
6185 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
6186 ; GFX908-NEXT: v_min_f32_e32 v2, v2, v3
6187 ; GFX908-NEXT: v_min_f32_e32 v5, v5, v1
6188 ; GFX908-NEXT: v_bfe_u32 v6, v2, 16, 1
6189 ; GFX908-NEXT: v_bfe_u32 v8, v5, 16, 1
6190 ; GFX908-NEXT: v_or_b32_e32 v7, 0x400000, v2
6191 ; GFX908-NEXT: v_or_b32_e32 v9, 0x400000, v5
6192 ; GFX908-NEXT: v_add3_u32 v6, v6, v2, s8
6193 ; GFX908-NEXT: v_add3_u32 v8, v8, v5, s8
6194 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6195 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
6196 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v6, v7, s[4:5]
6197 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6198 ; GFX908-NEXT: v_perm_b32 v2, v5, v2, s9
6199 ; GFX908-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2 offset:65532
6200 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
6201 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
6202 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
6203 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
6204 ; GFX908-NEXT: s_cbranch_execnz .LBB25_1
6205 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6206 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
6207 ; GFX908-NEXT: v_mov_b32_e32 v0, v2
6208 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6210 ; GFX8-LABEL: local_atomic_fmin_ret_v2bf16__offset:
6212 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6213 ; GFX8-NEXT: s_mov_b32 m0, -1
6214 ; GFX8-NEXT: ds_read_b32 v2, v0 offset:65532
6215 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
6216 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 16, v1
6217 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6218 ; GFX8-NEXT: .LBB25_1: ; %atomicrmw.start
6219 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6220 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
6221 ; GFX8-NEXT: v_mov_b32_e32 v4, v2
6222 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v4
6223 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
6224 ; GFX8-NEXT: v_min_f32_e32 v2, v2, v3
6225 ; GFX8-NEXT: v_min_f32_e32 v5, v5, v1
6226 ; GFX8-NEXT: v_bfe_u32 v6, v2, 16, 1
6227 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
6228 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v2
6229 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
6230 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
6231 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
6232 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
6233 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6234 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v2
6235 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
6236 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6237 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v6, v7, s[4:5]
6238 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
6239 ; GFX8-NEXT: v_alignbit_b32 v2, v5, v2, 16
6240 ; GFX8-NEXT: ds_cmpst_rtn_b32 v2, v0, v4, v2 offset:65532
6241 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
6242 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
6243 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
6244 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
6245 ; GFX8-NEXT: s_cbranch_execnz .LBB25_1
6246 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6247 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
6248 ; GFX8-NEXT: v_mov_b32_e32 v0, v2
6249 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6251 ; GFX7-LABEL: local_atomic_fmin_ret_v2bf16__offset:
6253 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6254 ; GFX7-NEXT: s_mov_b32 m0, -1
6255 ; GFX7-NEXT: ds_read_b32 v3, v0 offset:65532
6256 ; GFX7-NEXT: v_mov_b32_e32 v4, v1
6257 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
6258 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
6259 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
6260 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6261 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v3
6262 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
6263 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
6264 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v4
6265 ; GFX7-NEXT: .LBB25_1: ; %atomicrmw.start
6266 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6267 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v1
6268 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
6269 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v1
6270 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
6271 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
6272 ; GFX7-NEXT: v_min_f32_e32 v5, v5, v2
6273 ; GFX7-NEXT: v_min_f32_e32 v6, v6, v4
6274 ; GFX7-NEXT: v_alignbit_b32 v1, v1, v3, 16
6275 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
6276 ; GFX7-NEXT: v_alignbit_b32 v3, v3, v6, 16
6277 ; GFX7-NEXT: ds_cmpst_rtn_b32 v3, v0, v1, v3 offset:65532
6278 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6279 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v1
6280 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v3
6281 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6282 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
6283 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
6284 ; GFX7-NEXT: s_cbranch_execnz .LBB25_1
6285 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6286 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
6287 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
6288 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6290 ; GFX6-LABEL: local_atomic_fmin_ret_v2bf16__offset:
6292 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6293 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0xfffc, v0
6294 ; GFX6-NEXT: s_mov_b32 m0, -1
6295 ; GFX6-NEXT: ds_read_b32 v0, v4
6296 ; GFX6-NEXT: v_mov_b32_e32 v3, v1
6297 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
6298 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
6299 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
6300 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6301 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff0000, v0
6302 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v0
6303 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
6304 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
6305 ; GFX6-NEXT: .LBB25_1: ; %atomicrmw.start
6306 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
6307 ; GFX6-NEXT: v_mul_f32_e32 v1, 1.0, v1
6308 ; GFX6-NEXT: v_mul_f32_e32 v0, 1.0, v0
6309 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v1
6310 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v0
6311 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v1
6312 ; GFX6-NEXT: v_min_f32_e32 v5, v5, v2
6313 ; GFX6-NEXT: v_min_f32_e32 v6, v6, v3
6314 ; GFX6-NEXT: v_alignbit_b32 v0, v1, v0, 16
6315 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v5
6316 ; GFX6-NEXT: v_alignbit_b32 v1, v1, v6, 16
6317 ; GFX6-NEXT: ds_cmpst_rtn_b32 v5, v4, v0, v1
6318 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6319 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v0
6320 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff0000, v5
6321 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6322 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v5
6323 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
6324 ; GFX6-NEXT: s_cbranch_execnz .LBB25_1
6325 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
6326 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
6327 ; GFX6-NEXT: s_setpc_b64 s[30:31]
6328 %gep = getelementptr <2 x bfloat>, ptr addrspace(3) %ptr, i32 16383
6329 %result = atomicrmw fmin ptr addrspace(3) %gep, <2 x bfloat> %val seq_cst
6330 ret <2 x bfloat> %result
6333 define void @local_atomic_fmin_noret_v2bf16(ptr addrspace(3) %ptr, <2 x bfloat> %val) {
6334 ; GFX12-LABEL: local_atomic_fmin_noret_v2bf16:
6336 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6337 ; GFX12-NEXT: s_wait_expcnt 0x0
6338 ; GFX12-NEXT: s_wait_samplecnt 0x0
6339 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6340 ; GFX12-NEXT: s_wait_kmcnt 0x0
6341 ; GFX12-NEXT: ds_load_b32 v3, v0
6342 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6343 ; GFX12-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6344 ; GFX12-NEXT: s_mov_b32 s1, 0
6345 ; GFX12-NEXT: .LBB26_1: ; %atomicrmw.start
6346 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6347 ; GFX12-NEXT: s_wait_dscnt 0x0
6348 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6349 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6350 ; GFX12-NEXT: v_dual_min_num_f32 v5, v5, v1 :: v_dual_lshlrev_b32 v4, 16, v3
6351 ; GFX12-NEXT: v_min_num_f32_e32 v4, v4, v2
6352 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
6353 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
6354 ; GFX12-NEXT: v_bfe_u32 v6, v4, 16, 1
6355 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v4
6356 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v5
6357 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
6358 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
6359 ; GFX12-NEXT: v_add3_u32 v6, v6, v4, 0x7fff
6360 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v4, v4
6361 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
6362 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v9, vcc_lo
6363 ; GFX12-NEXT: v_cndmask_b32_e64 v4, v6, v8, s0
6364 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
6365 ; GFX12-NEXT: v_perm_b32 v4, v5, v4, 0x7060302
6366 ; GFX12-NEXT: global_wb scope:SCOPE_SE
6367 ; GFX12-NEXT: s_wait_storecnt 0x0
6368 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v4, v0, v4, v3
6369 ; GFX12-NEXT: s_wait_dscnt 0x0
6370 ; GFX12-NEXT: global_inv scope:SCOPE_SE
6371 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
6372 ; GFX12-NEXT: v_mov_b32_e32 v3, v4
6373 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
6374 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6375 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
6376 ; GFX12-NEXT: s_cbranch_execnz .LBB26_1
6377 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6378 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
6379 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6381 ; GFX940-LABEL: local_atomic_fmin_noret_v2bf16:
6383 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6384 ; GFX940-NEXT: ds_read_b32 v3, v0
6385 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
6386 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6387 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
6388 ; GFX940-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6389 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
6390 ; GFX940-NEXT: .LBB26_1: ; %atomicrmw.start
6391 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
6392 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
6393 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6394 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6395 ; GFX940-NEXT: v_min_f32_e32 v4, v4, v2
6396 ; GFX940-NEXT: v_min_f32_e32 v5, v5, v1
6397 ; GFX940-NEXT: v_bfe_u32 v6, v4, 16, 1
6398 ; GFX940-NEXT: v_bfe_u32 v8, v5, 16, 1
6399 ; GFX940-NEXT: v_or_b32_e32 v7, 0x400000, v4
6400 ; GFX940-NEXT: v_or_b32_e32 v9, 0x400000, v5
6401 ; GFX940-NEXT: v_add3_u32 v6, v6, v4, s4
6402 ; GFX940-NEXT: v_add3_u32 v8, v8, v5, s4
6403 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6404 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v4, v4
6405 ; GFX940-NEXT: s_nop 0
6406 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6407 ; GFX940-NEXT: v_cndmask_b32_e64 v4, v6, v7, s[0:1]
6408 ; GFX940-NEXT: v_perm_b32 v4, v5, v4, s5
6409 ; GFX940-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
6410 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
6411 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6412 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
6413 ; GFX940-NEXT: v_mov_b32_e32 v3, v4
6414 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
6415 ; GFX940-NEXT: s_cbranch_execnz .LBB26_1
6416 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
6417 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
6418 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6420 ; GFX11-LABEL: local_atomic_fmin_noret_v2bf16:
6422 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6423 ; GFX11-NEXT: ds_load_b32 v3, v0
6424 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6425 ; GFX11-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6426 ; GFX11-NEXT: s_mov_b32 s1, 0
6427 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
6428 ; GFX11-NEXT: .p2align 6
6429 ; GFX11-NEXT: .LBB26_1: ; %atomicrmw.start
6430 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6431 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
6432 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6433 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6434 ; GFX11-NEXT: v_dual_min_f32 v5, v5, v1 :: v_dual_lshlrev_b32 v4, 16, v3
6435 ; GFX11-NEXT: v_min_f32_e32 v4, v4, v2
6436 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
6437 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
6438 ; GFX11-NEXT: v_bfe_u32 v6, v4, 16, 1
6439 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v4
6440 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v5
6441 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
6442 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
6443 ; GFX11-NEXT: v_add3_u32 v6, v6, v4, 0x7fff
6444 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v4, v4
6445 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
6446 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v9, vcc_lo
6447 ; GFX11-NEXT: v_cndmask_b32_e64 v4, v6, v8, s0
6448 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
6449 ; GFX11-NEXT: v_perm_b32 v4, v5, v4, 0x7060302
6450 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6451 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v4, v0, v4, v3
6452 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
6453 ; GFX11-NEXT: buffer_gl0_inv
6454 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
6455 ; GFX11-NEXT: v_mov_b32_e32 v3, v4
6456 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
6457 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6458 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
6459 ; GFX11-NEXT: s_cbranch_execnz .LBB26_1
6460 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6461 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
6462 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
6463 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6465 ; GFX10-LABEL: local_atomic_fmin_noret_v2bf16:
6467 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6468 ; GFX10-NEXT: ds_read_b32 v3, v0
6469 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6470 ; GFX10-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6471 ; GFX10-NEXT: s_mov_b32 s5, 0
6472 ; GFX10-NEXT: .LBB26_1: ; %atomicrmw.start
6473 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6474 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
6475 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6476 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6477 ; GFX10-NEXT: v_min_f32_e32 v4, v4, v2
6478 ; GFX10-NEXT: v_min_f32_e32 v5, v5, v1
6479 ; GFX10-NEXT: v_bfe_u32 v6, v4, 16, 1
6480 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
6481 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v4
6482 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v5
6483 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
6484 ; GFX10-NEXT: v_add3_u32 v6, v6, v4, 0x7fff
6485 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
6486 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v4, v4
6487 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v9, vcc_lo
6488 ; GFX10-NEXT: v_cndmask_b32_e64 v4, v6, v8, s4
6489 ; GFX10-NEXT: v_perm_b32 v4, v5, v4, 0x7060302
6490 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6491 ; GFX10-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
6492 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
6493 ; GFX10-NEXT: buffer_gl0_inv
6494 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
6495 ; GFX10-NEXT: v_mov_b32_e32 v3, v4
6496 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
6497 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
6498 ; GFX10-NEXT: s_cbranch_execnz .LBB26_1
6499 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6500 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
6501 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6503 ; GFX90A-LABEL: local_atomic_fmin_noret_v2bf16:
6505 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6506 ; GFX90A-NEXT: ds_read_b32 v3, v0
6507 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
6508 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6509 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
6510 ; GFX90A-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6511 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
6512 ; GFX90A-NEXT: .LBB26_1: ; %atomicrmw.start
6513 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
6514 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
6515 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6516 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6517 ; GFX90A-NEXT: v_min_f32_e32 v4, v4, v2
6518 ; GFX90A-NEXT: v_min_f32_e32 v5, v5, v1
6519 ; GFX90A-NEXT: v_bfe_u32 v6, v4, 16, 1
6520 ; GFX90A-NEXT: v_bfe_u32 v8, v5, 16, 1
6521 ; GFX90A-NEXT: v_or_b32_e32 v7, 0x400000, v4
6522 ; GFX90A-NEXT: v_or_b32_e32 v9, 0x400000, v5
6523 ; GFX90A-NEXT: v_add3_u32 v6, v6, v4, s8
6524 ; GFX90A-NEXT: v_add3_u32 v8, v8, v5, s8
6525 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6526 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v4, v4
6527 ; GFX90A-NEXT: v_cndmask_b32_e64 v4, v6, v7, s[4:5]
6528 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6529 ; GFX90A-NEXT: v_perm_b32 v4, v5, v4, s9
6530 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
6531 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
6532 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6533 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
6534 ; GFX90A-NEXT: v_mov_b32_e32 v3, v4
6535 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
6536 ; GFX90A-NEXT: s_cbranch_execnz .LBB26_1
6537 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
6538 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
6539 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6541 ; GFX908-LABEL: local_atomic_fmin_noret_v2bf16:
6543 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6544 ; GFX908-NEXT: ds_read_b32 v3, v0
6545 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
6546 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6547 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
6548 ; GFX908-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6549 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
6550 ; GFX908-NEXT: .LBB26_1: ; %atomicrmw.start
6551 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6552 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
6553 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6554 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6555 ; GFX908-NEXT: v_min_f32_e32 v4, v4, v2
6556 ; GFX908-NEXT: v_min_f32_e32 v5, v5, v1
6557 ; GFX908-NEXT: v_bfe_u32 v6, v4, 16, 1
6558 ; GFX908-NEXT: v_bfe_u32 v8, v5, 16, 1
6559 ; GFX908-NEXT: v_or_b32_e32 v7, 0x400000, v4
6560 ; GFX908-NEXT: v_or_b32_e32 v9, 0x400000, v5
6561 ; GFX908-NEXT: v_add3_u32 v6, v6, v4, s8
6562 ; GFX908-NEXT: v_add3_u32 v8, v8, v5, s8
6563 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6564 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v4, v4
6565 ; GFX908-NEXT: v_cndmask_b32_e64 v4, v6, v7, s[4:5]
6566 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6567 ; GFX908-NEXT: v_perm_b32 v4, v5, v4, s9
6568 ; GFX908-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
6569 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
6570 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6571 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
6572 ; GFX908-NEXT: v_mov_b32_e32 v3, v4
6573 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
6574 ; GFX908-NEXT: s_cbranch_execnz .LBB26_1
6575 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6576 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
6577 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6579 ; GFX8-LABEL: local_atomic_fmin_noret_v2bf16:
6581 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6582 ; GFX8-NEXT: s_mov_b32 m0, -1
6583 ; GFX8-NEXT: ds_read_b32 v3, v0
6584 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
6585 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6586 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6587 ; GFX8-NEXT: .LBB26_1: ; %atomicrmw.start
6588 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6589 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
6590 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6591 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6592 ; GFX8-NEXT: v_min_f32_e32 v4, v4, v2
6593 ; GFX8-NEXT: v_min_f32_e32 v5, v5, v1
6594 ; GFX8-NEXT: v_bfe_u32 v6, v4, 16, 1
6595 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
6596 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v4
6597 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
6598 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
6599 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
6600 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
6601 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6602 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v4
6603 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v4, v4
6604 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6605 ; GFX8-NEXT: v_cndmask_b32_e64 v4, v6, v7, s[4:5]
6606 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
6607 ; GFX8-NEXT: v_alignbit_b32 v4, v5, v4, 16
6608 ; GFX8-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4
6609 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
6610 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6611 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
6612 ; GFX8-NEXT: v_mov_b32_e32 v3, v4
6613 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
6614 ; GFX8-NEXT: s_cbranch_execnz .LBB26_1
6615 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6616 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
6617 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6619 ; GFX7-LABEL: local_atomic_fmin_noret_v2bf16:
6621 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6622 ; GFX7-NEXT: s_mov_b32 m0, -1
6623 ; GFX7-NEXT: ds_read_b32 v3, v0
6624 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
6625 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v1
6626 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
6627 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
6628 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6629 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
6630 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
6631 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6632 ; GFX7-NEXT: .LBB26_1: ; %atomicrmw.start
6633 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6634 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
6635 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
6636 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
6637 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
6638 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
6639 ; GFX7-NEXT: v_min_f32_e32 v5, v5, v2
6640 ; GFX7-NEXT: v_min_f32_e32 v6, v6, v1
6641 ; GFX7-NEXT: v_alignbit_b32 v3, v4, v3, 16
6642 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v5
6643 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v6, 16
6644 ; GFX7-NEXT: ds_cmpst_rtn_b32 v5, v0, v3, v4
6645 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6646 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
6647 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
6648 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6649 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
6650 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
6651 ; GFX7-NEXT: s_cbranch_execnz .LBB26_1
6652 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6653 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
6654 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6656 ; GFX6-LABEL: local_atomic_fmin_noret_v2bf16:
6658 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6659 ; GFX6-NEXT: s_mov_b32 m0, -1
6660 ; GFX6-NEXT: ds_read_b32 v3, v0
6661 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
6662 ; GFX6-NEXT: v_mul_f32_e32 v1, 1.0, v1
6663 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
6664 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
6665 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6666 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
6667 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
6668 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6669 ; GFX6-NEXT: .LBB26_1: ; %atomicrmw.start
6670 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
6671 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v4
6672 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
6673 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
6674 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
6675 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v4
6676 ; GFX6-NEXT: v_min_f32_e32 v5, v5, v2
6677 ; GFX6-NEXT: v_min_f32_e32 v6, v6, v1
6678 ; GFX6-NEXT: v_alignbit_b32 v3, v4, v3, 16
6679 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v5
6680 ; GFX6-NEXT: v_alignbit_b32 v4, v4, v6, 16
6681 ; GFX6-NEXT: ds_cmpst_rtn_b32 v5, v0, v3, v4
6682 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6683 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
6684 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
6685 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6686 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v5
6687 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
6688 ; GFX6-NEXT: s_cbranch_execnz .LBB26_1
6689 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
6690 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
6691 ; GFX6-NEXT: s_setpc_b64 s[30:31]
6692 %result = atomicrmw fmin ptr addrspace(3) %ptr, <2 x bfloat> %val seq_cst
6696 define void @local_atomic_fmin_noret_v2bf16__ofset(ptr addrspace(3) %ptr, <2 x bfloat> %val) {
6697 ; GFX12-LABEL: local_atomic_fmin_noret_v2bf16__ofset:
6699 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6700 ; GFX12-NEXT: s_wait_expcnt 0x0
6701 ; GFX12-NEXT: s_wait_samplecnt 0x0
6702 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6703 ; GFX12-NEXT: s_wait_kmcnt 0x0
6704 ; GFX12-NEXT: ds_load_b32 v3, v0 offset:65532
6705 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6706 ; GFX12-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6707 ; GFX12-NEXT: s_mov_b32 s1, 0
6708 ; GFX12-NEXT: .LBB27_1: ; %atomicrmw.start
6709 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6710 ; GFX12-NEXT: s_wait_dscnt 0x0
6711 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6712 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6713 ; GFX12-NEXT: v_dual_min_num_f32 v5, v5, v1 :: v_dual_lshlrev_b32 v4, 16, v3
6714 ; GFX12-NEXT: v_min_num_f32_e32 v4, v4, v2
6715 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
6716 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
6717 ; GFX12-NEXT: v_bfe_u32 v6, v4, 16, 1
6718 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v4
6719 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v5
6720 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
6721 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
6722 ; GFX12-NEXT: v_add3_u32 v6, v6, v4, 0x7fff
6723 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v4, v4
6724 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
6725 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v9, vcc_lo
6726 ; GFX12-NEXT: v_cndmask_b32_e64 v4, v6, v8, s0
6727 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
6728 ; GFX12-NEXT: v_perm_b32 v4, v5, v4, 0x7060302
6729 ; GFX12-NEXT: global_wb scope:SCOPE_SE
6730 ; GFX12-NEXT: s_wait_storecnt 0x0
6731 ; GFX12-NEXT: ds_cmpstore_rtn_b32 v4, v0, v4, v3 offset:65532
6732 ; GFX12-NEXT: s_wait_dscnt 0x0
6733 ; GFX12-NEXT: global_inv scope:SCOPE_SE
6734 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
6735 ; GFX12-NEXT: v_mov_b32_e32 v3, v4
6736 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
6737 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6738 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
6739 ; GFX12-NEXT: s_cbranch_execnz .LBB27_1
6740 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6741 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
6742 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6744 ; GFX940-LABEL: local_atomic_fmin_noret_v2bf16__ofset:
6746 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6747 ; GFX940-NEXT: ds_read_b32 v3, v0 offset:65532
6748 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
6749 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6750 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
6751 ; GFX940-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6752 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
6753 ; GFX940-NEXT: .LBB27_1: ; %atomicrmw.start
6754 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
6755 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
6756 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6757 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6758 ; GFX940-NEXT: v_min_f32_e32 v4, v4, v2
6759 ; GFX940-NEXT: v_min_f32_e32 v5, v5, v1
6760 ; GFX940-NEXT: v_bfe_u32 v6, v4, 16, 1
6761 ; GFX940-NEXT: v_bfe_u32 v8, v5, 16, 1
6762 ; GFX940-NEXT: v_or_b32_e32 v7, 0x400000, v4
6763 ; GFX940-NEXT: v_or_b32_e32 v9, 0x400000, v5
6764 ; GFX940-NEXT: v_add3_u32 v6, v6, v4, s4
6765 ; GFX940-NEXT: v_add3_u32 v8, v8, v5, s4
6766 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6767 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v4, v4
6768 ; GFX940-NEXT: s_nop 0
6769 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6770 ; GFX940-NEXT: v_cndmask_b32_e64 v4, v6, v7, s[0:1]
6771 ; GFX940-NEXT: v_perm_b32 v4, v5, v4, s5
6772 ; GFX940-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4 offset:65532
6773 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
6774 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6775 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
6776 ; GFX940-NEXT: v_mov_b32_e32 v3, v4
6777 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
6778 ; GFX940-NEXT: s_cbranch_execnz .LBB27_1
6779 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
6780 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
6781 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6783 ; GFX11-LABEL: local_atomic_fmin_noret_v2bf16__ofset:
6785 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6786 ; GFX11-NEXT: ds_load_b32 v3, v0 offset:65532
6787 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6788 ; GFX11-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6789 ; GFX11-NEXT: s_mov_b32 s1, 0
6790 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
6791 ; GFX11-NEXT: .p2align 6
6792 ; GFX11-NEXT: .LBB27_1: ; %atomicrmw.start
6793 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6794 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
6795 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6796 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6797 ; GFX11-NEXT: v_dual_min_f32 v5, v5, v1 :: v_dual_lshlrev_b32 v4, 16, v3
6798 ; GFX11-NEXT: v_min_f32_e32 v4, v4, v2
6799 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
6800 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
6801 ; GFX11-NEXT: v_bfe_u32 v6, v4, 16, 1
6802 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v4
6803 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v5
6804 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
6805 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
6806 ; GFX11-NEXT: v_add3_u32 v6, v6, v4, 0x7fff
6807 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v4, v4
6808 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
6809 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v9, vcc_lo
6810 ; GFX11-NEXT: v_cndmask_b32_e64 v4, v6, v8, s0
6811 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
6812 ; GFX11-NEXT: v_perm_b32 v4, v5, v4, 0x7060302
6813 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6814 ; GFX11-NEXT: ds_cmpstore_rtn_b32 v4, v0, v4, v3 offset:65532
6815 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
6816 ; GFX11-NEXT: buffer_gl0_inv
6817 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
6818 ; GFX11-NEXT: v_mov_b32_e32 v3, v4
6819 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
6820 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6821 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
6822 ; GFX11-NEXT: s_cbranch_execnz .LBB27_1
6823 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6824 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
6825 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
6826 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6828 ; GFX10-LABEL: local_atomic_fmin_noret_v2bf16__ofset:
6830 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6831 ; GFX10-NEXT: ds_read_b32 v3, v0 offset:65532
6832 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6833 ; GFX10-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6834 ; GFX10-NEXT: s_mov_b32 s5, 0
6835 ; GFX10-NEXT: .LBB27_1: ; %atomicrmw.start
6836 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6837 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
6838 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6839 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6840 ; GFX10-NEXT: v_min_f32_e32 v4, v4, v2
6841 ; GFX10-NEXT: v_min_f32_e32 v5, v5, v1
6842 ; GFX10-NEXT: v_bfe_u32 v6, v4, 16, 1
6843 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
6844 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v4
6845 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v5
6846 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
6847 ; GFX10-NEXT: v_add3_u32 v6, v6, v4, 0x7fff
6848 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
6849 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v4, v4
6850 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v9, vcc_lo
6851 ; GFX10-NEXT: v_cndmask_b32_e64 v4, v6, v8, s4
6852 ; GFX10-NEXT: v_perm_b32 v4, v5, v4, 0x7060302
6853 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6854 ; GFX10-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4 offset:65532
6855 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
6856 ; GFX10-NEXT: buffer_gl0_inv
6857 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v4, v3
6858 ; GFX10-NEXT: v_mov_b32_e32 v3, v4
6859 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
6860 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
6861 ; GFX10-NEXT: s_cbranch_execnz .LBB27_1
6862 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6863 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
6864 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6866 ; GFX90A-LABEL: local_atomic_fmin_noret_v2bf16__ofset:
6868 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6869 ; GFX90A-NEXT: ds_read_b32 v3, v0 offset:65532
6870 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
6871 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6872 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
6873 ; GFX90A-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6874 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
6875 ; GFX90A-NEXT: .LBB27_1: ; %atomicrmw.start
6876 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
6877 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
6878 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6879 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6880 ; GFX90A-NEXT: v_min_f32_e32 v4, v4, v2
6881 ; GFX90A-NEXT: v_min_f32_e32 v5, v5, v1
6882 ; GFX90A-NEXT: v_bfe_u32 v6, v4, 16, 1
6883 ; GFX90A-NEXT: v_bfe_u32 v8, v5, 16, 1
6884 ; GFX90A-NEXT: v_or_b32_e32 v7, 0x400000, v4
6885 ; GFX90A-NEXT: v_or_b32_e32 v9, 0x400000, v5
6886 ; GFX90A-NEXT: v_add3_u32 v6, v6, v4, s8
6887 ; GFX90A-NEXT: v_add3_u32 v8, v8, v5, s8
6888 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6889 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v4, v4
6890 ; GFX90A-NEXT: v_cndmask_b32_e64 v4, v6, v7, s[4:5]
6891 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6892 ; GFX90A-NEXT: v_perm_b32 v4, v5, v4, s9
6893 ; GFX90A-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4 offset:65532
6894 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
6895 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6896 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
6897 ; GFX90A-NEXT: v_mov_b32_e32 v3, v4
6898 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
6899 ; GFX90A-NEXT: s_cbranch_execnz .LBB27_1
6900 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
6901 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
6902 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6904 ; GFX908-LABEL: local_atomic_fmin_noret_v2bf16__ofset:
6906 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6907 ; GFX908-NEXT: ds_read_b32 v3, v0 offset:65532
6908 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
6909 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6910 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
6911 ; GFX908-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6912 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
6913 ; GFX908-NEXT: .LBB27_1: ; %atomicrmw.start
6914 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6915 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
6916 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6917 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6918 ; GFX908-NEXT: v_min_f32_e32 v4, v4, v2
6919 ; GFX908-NEXT: v_min_f32_e32 v5, v5, v1
6920 ; GFX908-NEXT: v_bfe_u32 v6, v4, 16, 1
6921 ; GFX908-NEXT: v_bfe_u32 v8, v5, 16, 1
6922 ; GFX908-NEXT: v_or_b32_e32 v7, 0x400000, v4
6923 ; GFX908-NEXT: v_or_b32_e32 v9, 0x400000, v5
6924 ; GFX908-NEXT: v_add3_u32 v6, v6, v4, s8
6925 ; GFX908-NEXT: v_add3_u32 v8, v8, v5, s8
6926 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6927 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v4, v4
6928 ; GFX908-NEXT: v_cndmask_b32_e64 v4, v6, v7, s[4:5]
6929 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6930 ; GFX908-NEXT: v_perm_b32 v4, v5, v4, s9
6931 ; GFX908-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4 offset:65532
6932 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
6933 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6934 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
6935 ; GFX908-NEXT: v_mov_b32_e32 v3, v4
6936 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
6937 ; GFX908-NEXT: s_cbranch_execnz .LBB27_1
6938 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6939 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
6940 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6942 ; GFX8-LABEL: local_atomic_fmin_noret_v2bf16__ofset:
6944 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6945 ; GFX8-NEXT: s_mov_b32 m0, -1
6946 ; GFX8-NEXT: ds_read_b32 v3, v0 offset:65532
6947 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
6948 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v1
6949 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6950 ; GFX8-NEXT: .LBB27_1: ; %atomicrmw.start
6951 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6952 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
6953 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v3
6954 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6955 ; GFX8-NEXT: v_min_f32_e32 v4, v4, v2
6956 ; GFX8-NEXT: v_min_f32_e32 v5, v5, v1
6957 ; GFX8-NEXT: v_bfe_u32 v6, v4, 16, 1
6958 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
6959 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v4
6960 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
6961 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
6962 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
6963 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
6964 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
6965 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v4
6966 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v4, v4
6967 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
6968 ; GFX8-NEXT: v_cndmask_b32_e64 v4, v6, v7, s[4:5]
6969 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
6970 ; GFX8-NEXT: v_alignbit_b32 v4, v5, v4, 16
6971 ; GFX8-NEXT: ds_cmpst_rtn_b32 v4, v0, v3, v4 offset:65532
6972 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
6973 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6974 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
6975 ; GFX8-NEXT: v_mov_b32_e32 v3, v4
6976 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
6977 ; GFX8-NEXT: s_cbranch_execnz .LBB27_1
6978 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6979 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
6980 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6982 ; GFX7-LABEL: local_atomic_fmin_noret_v2bf16__ofset:
6984 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6985 ; GFX7-NEXT: s_mov_b32 m0, -1
6986 ; GFX7-NEXT: ds_read_b32 v3, v0 offset:65532
6987 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
6988 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v1
6989 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
6990 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
6991 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6992 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
6993 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
6994 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
6995 ; GFX7-NEXT: .LBB27_1: ; %atomicrmw.start
6996 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6997 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
6998 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
6999 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
7000 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
7001 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
7002 ; GFX7-NEXT: v_min_f32_e32 v5, v5, v2
7003 ; GFX7-NEXT: v_min_f32_e32 v6, v6, v1
7004 ; GFX7-NEXT: v_alignbit_b32 v3, v4, v3, 16
7005 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v5
7006 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v6, 16
7007 ; GFX7-NEXT: ds_cmpst_rtn_b32 v5, v0, v3, v4 offset:65532
7008 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7009 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
7010 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
7011 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7012 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
7013 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
7014 ; GFX7-NEXT: s_cbranch_execnz .LBB27_1
7015 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
7016 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
7017 ; GFX7-NEXT: s_setpc_b64 s[30:31]
7019 ; GFX6-LABEL: local_atomic_fmin_noret_v2bf16__ofset:
7021 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7022 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffc, v0
7023 ; GFX6-NEXT: s_mov_b32 m0, -1
7024 ; GFX6-NEXT: ds_read_b32 v3, v0
7025 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
7026 ; GFX6-NEXT: v_mul_f32_e32 v1, 1.0, v1
7027 ; GFX6-NEXT: s_mov_b64 s[4:5], 0
7028 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
7029 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7030 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
7031 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
7032 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff0000, v1
7033 ; GFX6-NEXT: .LBB27_1: ; %atomicrmw.start
7034 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
7035 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v4
7036 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
7037 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
7038 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
7039 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v4
7040 ; GFX6-NEXT: v_min_f32_e32 v5, v5, v2
7041 ; GFX6-NEXT: v_min_f32_e32 v6, v6, v1
7042 ; GFX6-NEXT: v_alignbit_b32 v3, v4, v3, 16
7043 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v5
7044 ; GFX6-NEXT: v_alignbit_b32 v4, v4, v6, 16
7045 ; GFX6-NEXT: ds_cmpst_rtn_b32 v5, v0, v3, v4
7046 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7047 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
7048 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
7049 ; GFX6-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7050 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v5
7051 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[4:5]
7052 ; GFX6-NEXT: s_cbranch_execnz .LBB27_1
7053 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
7054 ; GFX6-NEXT: s_or_b64 exec, exec, s[4:5]
7055 ; GFX6-NEXT: s_setpc_b64 s[30:31]
7056 %gep = getelementptr <2 x bfloat>, ptr addrspace(3) %ptr, i32 16383
7057 %result = atomicrmw fmin ptr addrspace(3) %gep, <2 x bfloat> %val seq_cst
7061 ; --------------------------------------------------------------------
7063 ; --------------------------------------------------------------------
7065 define float @local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode(ptr addrspace(3) %ptr) {
7066 ; GFX12-LABEL: local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode:
7068 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7069 ; GFX12-NEXT: s_wait_expcnt 0x0
7070 ; GFX12-NEXT: s_wait_samplecnt 0x0
7071 ; GFX12-NEXT: s_wait_bvhcnt 0x0
7072 ; GFX12-NEXT: s_wait_kmcnt 0x0
7073 ; GFX12-NEXT: v_mov_b32_e32 v1, 4.0
7074 ; GFX12-NEXT: global_wb scope:SCOPE_SE
7075 ; GFX12-NEXT: s_wait_storecnt 0x0
7076 ; GFX12-NEXT: ds_min_num_rtn_f32 v0, v0, v1
7077 ; GFX12-NEXT: s_wait_dscnt 0x0
7078 ; GFX12-NEXT: global_inv scope:SCOPE_SE
7079 ; GFX12-NEXT: s_setpc_b64 s[30:31]
7081 ; GFX940-LABEL: local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode:
7083 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7084 ; GFX940-NEXT: v_mov_b32_e32 v1, 4.0
7085 ; GFX940-NEXT: ds_min_rtn_f32 v0, v0, v1
7086 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
7087 ; GFX940-NEXT: s_setpc_b64 s[30:31]
7089 ; GFX11-LABEL: local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode:
7091 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7092 ; GFX11-NEXT: v_mov_b32_e32 v1, 4.0
7093 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
7094 ; GFX11-NEXT: ds_min_rtn_f32 v0, v0, v1
7095 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
7096 ; GFX11-NEXT: buffer_gl0_inv
7097 ; GFX11-NEXT: s_setpc_b64 s[30:31]
7099 ; GFX10-LABEL: local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode:
7101 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7102 ; GFX10-NEXT: v_mov_b32_e32 v1, 4.0
7103 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
7104 ; GFX10-NEXT: ds_min_rtn_f32 v0, v0, v1
7105 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
7106 ; GFX10-NEXT: buffer_gl0_inv
7107 ; GFX10-NEXT: s_setpc_b64 s[30:31]
7109 ; GFX90A-LABEL: local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode:
7111 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7112 ; GFX90A-NEXT: v_mov_b32_e32 v1, 4.0
7113 ; GFX90A-NEXT: ds_min_rtn_f32 v0, v0, v1
7114 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
7115 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
7117 ; GFX908-LABEL: local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode:
7119 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7120 ; GFX908-NEXT: v_mov_b32_e32 v1, 4.0
7121 ; GFX908-NEXT: ds_min_rtn_f32 v0, v0, v1
7122 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
7123 ; GFX908-NEXT: s_setpc_b64 s[30:31]
7125 ; GFX8-LABEL: local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode:
7127 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7128 ; GFX8-NEXT: v_mov_b32_e32 v1, 4.0
7129 ; GFX8-NEXT: s_mov_b32 m0, -1
7130 ; GFX8-NEXT: ds_min_rtn_f32 v0, v0, v1
7131 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
7132 ; GFX8-NEXT: s_setpc_b64 s[30:31]
7134 ; GFX7-LABEL: local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode:
7136 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7137 ; GFX7-NEXT: v_mov_b32_e32 v1, 4.0
7138 ; GFX7-NEXT: s_mov_b32 m0, -1
7139 ; GFX7-NEXT: ds_min_rtn_f32 v0, v0, v1
7140 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7141 ; GFX7-NEXT: s_setpc_b64 s[30:31]
7143 ; GFX6-LABEL: local_atomic_fmin_ret_f32__amdgpu_ignore_denormal_mode:
7145 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7146 ; GFX6-NEXT: v_mov_b32_e32 v1, 4.0
7147 ; GFX6-NEXT: s_mov_b32 m0, -1
7148 ; GFX6-NEXT: ds_min_rtn_f32 v0, v0, v1
7149 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7150 ; GFX6-NEXT: s_setpc_b64 s[30:31]
7151 %result = atomicrmw fmin ptr addrspace(3) %ptr, float 4.0 seq_cst, !amdgpu.ignore.denormal.mode !0
7155 define void @local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode(ptr addrspace(3) %ptr) {
7156 ; GFX12-LABEL: local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode:
7158 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7159 ; GFX12-NEXT: s_wait_expcnt 0x0
7160 ; GFX12-NEXT: s_wait_samplecnt 0x0
7161 ; GFX12-NEXT: s_wait_bvhcnt 0x0
7162 ; GFX12-NEXT: s_wait_kmcnt 0x0
7163 ; GFX12-NEXT: v_mov_b32_e32 v1, 4.0
7164 ; GFX12-NEXT: global_wb scope:SCOPE_SE
7165 ; GFX12-NEXT: s_wait_storecnt 0x0
7166 ; GFX12-NEXT: ds_min_num_f32 v0, v1
7167 ; GFX12-NEXT: s_wait_dscnt 0x0
7168 ; GFX12-NEXT: global_inv scope:SCOPE_SE
7169 ; GFX12-NEXT: s_setpc_b64 s[30:31]
7171 ; GFX940-LABEL: local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode:
7173 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7174 ; GFX940-NEXT: v_mov_b32_e32 v1, 4.0
7175 ; GFX940-NEXT: ds_min_f32 v0, v1
7176 ; GFX940-NEXT: s_waitcnt lgkmcnt(0)
7177 ; GFX940-NEXT: s_setpc_b64 s[30:31]
7179 ; GFX11-LABEL: local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode:
7181 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7182 ; GFX11-NEXT: v_mov_b32_e32 v1, 4.0
7183 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
7184 ; GFX11-NEXT: ds_min_f32 v0, v1
7185 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
7186 ; GFX11-NEXT: buffer_gl0_inv
7187 ; GFX11-NEXT: s_setpc_b64 s[30:31]
7189 ; GFX10-LABEL: local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode:
7191 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7192 ; GFX10-NEXT: v_mov_b32_e32 v1, 4.0
7193 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
7194 ; GFX10-NEXT: ds_min_f32 v0, v1
7195 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
7196 ; GFX10-NEXT: buffer_gl0_inv
7197 ; GFX10-NEXT: s_setpc_b64 s[30:31]
7199 ; GFX90A-LABEL: local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode:
7201 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7202 ; GFX90A-NEXT: v_mov_b32_e32 v1, 4.0
7203 ; GFX90A-NEXT: ds_min_f32 v0, v1
7204 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
7205 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
7207 ; GFX908-LABEL: local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode:
7209 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7210 ; GFX908-NEXT: v_mov_b32_e32 v1, 4.0
7211 ; GFX908-NEXT: ds_min_f32 v0, v1
7212 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
7213 ; GFX908-NEXT: s_setpc_b64 s[30:31]
7215 ; GFX8-LABEL: local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode:
7217 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7218 ; GFX8-NEXT: v_mov_b32_e32 v1, 4.0
7219 ; GFX8-NEXT: s_mov_b32 m0, -1
7220 ; GFX8-NEXT: ds_min_f32 v0, v1
7221 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
7222 ; GFX8-NEXT: s_setpc_b64 s[30:31]
7224 ; GFX7-LABEL: local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode:
7226 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7227 ; GFX7-NEXT: v_mov_b32_e32 v1, 4.0
7228 ; GFX7-NEXT: s_mov_b32 m0, -1
7229 ; GFX7-NEXT: ds_min_f32 v0, v1
7230 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7231 ; GFX7-NEXT: s_setpc_b64 s[30:31]
7233 ; GFX6-LABEL: local_atomic_fmin_noret_f32__amdgpu_ignore_denormal_mode:
7235 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7236 ; GFX6-NEXT: v_mov_b32_e32 v1, 4.0
7237 ; GFX6-NEXT: s_mov_b32 m0, -1
7238 ; GFX6-NEXT: ds_min_f32 v0, v1
7239 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7240 ; GFX6-NEXT: s_setpc_b64 s[30:31]
7241 %result = atomicrmw fmin ptr addrspace(3) %ptr, float 4.0 seq_cst, !amdgpu.ignore.denormal.mode !0