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 @global_agent_atomic_fmax_ret_f32(ptr addrspace(1) %ptr, float %val) #0 {
17 ; GFX12-LABEL: global_agent_atomic_fmax_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: global_wb scope:SCOPE_DEV
25 ; GFX12-NEXT: s_wait_storecnt 0x0
26 ; GFX12-NEXT: global_atomic_max_num_f32 v0, v[0:1], v2, off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
27 ; GFX12-NEXT: s_wait_loadcnt 0x0
28 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
29 ; GFX12-NEXT: s_setpc_b64 s[30:31]
31 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f32:
33 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
34 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
35 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
36 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v2
37 ; GFX940-NEXT: .LBB0_1: ; %atomicrmw.start
38 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
39 ; GFX940-NEXT: s_waitcnt vmcnt(0)
40 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
41 ; GFX940-NEXT: v_max_f32_e32 v3, v5, v5
42 ; GFX940-NEXT: v_max_f32_e32 v4, v3, v2
43 ; GFX940-NEXT: buffer_wbl2 sc1
44 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off sc0
45 ; GFX940-NEXT: s_waitcnt vmcnt(0)
46 ; GFX940-NEXT: buffer_inv sc1
47 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
48 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
49 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
50 ; GFX940-NEXT: s_cbranch_execnz .LBB0_1
51 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
52 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
53 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
54 ; GFX940-NEXT: s_setpc_b64 s[30:31]
56 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f32:
58 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
59 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
60 ; GFX11-NEXT: global_atomic_max_f32 v0, v[0:1], v2, off glc
61 ; GFX11-NEXT: s_waitcnt vmcnt(0)
62 ; GFX11-NEXT: buffer_gl1_inv
63 ; GFX11-NEXT: buffer_gl0_inv
64 ; GFX11-NEXT: s_setpc_b64 s[30:31]
66 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f32:
68 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
69 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
70 ; GFX10-NEXT: global_atomic_fmax v0, v[0:1], v2, off glc
71 ; GFX10-NEXT: s_waitcnt vmcnt(0)
72 ; GFX10-NEXT: buffer_gl1_inv
73 ; GFX10-NEXT: buffer_gl0_inv
74 ; GFX10-NEXT: s_setpc_b64 s[30:31]
76 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f32:
78 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
79 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
80 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
81 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v2
82 ; GFX90A-NEXT: .LBB0_1: ; %atomicrmw.start
83 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
84 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
85 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
86 ; GFX90A-NEXT: v_max_f32_e32 v3, v5, v5
87 ; GFX90A-NEXT: v_max_f32_e32 v4, v3, v2
88 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off glc
89 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
90 ; GFX90A-NEXT: buffer_wbinvl1
91 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
92 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
93 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
94 ; GFX90A-NEXT: s_cbranch_execnz .LBB0_1
95 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
96 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
97 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
98 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
100 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f32:
102 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
103 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
104 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
105 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v2
106 ; GFX908-NEXT: .LBB0_1: ; %atomicrmw.start
107 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
108 ; GFX908-NEXT: s_waitcnt vmcnt(0)
109 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
110 ; GFX908-NEXT: v_max_f32_e32 v3, v4, v4
111 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
112 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off glc
113 ; GFX908-NEXT: s_waitcnt vmcnt(0)
114 ; GFX908-NEXT: buffer_wbinvl1
115 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
116 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
117 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
118 ; GFX908-NEXT: s_cbranch_execnz .LBB0_1
119 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
120 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
121 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
122 ; GFX908-NEXT: s_setpc_b64 s[30:31]
124 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f32:
126 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
127 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
128 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
129 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v2
130 ; GFX8-NEXT: .LBB0_1: ; %atomicrmw.start
131 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
132 ; GFX8-NEXT: s_waitcnt vmcnt(0)
133 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
134 ; GFX8-NEXT: v_mul_f32_e32 v3, 1.0, v4
135 ; GFX8-NEXT: v_max_f32_e32 v3, v3, v2
136 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
137 ; GFX8-NEXT: s_waitcnt vmcnt(0)
138 ; GFX8-NEXT: buffer_wbinvl1
139 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
140 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
141 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
142 ; GFX8-NEXT: s_cbranch_execnz .LBB0_1
143 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
144 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
145 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
146 ; GFX8-NEXT: s_setpc_b64 s[30:31]
148 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f32:
150 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
151 ; GFX7-NEXT: s_mov_b32 s6, 0
152 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
153 ; GFX7-NEXT: s_mov_b32 s4, s6
154 ; GFX7-NEXT: s_mov_b32 s5, s6
155 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 glc
156 ; GFX7-NEXT: s_waitcnt vmcnt(0)
157 ; GFX7-NEXT: buffer_wbinvl1
158 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
159 ; GFX7-NEXT: s_setpc_b64 s[30:31]
161 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f32:
163 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
164 ; GFX6-NEXT: s_mov_b32 s6, 0
165 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
166 ; GFX6-NEXT: s_mov_b32 s4, s6
167 ; GFX6-NEXT: s_mov_b32 s5, s6
168 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 glc
169 ; GFX6-NEXT: s_waitcnt vmcnt(0)
170 ; GFX6-NEXT: buffer_wbinvl1
171 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
172 ; GFX6-NEXT: s_waitcnt expcnt(0)
173 ; GFX6-NEXT: s_setpc_b64 s[30:31]
174 %result = atomicrmw fmax ptr addrspace(1) %ptr, float %val syncscope("agent") seq_cst
178 define float @global_agent_atomic_fmax_ret_f32__offset12b_pos(ptr addrspace(1) %ptr, float %val) #0 {
179 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos:
181 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
182 ; GFX12-NEXT: s_wait_expcnt 0x0
183 ; GFX12-NEXT: s_wait_samplecnt 0x0
184 ; GFX12-NEXT: s_wait_bvhcnt 0x0
185 ; GFX12-NEXT: s_wait_kmcnt 0x0
186 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
187 ; GFX12-NEXT: s_wait_storecnt 0x0
188 ; GFX12-NEXT: global_atomic_max_num_f32 v0, v[0:1], v2, off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
189 ; GFX12-NEXT: s_wait_loadcnt 0x0
190 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
191 ; GFX12-NEXT: s_setpc_b64 s[30:31]
193 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos:
195 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
196 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
197 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
198 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v2
199 ; GFX940-NEXT: .LBB1_1: ; %atomicrmw.start
200 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
201 ; GFX940-NEXT: s_waitcnt vmcnt(0)
202 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
203 ; GFX940-NEXT: v_max_f32_e32 v3, v5, v5
204 ; GFX940-NEXT: v_max_f32_e32 v4, v3, v2
205 ; GFX940-NEXT: buffer_wbl2 sc1
206 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 sc0
207 ; GFX940-NEXT: s_waitcnt vmcnt(0)
208 ; GFX940-NEXT: buffer_inv sc1
209 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
210 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
211 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
212 ; GFX940-NEXT: s_cbranch_execnz .LBB1_1
213 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
214 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
215 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
216 ; GFX940-NEXT: s_setpc_b64 s[30:31]
218 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos:
220 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
221 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
222 ; GFX11-NEXT: global_atomic_max_f32 v0, v[0:1], v2, off offset:2044 glc
223 ; GFX11-NEXT: s_waitcnt vmcnt(0)
224 ; GFX11-NEXT: buffer_gl1_inv
225 ; GFX11-NEXT: buffer_gl0_inv
226 ; GFX11-NEXT: s_setpc_b64 s[30:31]
228 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos:
230 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
231 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
232 ; GFX10-NEXT: global_atomic_fmax v0, v[0:1], v2, off offset:2044 glc
233 ; GFX10-NEXT: s_waitcnt vmcnt(0)
234 ; GFX10-NEXT: buffer_gl1_inv
235 ; GFX10-NEXT: buffer_gl0_inv
236 ; GFX10-NEXT: s_setpc_b64 s[30:31]
238 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos:
240 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
241 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
242 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
243 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v2
244 ; GFX90A-NEXT: .LBB1_1: ; %atomicrmw.start
245 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
246 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
247 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
248 ; GFX90A-NEXT: v_max_f32_e32 v3, v5, v5
249 ; GFX90A-NEXT: v_max_f32_e32 v4, v3, v2
250 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 glc
251 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
252 ; GFX90A-NEXT: buffer_wbinvl1
253 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
254 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
255 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
256 ; GFX90A-NEXT: s_cbranch_execnz .LBB1_1
257 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
258 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
259 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
260 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
262 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos:
264 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
265 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
266 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
267 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v2
268 ; GFX908-NEXT: .LBB1_1: ; %atomicrmw.start
269 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
270 ; GFX908-NEXT: s_waitcnt vmcnt(0)
271 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
272 ; GFX908-NEXT: v_max_f32_e32 v3, v4, v4
273 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
274 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
275 ; GFX908-NEXT: s_waitcnt vmcnt(0)
276 ; GFX908-NEXT: buffer_wbinvl1
277 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
278 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
279 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
280 ; GFX908-NEXT: s_cbranch_execnz .LBB1_1
281 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
282 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
283 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
284 ; GFX908-NEXT: s_setpc_b64 s[30:31]
286 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos:
288 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
289 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
290 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
291 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
292 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
293 ; GFX8-NEXT: v_mul_f32_e32 v1, 1.0, v2
294 ; GFX8-NEXT: .LBB1_1: ; %atomicrmw.start
295 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
296 ; GFX8-NEXT: s_waitcnt vmcnt(0)
297 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
298 ; GFX8-NEXT: v_mul_f32_e32 v0, 1.0, v6
299 ; GFX8-NEXT: v_max_f32_e32 v5, v0, v1
300 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
301 ; GFX8-NEXT: s_waitcnt vmcnt(0)
302 ; GFX8-NEXT: buffer_wbinvl1
303 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
304 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
305 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
306 ; GFX8-NEXT: s_cbranch_execnz .LBB1_1
307 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
308 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
309 ; GFX8-NEXT: s_setpc_b64 s[30:31]
311 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos:
313 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
314 ; GFX7-NEXT: s_mov_b32 s6, 0
315 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
316 ; GFX7-NEXT: s_mov_b32 s4, s6
317 ; GFX7-NEXT: s_mov_b32 s5, s6
318 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 offset:2044 glc
319 ; GFX7-NEXT: s_waitcnt vmcnt(0)
320 ; GFX7-NEXT: buffer_wbinvl1
321 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
322 ; GFX7-NEXT: s_setpc_b64 s[30:31]
324 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos:
326 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
327 ; GFX6-NEXT: s_mov_b32 s6, 0
328 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
329 ; GFX6-NEXT: s_mov_b32 s4, s6
330 ; GFX6-NEXT: s_mov_b32 s5, s6
331 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 offset:2044 glc
332 ; GFX6-NEXT: s_waitcnt vmcnt(0)
333 ; GFX6-NEXT: buffer_wbinvl1
334 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
335 ; GFX6-NEXT: s_waitcnt expcnt(0)
336 ; GFX6-NEXT: s_setpc_b64 s[30:31]
337 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 511
338 %result = atomicrmw fmax ptr addrspace(1) %gep, float %val syncscope("agent") seq_cst
342 define float @global_agent_atomic_fmax_ret_f32__offset12b_neg(ptr addrspace(1) %ptr, float %val) #0 {
343 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg:
345 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
346 ; GFX12-NEXT: s_wait_expcnt 0x0
347 ; GFX12-NEXT: s_wait_samplecnt 0x0
348 ; GFX12-NEXT: s_wait_bvhcnt 0x0
349 ; GFX12-NEXT: s_wait_kmcnt 0x0
350 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
351 ; GFX12-NEXT: s_wait_storecnt 0x0
352 ; GFX12-NEXT: global_atomic_max_num_f32 v0, v[0:1], v2, off offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
353 ; GFX12-NEXT: s_wait_loadcnt 0x0
354 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
355 ; GFX12-NEXT: s_setpc_b64 s[30:31]
357 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg:
359 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
360 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:-2048
361 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
362 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v2
363 ; GFX940-NEXT: .LBB2_1: ; %atomicrmw.start
364 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
365 ; GFX940-NEXT: s_waitcnt vmcnt(0)
366 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
367 ; GFX940-NEXT: v_max_f32_e32 v3, v5, v5
368 ; GFX940-NEXT: v_max_f32_e32 v4, v3, v2
369 ; GFX940-NEXT: buffer_wbl2 sc1
370 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:-2048 sc0
371 ; GFX940-NEXT: s_waitcnt vmcnt(0)
372 ; GFX940-NEXT: buffer_inv sc1
373 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
374 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
375 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
376 ; GFX940-NEXT: s_cbranch_execnz .LBB2_1
377 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
378 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
379 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
380 ; GFX940-NEXT: s_setpc_b64 s[30:31]
382 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg:
384 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
385 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
386 ; GFX11-NEXT: global_atomic_max_f32 v0, v[0:1], v2, off offset:-2048 glc
387 ; GFX11-NEXT: s_waitcnt vmcnt(0)
388 ; GFX11-NEXT: buffer_gl1_inv
389 ; GFX11-NEXT: buffer_gl0_inv
390 ; GFX11-NEXT: s_setpc_b64 s[30:31]
392 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg:
394 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
395 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
396 ; GFX10-NEXT: global_atomic_fmax v0, v[0:1], v2, off offset:-2048 glc
397 ; GFX10-NEXT: s_waitcnt vmcnt(0)
398 ; GFX10-NEXT: buffer_gl1_inv
399 ; GFX10-NEXT: buffer_gl0_inv
400 ; GFX10-NEXT: s_setpc_b64 s[30:31]
402 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg:
404 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
405 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:-2048
406 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
407 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v2
408 ; GFX90A-NEXT: .LBB2_1: ; %atomicrmw.start
409 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
410 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
411 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
412 ; GFX90A-NEXT: v_max_f32_e32 v3, v5, v5
413 ; GFX90A-NEXT: v_max_f32_e32 v4, v3, v2
414 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:-2048 glc
415 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
416 ; GFX90A-NEXT: buffer_wbinvl1
417 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
418 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
419 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
420 ; GFX90A-NEXT: s_cbranch_execnz .LBB2_1
421 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
422 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
423 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
424 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
426 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg:
428 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
429 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:-2048
430 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
431 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v2
432 ; GFX908-NEXT: .LBB2_1: ; %atomicrmw.start
433 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
434 ; GFX908-NEXT: s_waitcnt vmcnt(0)
435 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
436 ; GFX908-NEXT: v_max_f32_e32 v3, v4, v4
437 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
438 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:-2048 glc
439 ; GFX908-NEXT: s_waitcnt vmcnt(0)
440 ; GFX908-NEXT: buffer_wbinvl1
441 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
442 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
443 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
444 ; GFX908-NEXT: s_cbranch_execnz .LBB2_1
445 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
446 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
447 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
448 ; GFX908-NEXT: s_setpc_b64 s[30:31]
450 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg:
452 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
453 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
454 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
455 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
456 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
457 ; GFX8-NEXT: v_mul_f32_e32 v1, 1.0, v2
458 ; GFX8-NEXT: .LBB2_1: ; %atomicrmw.start
459 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
460 ; GFX8-NEXT: s_waitcnt vmcnt(0)
461 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
462 ; GFX8-NEXT: v_mul_f32_e32 v0, 1.0, v6
463 ; GFX8-NEXT: v_max_f32_e32 v5, v0, v1
464 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
465 ; GFX8-NEXT: s_waitcnt vmcnt(0)
466 ; GFX8-NEXT: buffer_wbinvl1
467 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
468 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
469 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
470 ; GFX8-NEXT: s_cbranch_execnz .LBB2_1
471 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
472 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
473 ; GFX8-NEXT: s_setpc_b64 s[30:31]
475 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg:
477 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
478 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
479 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
480 ; GFX7-NEXT: s_mov_b32 s6, 0
481 ; GFX7-NEXT: s_mov_b32 s5, -1
482 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 glc
483 ; GFX7-NEXT: s_waitcnt vmcnt(0)
484 ; GFX7-NEXT: buffer_wbinvl1
485 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
486 ; GFX7-NEXT: s_setpc_b64 s[30:31]
488 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg:
490 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
491 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
492 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
493 ; GFX6-NEXT: s_mov_b32 s6, 0
494 ; GFX6-NEXT: s_mov_b32 s5, -1
495 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 glc
496 ; GFX6-NEXT: s_waitcnt vmcnt(0)
497 ; GFX6-NEXT: buffer_wbinvl1
498 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
499 ; GFX6-NEXT: s_waitcnt expcnt(0)
500 ; GFX6-NEXT: s_setpc_b64 s[30:31]
501 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 -512
502 %result = atomicrmw fmax ptr addrspace(1) %gep, float %val syncscope("agent") seq_cst
506 define void @global_agent_atomic_fmax_noret_f32(ptr addrspace(1) %ptr, float %val) #0 {
507 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f32:
509 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
510 ; GFX12-NEXT: s_wait_expcnt 0x0
511 ; GFX12-NEXT: s_wait_samplecnt 0x0
512 ; GFX12-NEXT: s_wait_bvhcnt 0x0
513 ; GFX12-NEXT: s_wait_kmcnt 0x0
514 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
515 ; GFX12-NEXT: s_wait_storecnt 0x0
516 ; GFX12-NEXT: global_atomic_max_num_f32 v[0:1], v2, off scope:SCOPE_DEV
517 ; GFX12-NEXT: s_wait_storecnt 0x0
518 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
519 ; GFX12-NEXT: s_setpc_b64 s[30:31]
521 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f32:
523 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
524 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
525 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
526 ; GFX940-NEXT: v_max_f32_e32 v4, v2, v2
527 ; GFX940-NEXT: .LBB3_1: ; %atomicrmw.start
528 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
529 ; GFX940-NEXT: s_waitcnt vmcnt(0)
530 ; GFX940-NEXT: v_max_f32_e32 v2, v3, v3
531 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
532 ; GFX940-NEXT: buffer_wbl2 sc1
533 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0
534 ; GFX940-NEXT: s_waitcnt vmcnt(0)
535 ; GFX940-NEXT: buffer_inv sc1
536 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
537 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
538 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
539 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
540 ; GFX940-NEXT: s_cbranch_execnz .LBB3_1
541 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
542 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
543 ; GFX940-NEXT: s_setpc_b64 s[30:31]
545 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f32:
547 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
548 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
549 ; GFX11-NEXT: global_atomic_max_f32 v[0:1], v2, off
550 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
551 ; GFX11-NEXT: buffer_gl1_inv
552 ; GFX11-NEXT: buffer_gl0_inv
553 ; GFX11-NEXT: s_setpc_b64 s[30:31]
555 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f32:
557 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
558 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
559 ; GFX10-NEXT: global_atomic_fmax v[0:1], v2, off
560 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
561 ; GFX10-NEXT: buffer_gl1_inv
562 ; GFX10-NEXT: buffer_gl0_inv
563 ; GFX10-NEXT: s_setpc_b64 s[30:31]
565 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f32:
567 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
568 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
569 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
570 ; GFX90A-NEXT: v_max_f32_e32 v4, v2, v2
571 ; GFX90A-NEXT: .LBB3_1: ; %atomicrmw.start
572 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
573 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
574 ; GFX90A-NEXT: v_max_f32_e32 v2, v3, v3
575 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
576 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
577 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
578 ; GFX90A-NEXT: buffer_wbinvl1
579 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
580 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
581 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
582 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
583 ; GFX90A-NEXT: s_cbranch_execnz .LBB3_1
584 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
585 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
586 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
588 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f32:
590 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
591 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
592 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
593 ; GFX908-NEXT: v_max_f32_e32 v4, v2, v2
594 ; GFX908-NEXT: .LBB3_1: ; %atomicrmw.start
595 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
596 ; GFX908-NEXT: s_waitcnt vmcnt(0)
597 ; GFX908-NEXT: v_max_f32_e32 v2, v3, v3
598 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
599 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
600 ; GFX908-NEXT: s_waitcnt vmcnt(0)
601 ; GFX908-NEXT: buffer_wbinvl1
602 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
603 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
604 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
605 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
606 ; GFX908-NEXT: s_cbranch_execnz .LBB3_1
607 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
608 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
609 ; GFX908-NEXT: s_setpc_b64 s[30:31]
611 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f32:
613 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
614 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
615 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
616 ; GFX8-NEXT: v_mul_f32_e32 v4, 1.0, v2
617 ; GFX8-NEXT: .LBB3_1: ; %atomicrmw.start
618 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
619 ; GFX8-NEXT: s_waitcnt vmcnt(0)
620 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v3
621 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
622 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
623 ; GFX8-NEXT: s_waitcnt vmcnt(0)
624 ; GFX8-NEXT: buffer_wbinvl1
625 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
626 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
627 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
628 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
629 ; GFX8-NEXT: s_cbranch_execnz .LBB3_1
630 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
631 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
632 ; GFX8-NEXT: s_setpc_b64 s[30:31]
634 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f32:
636 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
637 ; GFX7-NEXT: s_mov_b32 s6, 0
638 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
639 ; GFX7-NEXT: s_mov_b32 s4, s6
640 ; GFX7-NEXT: s_mov_b32 s5, s6
641 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64
642 ; GFX7-NEXT: s_waitcnt vmcnt(0)
643 ; GFX7-NEXT: buffer_wbinvl1
644 ; GFX7-NEXT: s_setpc_b64 s[30:31]
646 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f32:
648 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
649 ; GFX6-NEXT: s_mov_b32 s6, 0
650 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
651 ; GFX6-NEXT: s_mov_b32 s4, s6
652 ; GFX6-NEXT: s_mov_b32 s5, s6
653 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64
654 ; GFX6-NEXT: s_waitcnt vmcnt(0)
655 ; GFX6-NEXT: buffer_wbinvl1
656 ; GFX6-NEXT: s_waitcnt expcnt(0)
657 ; GFX6-NEXT: s_setpc_b64 s[30:31]
658 %unused = atomicrmw fmax ptr addrspace(1) %ptr, float %val syncscope("agent") seq_cst
662 define void @global_agent_atomic_fmax_noret_f32__offset12b_pos(ptr addrspace(1) %ptr, float %val) #0 {
663 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos:
665 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
666 ; GFX12-NEXT: s_wait_expcnt 0x0
667 ; GFX12-NEXT: s_wait_samplecnt 0x0
668 ; GFX12-NEXT: s_wait_bvhcnt 0x0
669 ; GFX12-NEXT: s_wait_kmcnt 0x0
670 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
671 ; GFX12-NEXT: s_wait_storecnt 0x0
672 ; GFX12-NEXT: global_atomic_max_num_f32 v[0:1], v2, off offset:2044 scope:SCOPE_DEV
673 ; GFX12-NEXT: s_wait_storecnt 0x0
674 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
675 ; GFX12-NEXT: s_setpc_b64 s[30:31]
677 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos:
679 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
680 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
681 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
682 ; GFX940-NEXT: v_max_f32_e32 v4, v2, v2
683 ; GFX940-NEXT: .LBB4_1: ; %atomicrmw.start
684 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
685 ; GFX940-NEXT: s_waitcnt vmcnt(0)
686 ; GFX940-NEXT: v_max_f32_e32 v2, v3, v3
687 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
688 ; GFX940-NEXT: buffer_wbl2 sc1
689 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 sc0
690 ; GFX940-NEXT: s_waitcnt vmcnt(0)
691 ; GFX940-NEXT: buffer_inv sc1
692 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
693 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
694 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
695 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
696 ; GFX940-NEXT: s_cbranch_execnz .LBB4_1
697 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
698 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
699 ; GFX940-NEXT: s_setpc_b64 s[30:31]
701 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos:
703 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
704 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
705 ; GFX11-NEXT: global_atomic_max_f32 v[0:1], v2, off offset:2044
706 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
707 ; GFX11-NEXT: buffer_gl1_inv
708 ; GFX11-NEXT: buffer_gl0_inv
709 ; GFX11-NEXT: s_setpc_b64 s[30:31]
711 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos:
713 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
714 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
715 ; GFX10-NEXT: global_atomic_fmax v[0:1], v2, off offset:2044
716 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
717 ; GFX10-NEXT: buffer_gl1_inv
718 ; GFX10-NEXT: buffer_gl0_inv
719 ; GFX10-NEXT: s_setpc_b64 s[30:31]
721 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos:
723 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
724 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
725 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
726 ; GFX90A-NEXT: v_max_f32_e32 v4, v2, v2
727 ; GFX90A-NEXT: .LBB4_1: ; %atomicrmw.start
728 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
729 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
730 ; GFX90A-NEXT: v_max_f32_e32 v2, v3, v3
731 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
732 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
733 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
734 ; GFX90A-NEXT: buffer_wbinvl1
735 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
736 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
737 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
738 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
739 ; GFX90A-NEXT: s_cbranch_execnz .LBB4_1
740 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
741 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
742 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
744 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos:
746 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
747 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
748 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
749 ; GFX908-NEXT: v_max_f32_e32 v4, v2, v2
750 ; GFX908-NEXT: .LBB4_1: ; %atomicrmw.start
751 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
752 ; GFX908-NEXT: s_waitcnt vmcnt(0)
753 ; GFX908-NEXT: v_max_f32_e32 v2, v3, v3
754 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
755 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
756 ; GFX908-NEXT: s_waitcnt vmcnt(0)
757 ; GFX908-NEXT: buffer_wbinvl1
758 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
759 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
760 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
761 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
762 ; GFX908-NEXT: s_cbranch_execnz .LBB4_1
763 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
764 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
765 ; GFX908-NEXT: s_setpc_b64 s[30:31]
767 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos:
769 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
770 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
771 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
772 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
773 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
774 ; GFX8-NEXT: v_mul_f32_e32 v4, 1.0, v2
775 ; GFX8-NEXT: .LBB4_1: ; %atomicrmw.start
776 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
777 ; GFX8-NEXT: s_waitcnt vmcnt(0)
778 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v3
779 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
780 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
781 ; GFX8-NEXT: s_waitcnt vmcnt(0)
782 ; GFX8-NEXT: buffer_wbinvl1
783 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
784 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
785 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
786 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
787 ; GFX8-NEXT: s_cbranch_execnz .LBB4_1
788 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
789 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
790 ; GFX8-NEXT: s_setpc_b64 s[30:31]
792 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos:
794 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
795 ; GFX7-NEXT: s_mov_b32 s6, 0
796 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
797 ; GFX7-NEXT: s_mov_b32 s4, s6
798 ; GFX7-NEXT: s_mov_b32 s5, s6
799 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 offset:2044
800 ; GFX7-NEXT: s_waitcnt vmcnt(0)
801 ; GFX7-NEXT: buffer_wbinvl1
802 ; GFX7-NEXT: s_setpc_b64 s[30:31]
804 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos:
806 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
807 ; GFX6-NEXT: s_mov_b32 s6, 0
808 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
809 ; GFX6-NEXT: s_mov_b32 s4, s6
810 ; GFX6-NEXT: s_mov_b32 s5, s6
811 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 offset:2044
812 ; GFX6-NEXT: s_waitcnt vmcnt(0)
813 ; GFX6-NEXT: buffer_wbinvl1
814 ; GFX6-NEXT: s_waitcnt expcnt(0)
815 ; GFX6-NEXT: s_setpc_b64 s[30:31]
816 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 511
817 %unused = atomicrmw fmax ptr addrspace(1) %gep, float %val syncscope("agent") seq_cst
821 define void @global_agent_atomic_fmax_noret_f32__offset12b_neg(ptr addrspace(1) %ptr, float %val) #0 {
822 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg:
824 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
825 ; GFX12-NEXT: s_wait_expcnt 0x0
826 ; GFX12-NEXT: s_wait_samplecnt 0x0
827 ; GFX12-NEXT: s_wait_bvhcnt 0x0
828 ; GFX12-NEXT: s_wait_kmcnt 0x0
829 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
830 ; GFX12-NEXT: s_wait_storecnt 0x0
831 ; GFX12-NEXT: global_atomic_max_num_f32 v[0:1], v2, off offset:-2048 scope:SCOPE_DEV
832 ; GFX12-NEXT: s_wait_storecnt 0x0
833 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
834 ; GFX12-NEXT: s_setpc_b64 s[30:31]
836 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg:
838 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
839 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:-2048
840 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
841 ; GFX940-NEXT: v_max_f32_e32 v4, v2, v2
842 ; GFX940-NEXT: .LBB5_1: ; %atomicrmw.start
843 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
844 ; GFX940-NEXT: s_waitcnt vmcnt(0)
845 ; GFX940-NEXT: v_max_f32_e32 v2, v3, v3
846 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
847 ; GFX940-NEXT: buffer_wbl2 sc1
848 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 sc0
849 ; GFX940-NEXT: s_waitcnt vmcnt(0)
850 ; GFX940-NEXT: buffer_inv sc1
851 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
852 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
853 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
854 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
855 ; GFX940-NEXT: s_cbranch_execnz .LBB5_1
856 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
857 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
858 ; GFX940-NEXT: s_setpc_b64 s[30:31]
860 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg:
862 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
863 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
864 ; GFX11-NEXT: global_atomic_max_f32 v[0:1], v2, off offset:-2048
865 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
866 ; GFX11-NEXT: buffer_gl1_inv
867 ; GFX11-NEXT: buffer_gl0_inv
868 ; GFX11-NEXT: s_setpc_b64 s[30:31]
870 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg:
872 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
873 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
874 ; GFX10-NEXT: global_atomic_fmax v[0:1], v2, off offset:-2048
875 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
876 ; GFX10-NEXT: buffer_gl1_inv
877 ; GFX10-NEXT: buffer_gl0_inv
878 ; GFX10-NEXT: s_setpc_b64 s[30:31]
880 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg:
882 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
883 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:-2048
884 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
885 ; GFX90A-NEXT: v_max_f32_e32 v4, v2, v2
886 ; GFX90A-NEXT: .LBB5_1: ; %atomicrmw.start
887 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
888 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
889 ; GFX90A-NEXT: v_max_f32_e32 v2, v3, v3
890 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
891 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
892 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
893 ; GFX90A-NEXT: buffer_wbinvl1
894 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
895 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
896 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
897 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
898 ; GFX90A-NEXT: s_cbranch_execnz .LBB5_1
899 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
900 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
901 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
903 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg:
905 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
906 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:-2048
907 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
908 ; GFX908-NEXT: v_max_f32_e32 v4, v2, v2
909 ; GFX908-NEXT: .LBB5_1: ; %atomicrmw.start
910 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
911 ; GFX908-NEXT: s_waitcnt vmcnt(0)
912 ; GFX908-NEXT: v_max_f32_e32 v2, v3, v3
913 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
914 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
915 ; GFX908-NEXT: s_waitcnt vmcnt(0)
916 ; GFX908-NEXT: buffer_wbinvl1
917 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
918 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
919 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
920 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
921 ; GFX908-NEXT: s_cbranch_execnz .LBB5_1
922 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
923 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
924 ; GFX908-NEXT: s_setpc_b64 s[30:31]
926 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg:
928 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
929 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff800, v0
930 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
931 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
932 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
933 ; GFX8-NEXT: v_mul_f32_e32 v4, 1.0, v2
934 ; GFX8-NEXT: .LBB5_1: ; %atomicrmw.start
935 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
936 ; GFX8-NEXT: s_waitcnt vmcnt(0)
937 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v3
938 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
939 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
940 ; GFX8-NEXT: s_waitcnt vmcnt(0)
941 ; GFX8-NEXT: buffer_wbinvl1
942 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
943 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
944 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
945 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
946 ; GFX8-NEXT: s_cbranch_execnz .LBB5_1
947 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
948 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
949 ; GFX8-NEXT: s_setpc_b64 s[30:31]
951 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg:
953 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
954 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
955 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
956 ; GFX7-NEXT: s_mov_b32 s6, 0
957 ; GFX7-NEXT: s_mov_b32 s5, -1
958 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64
959 ; GFX7-NEXT: s_waitcnt vmcnt(0)
960 ; GFX7-NEXT: buffer_wbinvl1
961 ; GFX7-NEXT: s_setpc_b64 s[30:31]
963 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg:
965 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
966 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
967 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
968 ; GFX6-NEXT: s_mov_b32 s6, 0
969 ; GFX6-NEXT: s_mov_b32 s5, -1
970 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64
971 ; GFX6-NEXT: s_waitcnt vmcnt(0)
972 ; GFX6-NEXT: buffer_wbinvl1
973 ; GFX6-NEXT: s_waitcnt expcnt(0)
974 ; GFX6-NEXT: s_setpc_b64 s[30:31]
975 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 -512
976 %unused = atomicrmw fmax ptr addrspace(1) %gep, float %val syncscope("agent") seq_cst
980 define float @global_system_atomic_fmax_ret_f32__offset12b_pos(ptr addrspace(1) %ptr, float %val) #0 {
981 ; GFX12-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos:
983 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
984 ; GFX12-NEXT: s_wait_expcnt 0x0
985 ; GFX12-NEXT: s_wait_samplecnt 0x0
986 ; GFX12-NEXT: s_wait_bvhcnt 0x0
987 ; GFX12-NEXT: s_wait_kmcnt 0x0
988 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
989 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v2
990 ; GFX12-NEXT: s_mov_b32 s0, 0
991 ; GFX12-NEXT: .LBB6_1: ; %atomicrmw.start
992 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
993 ; GFX12-NEXT: s_wait_loadcnt 0x0
994 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
995 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
996 ; GFX12-NEXT: v_max_num_f32_e32 v3, v4, v4
997 ; GFX12-NEXT: v_max_num_f32_e32 v3, v3, v2
998 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
999 ; GFX12-NEXT: s_wait_storecnt 0x0
1000 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
1001 ; GFX12-NEXT: s_wait_loadcnt 0x0
1002 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
1003 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1004 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
1005 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1006 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1007 ; GFX12-NEXT: s_cbranch_execnz .LBB6_1
1008 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
1009 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
1010 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
1011 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1013 ; GFX940-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos:
1015 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1016 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
1017 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
1018 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v2
1019 ; GFX940-NEXT: .LBB6_1: ; %atomicrmw.start
1020 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
1021 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1022 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
1023 ; GFX940-NEXT: v_max_f32_e32 v3, v5, v5
1024 ; GFX940-NEXT: v_max_f32_e32 v4, v3, v2
1025 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
1026 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 sc0 sc1
1027 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1028 ; GFX940-NEXT: buffer_inv sc0 sc1
1029 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1030 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
1031 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
1032 ; GFX940-NEXT: s_cbranch_execnz .LBB6_1
1033 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
1034 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
1035 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
1036 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1038 ; GFX11-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos:
1040 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1041 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
1042 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v2
1043 ; GFX11-NEXT: s_mov_b32 s0, 0
1044 ; GFX11-NEXT: .LBB6_1: ; %atomicrmw.start
1045 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
1046 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1047 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
1048 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1049 ; GFX11-NEXT: v_max_f32_e32 v3, v4, v4
1050 ; GFX11-NEXT: v_max_f32_e32 v3, v3, v2
1051 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1052 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2044 glc
1053 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1054 ; GFX11-NEXT: buffer_gl1_inv
1055 ; GFX11-NEXT: buffer_gl0_inv
1056 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1057 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
1058 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1059 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1060 ; GFX11-NEXT: s_cbranch_execnz .LBB6_1
1061 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
1062 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
1063 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
1064 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1066 ; GFX10-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos:
1068 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1069 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
1070 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v2
1071 ; GFX10-NEXT: s_mov_b32 s4, 0
1072 ; GFX10-NEXT: .LBB6_1: ; %atomicrmw.start
1073 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1074 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1075 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
1076 ; GFX10-NEXT: v_max_f32_e32 v3, v4, v4
1077 ; GFX10-NEXT: v_max_f32_e32 v3, v3, v2
1078 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1079 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
1080 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1081 ; GFX10-NEXT: buffer_gl1_inv
1082 ; GFX10-NEXT: buffer_gl0_inv
1083 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1084 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1085 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1086 ; GFX10-NEXT: s_cbranch_execnz .LBB6_1
1087 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1088 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1089 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
1090 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1092 ; GFX90A-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos:
1094 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1095 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
1096 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1097 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v2
1098 ; GFX90A-NEXT: .LBB6_1: ; %atomicrmw.start
1099 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1100 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1101 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
1102 ; GFX90A-NEXT: v_max_f32_e32 v3, v5, v5
1103 ; GFX90A-NEXT: v_max_f32_e32 v4, v3, v2
1104 ; GFX90A-NEXT: buffer_wbl2
1105 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 glc
1106 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1107 ; GFX90A-NEXT: buffer_invl2
1108 ; GFX90A-NEXT: buffer_wbinvl1
1109 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1110 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1111 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1112 ; GFX90A-NEXT: s_cbranch_execnz .LBB6_1
1113 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1114 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1115 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
1116 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1118 ; GFX908-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos:
1120 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1121 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
1122 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1123 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v2
1124 ; GFX908-NEXT: .LBB6_1: ; %atomicrmw.start
1125 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1126 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1127 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
1128 ; GFX908-NEXT: v_max_f32_e32 v3, v4, v4
1129 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
1130 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
1131 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1132 ; GFX908-NEXT: buffer_wbinvl1
1133 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1134 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1135 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1136 ; GFX908-NEXT: s_cbranch_execnz .LBB6_1
1137 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1138 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1139 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
1140 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1142 ; GFX8-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos:
1144 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1145 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
1146 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
1147 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
1148 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1149 ; GFX8-NEXT: v_mul_f32_e32 v1, 1.0, v2
1150 ; GFX8-NEXT: .LBB6_1: ; %atomicrmw.start
1151 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1152 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1153 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
1154 ; GFX8-NEXT: v_mul_f32_e32 v0, 1.0, v6
1155 ; GFX8-NEXT: v_max_f32_e32 v5, v0, v1
1156 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
1157 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1158 ; GFX8-NEXT: buffer_wbinvl1
1159 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
1160 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1161 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1162 ; GFX8-NEXT: s_cbranch_execnz .LBB6_1
1163 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1164 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1165 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1167 ; GFX7-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos:
1169 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1170 ; GFX7-NEXT: s_mov_b32 s6, 0
1171 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
1172 ; GFX7-NEXT: s_mov_b32 s4, s6
1173 ; GFX7-NEXT: s_mov_b32 s5, s6
1174 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2044
1175 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
1176 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
1177 ; GFX7-NEXT: .LBB6_1: ; %atomicrmw.start
1178 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1179 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1180 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
1181 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v5
1182 ; GFX7-NEXT: v_max_f32_e32 v4, v3, v2
1183 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
1184 ; GFX7-NEXT: v_mov_b32_e32 v4, v5
1185 ; GFX7-NEXT: buffer_atomic_cmpswap v[3:4], v[0:1], s[4:7], 0 addr64 offset:2044 glc
1186 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1187 ; GFX7-NEXT: buffer_wbinvl1
1188 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1189 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
1190 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
1191 ; GFX7-NEXT: s_cbranch_execnz .LBB6_1
1192 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1193 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
1194 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
1195 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1197 ; GFX6-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos:
1199 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1200 ; GFX6-NEXT: s_mov_b32 s6, 0
1201 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
1202 ; GFX6-NEXT: s_mov_b32 s4, s6
1203 ; GFX6-NEXT: s_mov_b32 s5, s6
1204 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2044
1205 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
1206 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
1207 ; GFX6-NEXT: .LBB6_1: ; %atomicrmw.start
1208 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
1209 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1210 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
1211 ; GFX6-NEXT: s_waitcnt expcnt(0)
1212 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v5
1213 ; GFX6-NEXT: v_max_f32_e32 v4, v3, v2
1214 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
1215 ; GFX6-NEXT: v_mov_b32_e32 v4, v5
1216 ; GFX6-NEXT: buffer_atomic_cmpswap v[3:4], v[0:1], s[4:7], 0 addr64 offset:2044 glc
1217 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1218 ; GFX6-NEXT: buffer_wbinvl1
1219 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1220 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
1221 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
1222 ; GFX6-NEXT: s_cbranch_execnz .LBB6_1
1223 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
1224 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
1225 ; GFX6-NEXT: v_mov_b32_e32 v0, v3
1226 ; GFX6-NEXT: s_waitcnt expcnt(0)
1227 ; GFX6-NEXT: s_setpc_b64 s[30:31]
1228 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 511
1229 %result = atomicrmw fmax ptr addrspace(1) %gep, float %val seq_cst
1233 define void @global_system_atomic_fmax_noret_f32__offset12b_pos(ptr addrspace(1) %ptr, float %val) #0 {
1234 ; GFX12-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos:
1236 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1237 ; GFX12-NEXT: s_wait_expcnt 0x0
1238 ; GFX12-NEXT: s_wait_samplecnt 0x0
1239 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1240 ; GFX12-NEXT: s_wait_kmcnt 0x0
1241 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
1242 ; GFX12-NEXT: v_max_num_f32_e32 v4, v2, v2
1243 ; GFX12-NEXT: s_mov_b32 s0, 0
1244 ; GFX12-NEXT: .LBB7_1: ; %atomicrmw.start
1245 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
1246 ; GFX12-NEXT: s_wait_loadcnt 0x0
1247 ; GFX12-NEXT: v_max_num_f32_e32 v2, v3, v3
1248 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
1249 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v4
1250 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
1251 ; GFX12-NEXT: s_wait_storecnt 0x0
1252 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
1253 ; GFX12-NEXT: s_wait_loadcnt 0x0
1254 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
1255 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
1256 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
1257 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
1258 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1259 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1260 ; GFX12-NEXT: s_cbranch_execnz .LBB7_1
1261 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
1262 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
1263 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1265 ; GFX940-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos:
1267 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1268 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
1269 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
1270 ; GFX940-NEXT: v_max_f32_e32 v4, v2, v2
1271 ; GFX940-NEXT: .LBB7_1: ; %atomicrmw.start
1272 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
1273 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1274 ; GFX940-NEXT: v_max_f32_e32 v2, v3, v3
1275 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
1276 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
1277 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 sc0 sc1
1278 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1279 ; GFX940-NEXT: buffer_inv sc0 sc1
1280 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
1281 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
1282 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
1283 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
1284 ; GFX940-NEXT: s_cbranch_execnz .LBB7_1
1285 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
1286 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
1287 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1289 ; GFX11-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos:
1291 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1292 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
1293 ; GFX11-NEXT: v_max_f32_e32 v4, v2, v2
1294 ; GFX11-NEXT: s_mov_b32 s0, 0
1295 ; GFX11-NEXT: .LBB7_1: ; %atomicrmw.start
1296 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
1297 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1298 ; GFX11-NEXT: v_max_f32_e32 v2, v3, v3
1299 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
1300 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v4
1301 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1302 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 glc
1303 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1304 ; GFX11-NEXT: buffer_gl1_inv
1305 ; GFX11-NEXT: buffer_gl0_inv
1306 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
1307 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
1308 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
1309 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1310 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1311 ; GFX11-NEXT: s_cbranch_execnz .LBB7_1
1312 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
1313 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
1314 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1316 ; GFX10-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos:
1318 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1319 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
1320 ; GFX10-NEXT: v_max_f32_e32 v4, v2, v2
1321 ; GFX10-NEXT: s_mov_b32 s4, 0
1322 ; GFX10-NEXT: .LBB7_1: ; %atomicrmw.start
1323 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1324 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1325 ; GFX10-NEXT: v_max_f32_e32 v2, v3, v3
1326 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v4
1327 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1328 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
1329 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1330 ; GFX10-NEXT: buffer_gl1_inv
1331 ; GFX10-NEXT: buffer_gl0_inv
1332 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
1333 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
1334 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1335 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1336 ; GFX10-NEXT: s_cbranch_execnz .LBB7_1
1337 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1338 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1339 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1341 ; GFX90A-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos:
1343 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1344 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
1345 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1346 ; GFX90A-NEXT: v_max_f32_e32 v4, v2, v2
1347 ; GFX90A-NEXT: .LBB7_1: ; %atomicrmw.start
1348 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1349 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1350 ; GFX90A-NEXT: v_max_f32_e32 v2, v3, v3
1351 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
1352 ; GFX90A-NEXT: buffer_wbl2
1353 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
1354 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1355 ; GFX90A-NEXT: buffer_invl2
1356 ; GFX90A-NEXT: buffer_wbinvl1
1357 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
1358 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1359 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
1360 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1361 ; GFX90A-NEXT: s_cbranch_execnz .LBB7_1
1362 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1363 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1364 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1366 ; GFX908-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos:
1368 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1369 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
1370 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1371 ; GFX908-NEXT: v_max_f32_e32 v4, v2, v2
1372 ; GFX908-NEXT: .LBB7_1: ; %atomicrmw.start
1373 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1374 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1375 ; GFX908-NEXT: v_max_f32_e32 v2, v3, v3
1376 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
1377 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
1378 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1379 ; GFX908-NEXT: buffer_wbinvl1
1380 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
1381 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1382 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
1383 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1384 ; GFX908-NEXT: s_cbranch_execnz .LBB7_1
1385 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1386 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1387 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1389 ; GFX8-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos:
1391 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1392 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
1393 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1394 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
1395 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1396 ; GFX8-NEXT: v_mul_f32_e32 v4, 1.0, v2
1397 ; GFX8-NEXT: .LBB7_1: ; %atomicrmw.start
1398 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1399 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1400 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v3
1401 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
1402 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
1403 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1404 ; GFX8-NEXT: buffer_wbinvl1
1405 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
1406 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1407 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
1408 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1409 ; GFX8-NEXT: s_cbranch_execnz .LBB7_1
1410 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1411 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1412 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1414 ; GFX7-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos:
1416 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1417 ; GFX7-NEXT: s_mov_b32 s6, 0
1418 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
1419 ; GFX7-NEXT: s_mov_b32 s4, s6
1420 ; GFX7-NEXT: s_mov_b32 s5, s6
1421 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2044
1422 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
1423 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v2
1424 ; GFX7-NEXT: .LBB7_1: ; %atomicrmw.start
1425 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1426 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1427 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v3
1428 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v4
1429 ; GFX7-NEXT: v_mov_b32_e32 v6, v3
1430 ; GFX7-NEXT: v_mov_b32_e32 v5, v2
1431 ; GFX7-NEXT: buffer_atomic_cmpswap v[5:6], v[0:1], s[4:7], 0 addr64 offset:2044 glc
1432 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1433 ; GFX7-NEXT: buffer_wbinvl1
1434 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
1435 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
1436 ; GFX7-NEXT: v_mov_b32_e32 v3, v5
1437 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
1438 ; GFX7-NEXT: s_cbranch_execnz .LBB7_1
1439 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1440 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
1441 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1443 ; GFX6-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos:
1445 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1446 ; GFX6-NEXT: s_mov_b32 s6, 0
1447 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
1448 ; GFX6-NEXT: s_mov_b32 s4, s6
1449 ; GFX6-NEXT: s_mov_b32 s5, s6
1450 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2044
1451 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
1452 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v2
1453 ; GFX6-NEXT: .LBB7_1: ; %atomicrmw.start
1454 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
1455 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1456 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v3
1457 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v4
1458 ; GFX6-NEXT: s_waitcnt expcnt(0)
1459 ; GFX6-NEXT: v_mov_b32_e32 v6, v3
1460 ; GFX6-NEXT: v_mov_b32_e32 v5, v2
1461 ; GFX6-NEXT: buffer_atomic_cmpswap v[5:6], v[0:1], s[4:7], 0 addr64 offset:2044 glc
1462 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1463 ; GFX6-NEXT: buffer_wbinvl1
1464 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
1465 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
1466 ; GFX6-NEXT: v_mov_b32_e32 v3, v5
1467 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
1468 ; GFX6-NEXT: s_cbranch_execnz .LBB7_1
1469 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
1470 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
1471 ; GFX6-NEXT: s_waitcnt expcnt(0)
1472 ; GFX6-NEXT: s_setpc_b64 s[30:31]
1473 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 511
1474 %unused = atomicrmw fmax ptr addrspace(1) %gep, float %val seq_cst
1478 ; --------------------------------------------------------------------
1479 ; float with ftz/daz
1480 ; --------------------------------------------------------------------
1482 define float @global_agent_atomic_fmax_ret_f32__ftz(ptr addrspace(1) %ptr, float %val) #1 {
1483 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f32__ftz:
1485 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1486 ; GFX12-NEXT: s_wait_expcnt 0x0
1487 ; GFX12-NEXT: s_wait_samplecnt 0x0
1488 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1489 ; GFX12-NEXT: s_wait_kmcnt 0x0
1490 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
1491 ; GFX12-NEXT: s_wait_storecnt 0x0
1492 ; GFX12-NEXT: global_atomic_max_num_f32 v0, v[0:1], v2, off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
1493 ; GFX12-NEXT: s_wait_loadcnt 0x0
1494 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
1495 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1497 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f32__ftz:
1499 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1500 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
1501 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
1502 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v2
1503 ; GFX940-NEXT: .LBB8_1: ; %atomicrmw.start
1504 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
1505 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1506 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
1507 ; GFX940-NEXT: v_max_f32_e32 v3, v5, v5
1508 ; GFX940-NEXT: v_max_f32_e32 v4, v3, v2
1509 ; GFX940-NEXT: buffer_wbl2 sc1
1510 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off sc0
1511 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1512 ; GFX940-NEXT: buffer_inv sc1
1513 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1514 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
1515 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
1516 ; GFX940-NEXT: s_cbranch_execnz .LBB8_1
1517 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
1518 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
1519 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
1520 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1522 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f32__ftz:
1524 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1525 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1526 ; GFX11-NEXT: global_atomic_max_f32 v0, v[0:1], v2, off glc
1527 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1528 ; GFX11-NEXT: buffer_gl1_inv
1529 ; GFX11-NEXT: buffer_gl0_inv
1530 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1532 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f32__ftz:
1534 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1535 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1536 ; GFX10-NEXT: global_atomic_fmax v0, v[0:1], v2, off glc
1537 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1538 ; GFX10-NEXT: buffer_gl1_inv
1539 ; GFX10-NEXT: buffer_gl0_inv
1540 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1542 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f32__ftz:
1544 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1545 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
1546 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1547 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v2
1548 ; GFX90A-NEXT: .LBB8_1: ; %atomicrmw.start
1549 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1550 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1551 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
1552 ; GFX90A-NEXT: v_max_f32_e32 v3, v5, v5
1553 ; GFX90A-NEXT: v_max_f32_e32 v4, v3, v2
1554 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off glc
1555 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1556 ; GFX90A-NEXT: buffer_wbinvl1
1557 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1558 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1559 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1560 ; GFX90A-NEXT: s_cbranch_execnz .LBB8_1
1561 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1562 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1563 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
1564 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1566 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f32__ftz:
1568 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1569 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
1570 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1571 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v2
1572 ; GFX908-NEXT: .LBB8_1: ; %atomicrmw.start
1573 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1574 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1575 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
1576 ; GFX908-NEXT: v_max_f32_e32 v3, v4, v4
1577 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
1578 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off glc
1579 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1580 ; GFX908-NEXT: buffer_wbinvl1
1581 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1582 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1583 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1584 ; GFX908-NEXT: s_cbranch_execnz .LBB8_1
1585 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1586 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1587 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
1588 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1590 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f32__ftz:
1592 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1593 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
1594 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1595 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v2
1596 ; GFX8-NEXT: .LBB8_1: ; %atomicrmw.start
1597 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1598 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1599 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
1600 ; GFX8-NEXT: v_mul_f32_e32 v3, 1.0, v4
1601 ; GFX8-NEXT: v_max_f32_e32 v3, v3, v2
1602 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1603 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1604 ; GFX8-NEXT: buffer_wbinvl1
1605 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1606 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1607 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1608 ; GFX8-NEXT: s_cbranch_execnz .LBB8_1
1609 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1610 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1611 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
1612 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1614 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f32__ftz:
1616 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1617 ; GFX7-NEXT: s_mov_b32 s6, 0
1618 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
1619 ; GFX7-NEXT: s_mov_b32 s4, s6
1620 ; GFX7-NEXT: s_mov_b32 s5, s6
1621 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 glc
1622 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1623 ; GFX7-NEXT: buffer_wbinvl1
1624 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
1625 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1627 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f32__ftz:
1629 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1630 ; GFX6-NEXT: s_mov_b32 s6, 0
1631 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
1632 ; GFX6-NEXT: s_mov_b32 s4, s6
1633 ; GFX6-NEXT: s_mov_b32 s5, s6
1634 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 glc
1635 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1636 ; GFX6-NEXT: buffer_wbinvl1
1637 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
1638 ; GFX6-NEXT: s_waitcnt expcnt(0)
1639 ; GFX6-NEXT: s_setpc_b64 s[30:31]
1640 %result = atomicrmw fmax ptr addrspace(1) %ptr, float %val syncscope("agent") seq_cst
1644 define float @global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz(ptr addrspace(1) %ptr, float %val) #1 {
1645 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz:
1647 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1648 ; GFX12-NEXT: s_wait_expcnt 0x0
1649 ; GFX12-NEXT: s_wait_samplecnt 0x0
1650 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1651 ; GFX12-NEXT: s_wait_kmcnt 0x0
1652 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
1653 ; GFX12-NEXT: s_wait_storecnt 0x0
1654 ; GFX12-NEXT: global_atomic_max_num_f32 v0, v[0:1], v2, off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
1655 ; GFX12-NEXT: s_wait_loadcnt 0x0
1656 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
1657 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1659 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz:
1661 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1662 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
1663 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
1664 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v2
1665 ; GFX940-NEXT: .LBB9_1: ; %atomicrmw.start
1666 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
1667 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1668 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
1669 ; GFX940-NEXT: v_max_f32_e32 v3, v5, v5
1670 ; GFX940-NEXT: v_max_f32_e32 v4, v3, v2
1671 ; GFX940-NEXT: buffer_wbl2 sc1
1672 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 sc0
1673 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1674 ; GFX940-NEXT: buffer_inv sc1
1675 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1676 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
1677 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
1678 ; GFX940-NEXT: s_cbranch_execnz .LBB9_1
1679 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
1680 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
1681 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
1682 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1684 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz:
1686 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1687 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1688 ; GFX11-NEXT: global_atomic_max_f32 v0, v[0:1], v2, off offset:2044 glc
1689 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1690 ; GFX11-NEXT: buffer_gl1_inv
1691 ; GFX11-NEXT: buffer_gl0_inv
1692 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1694 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz:
1696 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1697 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1698 ; GFX10-NEXT: global_atomic_fmax v0, v[0:1], v2, off offset:2044 glc
1699 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1700 ; GFX10-NEXT: buffer_gl1_inv
1701 ; GFX10-NEXT: buffer_gl0_inv
1702 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1704 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz:
1706 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1707 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
1708 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1709 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v2
1710 ; GFX90A-NEXT: .LBB9_1: ; %atomicrmw.start
1711 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1712 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1713 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
1714 ; GFX90A-NEXT: v_max_f32_e32 v3, v5, v5
1715 ; GFX90A-NEXT: v_max_f32_e32 v4, v3, v2
1716 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 glc
1717 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1718 ; GFX90A-NEXT: buffer_wbinvl1
1719 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1720 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1721 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1722 ; GFX90A-NEXT: s_cbranch_execnz .LBB9_1
1723 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1724 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1725 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
1726 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1728 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz:
1730 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1731 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
1732 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1733 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v2
1734 ; GFX908-NEXT: .LBB9_1: ; %atomicrmw.start
1735 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1736 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1737 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
1738 ; GFX908-NEXT: v_max_f32_e32 v3, v4, v4
1739 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
1740 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
1741 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1742 ; GFX908-NEXT: buffer_wbinvl1
1743 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1744 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1745 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1746 ; GFX908-NEXT: s_cbranch_execnz .LBB9_1
1747 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1748 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1749 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
1750 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1752 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz:
1754 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1755 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
1756 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
1757 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
1758 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1759 ; GFX8-NEXT: v_mul_f32_e32 v1, 1.0, v2
1760 ; GFX8-NEXT: .LBB9_1: ; %atomicrmw.start
1761 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1762 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1763 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
1764 ; GFX8-NEXT: v_mul_f32_e32 v0, 1.0, v6
1765 ; GFX8-NEXT: v_max_f32_e32 v5, v0, v1
1766 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
1767 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1768 ; GFX8-NEXT: buffer_wbinvl1
1769 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
1770 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1771 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1772 ; GFX8-NEXT: s_cbranch_execnz .LBB9_1
1773 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1774 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1775 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1777 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz:
1779 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1780 ; GFX7-NEXT: s_mov_b32 s6, 0
1781 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
1782 ; GFX7-NEXT: s_mov_b32 s4, s6
1783 ; GFX7-NEXT: s_mov_b32 s5, s6
1784 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 offset:2044 glc
1785 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1786 ; GFX7-NEXT: buffer_wbinvl1
1787 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
1788 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1790 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_pos__ftz:
1792 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1793 ; GFX6-NEXT: s_mov_b32 s6, 0
1794 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
1795 ; GFX6-NEXT: s_mov_b32 s4, s6
1796 ; GFX6-NEXT: s_mov_b32 s5, s6
1797 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 offset:2044 glc
1798 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1799 ; GFX6-NEXT: buffer_wbinvl1
1800 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
1801 ; GFX6-NEXT: s_waitcnt expcnt(0)
1802 ; GFX6-NEXT: s_setpc_b64 s[30:31]
1803 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 511
1804 %result = atomicrmw fmax ptr addrspace(1) %gep, float %val syncscope("agent") seq_cst
1808 define float @global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz(ptr addrspace(1) %ptr, float %val) #1 {
1809 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz:
1811 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1812 ; GFX12-NEXT: s_wait_expcnt 0x0
1813 ; GFX12-NEXT: s_wait_samplecnt 0x0
1814 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1815 ; GFX12-NEXT: s_wait_kmcnt 0x0
1816 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
1817 ; GFX12-NEXT: s_wait_storecnt 0x0
1818 ; GFX12-NEXT: global_atomic_max_num_f32 v0, v[0:1], v2, off offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
1819 ; GFX12-NEXT: s_wait_loadcnt 0x0
1820 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
1821 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1823 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz:
1825 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1826 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:-2048
1827 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
1828 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v2
1829 ; GFX940-NEXT: .LBB10_1: ; %atomicrmw.start
1830 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
1831 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1832 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
1833 ; GFX940-NEXT: v_max_f32_e32 v3, v5, v5
1834 ; GFX940-NEXT: v_max_f32_e32 v4, v3, v2
1835 ; GFX940-NEXT: buffer_wbl2 sc1
1836 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:-2048 sc0
1837 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1838 ; GFX940-NEXT: buffer_inv sc1
1839 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1840 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
1841 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
1842 ; GFX940-NEXT: s_cbranch_execnz .LBB10_1
1843 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
1844 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
1845 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
1846 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1848 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz:
1850 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1851 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1852 ; GFX11-NEXT: global_atomic_max_f32 v0, v[0:1], v2, off offset:-2048 glc
1853 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1854 ; GFX11-NEXT: buffer_gl1_inv
1855 ; GFX11-NEXT: buffer_gl0_inv
1856 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1858 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz:
1860 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1861 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1862 ; GFX10-NEXT: global_atomic_fmax v0, v[0:1], v2, off offset:-2048 glc
1863 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1864 ; GFX10-NEXT: buffer_gl1_inv
1865 ; GFX10-NEXT: buffer_gl0_inv
1866 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1868 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz:
1870 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1871 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:-2048
1872 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1873 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v2
1874 ; GFX90A-NEXT: .LBB10_1: ; %atomicrmw.start
1875 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1876 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1877 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
1878 ; GFX90A-NEXT: v_max_f32_e32 v3, v5, v5
1879 ; GFX90A-NEXT: v_max_f32_e32 v4, v3, v2
1880 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:-2048 glc
1881 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1882 ; GFX90A-NEXT: buffer_wbinvl1
1883 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1884 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1885 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1886 ; GFX90A-NEXT: s_cbranch_execnz .LBB10_1
1887 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1888 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1889 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
1890 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1892 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz:
1894 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1895 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:-2048
1896 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1897 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v2
1898 ; GFX908-NEXT: .LBB10_1: ; %atomicrmw.start
1899 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1900 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1901 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
1902 ; GFX908-NEXT: v_max_f32_e32 v3, v4, v4
1903 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
1904 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:-2048 glc
1905 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1906 ; GFX908-NEXT: buffer_wbinvl1
1907 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1908 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1909 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1910 ; GFX908-NEXT: s_cbranch_execnz .LBB10_1
1911 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1912 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1913 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
1914 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1916 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz:
1918 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1919 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
1920 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
1921 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
1922 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1923 ; GFX8-NEXT: v_mul_f32_e32 v1, 1.0, v2
1924 ; GFX8-NEXT: .LBB10_1: ; %atomicrmw.start
1925 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1926 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1927 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
1928 ; GFX8-NEXT: v_mul_f32_e32 v0, 1.0, v6
1929 ; GFX8-NEXT: v_max_f32_e32 v5, v0, v1
1930 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
1931 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1932 ; GFX8-NEXT: buffer_wbinvl1
1933 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
1934 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1935 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1936 ; GFX8-NEXT: s_cbranch_execnz .LBB10_1
1937 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1938 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1939 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1941 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz:
1943 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1944 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
1945 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
1946 ; GFX7-NEXT: s_mov_b32 s6, 0
1947 ; GFX7-NEXT: s_mov_b32 s5, -1
1948 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 glc
1949 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1950 ; GFX7-NEXT: buffer_wbinvl1
1951 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
1952 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1954 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f32__offset12b_neg__ftz:
1956 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1957 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
1958 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
1959 ; GFX6-NEXT: s_mov_b32 s6, 0
1960 ; GFX6-NEXT: s_mov_b32 s5, -1
1961 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 glc
1962 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1963 ; GFX6-NEXT: buffer_wbinvl1
1964 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
1965 ; GFX6-NEXT: s_waitcnt expcnt(0)
1966 ; GFX6-NEXT: s_setpc_b64 s[30:31]
1967 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 -512
1968 %result = atomicrmw fmax ptr addrspace(1) %gep, float %val syncscope("agent") seq_cst
1972 define void @global_agent_atomic_fmax_noret_f32__ftz(ptr addrspace(1) %ptr, float %val) #1 {
1973 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f32__ftz:
1975 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1976 ; GFX12-NEXT: s_wait_expcnt 0x0
1977 ; GFX12-NEXT: s_wait_samplecnt 0x0
1978 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1979 ; GFX12-NEXT: s_wait_kmcnt 0x0
1980 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
1981 ; GFX12-NEXT: s_wait_storecnt 0x0
1982 ; GFX12-NEXT: global_atomic_max_num_f32 v[0:1], v2, off scope:SCOPE_DEV
1983 ; GFX12-NEXT: s_wait_storecnt 0x0
1984 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
1985 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1987 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f32__ftz:
1989 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1990 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
1991 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
1992 ; GFX940-NEXT: v_max_f32_e32 v4, v2, v2
1993 ; GFX940-NEXT: .LBB11_1: ; %atomicrmw.start
1994 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
1995 ; GFX940-NEXT: s_waitcnt vmcnt(0)
1996 ; GFX940-NEXT: v_max_f32_e32 v2, v3, v3
1997 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
1998 ; GFX940-NEXT: buffer_wbl2 sc1
1999 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0
2000 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2001 ; GFX940-NEXT: buffer_inv sc1
2002 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2003 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
2004 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
2005 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
2006 ; GFX940-NEXT: s_cbranch_execnz .LBB11_1
2007 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
2008 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
2009 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2011 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f32__ftz:
2013 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2014 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2015 ; GFX11-NEXT: global_atomic_max_f32 v[0:1], v2, off
2016 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2017 ; GFX11-NEXT: buffer_gl1_inv
2018 ; GFX11-NEXT: buffer_gl0_inv
2019 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2021 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f32__ftz:
2023 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2024 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2025 ; GFX10-NEXT: global_atomic_fmax v[0:1], v2, off
2026 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2027 ; GFX10-NEXT: buffer_gl1_inv
2028 ; GFX10-NEXT: buffer_gl0_inv
2029 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2031 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f32__ftz:
2033 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2034 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
2035 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
2036 ; GFX90A-NEXT: v_max_f32_e32 v4, v2, v2
2037 ; GFX90A-NEXT: .LBB11_1: ; %atomicrmw.start
2038 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
2039 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2040 ; GFX90A-NEXT: v_max_f32_e32 v2, v3, v3
2041 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
2042 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
2043 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2044 ; GFX90A-NEXT: buffer_wbinvl1
2045 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2046 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2047 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
2048 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
2049 ; GFX90A-NEXT: s_cbranch_execnz .LBB11_1
2050 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
2051 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2052 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2054 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f32__ftz:
2056 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2057 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
2058 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2059 ; GFX908-NEXT: v_max_f32_e32 v4, v2, v2
2060 ; GFX908-NEXT: .LBB11_1: ; %atomicrmw.start
2061 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2062 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2063 ; GFX908-NEXT: v_max_f32_e32 v2, v3, v3
2064 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
2065 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
2066 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2067 ; GFX908-NEXT: buffer_wbinvl1
2068 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2069 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2070 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
2071 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2072 ; GFX908-NEXT: s_cbranch_execnz .LBB11_1
2073 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2074 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2075 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2077 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f32__ftz:
2079 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2080 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2081 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2082 ; GFX8-NEXT: v_mul_f32_e32 v4, 1.0, v2
2083 ; GFX8-NEXT: .LBB11_1: ; %atomicrmw.start
2084 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2085 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2086 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v3
2087 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
2088 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
2089 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2090 ; GFX8-NEXT: buffer_wbinvl1
2091 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2092 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2093 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
2094 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2095 ; GFX8-NEXT: s_cbranch_execnz .LBB11_1
2096 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2097 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2098 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2100 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f32__ftz:
2102 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2103 ; GFX7-NEXT: s_mov_b32 s6, 0
2104 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
2105 ; GFX7-NEXT: s_mov_b32 s4, s6
2106 ; GFX7-NEXT: s_mov_b32 s5, s6
2107 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64
2108 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2109 ; GFX7-NEXT: buffer_wbinvl1
2110 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2112 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f32__ftz:
2114 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2115 ; GFX6-NEXT: s_mov_b32 s6, 0
2116 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
2117 ; GFX6-NEXT: s_mov_b32 s4, s6
2118 ; GFX6-NEXT: s_mov_b32 s5, s6
2119 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64
2120 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2121 ; GFX6-NEXT: buffer_wbinvl1
2122 ; GFX6-NEXT: s_waitcnt expcnt(0)
2123 ; GFX6-NEXT: s_setpc_b64 s[30:31]
2124 %unused = atomicrmw fmax ptr addrspace(1) %ptr, float %val syncscope("agent") seq_cst
2128 define void @global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz(ptr addrspace(1) %ptr, float %val) #1 {
2129 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz:
2131 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2132 ; GFX12-NEXT: s_wait_expcnt 0x0
2133 ; GFX12-NEXT: s_wait_samplecnt 0x0
2134 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2135 ; GFX12-NEXT: s_wait_kmcnt 0x0
2136 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
2137 ; GFX12-NEXT: s_wait_storecnt 0x0
2138 ; GFX12-NEXT: global_atomic_max_num_f32 v[0:1], v2, off offset:2044 scope:SCOPE_DEV
2139 ; GFX12-NEXT: s_wait_storecnt 0x0
2140 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
2141 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2143 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz:
2145 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2146 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
2147 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
2148 ; GFX940-NEXT: v_max_f32_e32 v4, v2, v2
2149 ; GFX940-NEXT: .LBB12_1: ; %atomicrmw.start
2150 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
2151 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2152 ; GFX940-NEXT: v_max_f32_e32 v2, v3, v3
2153 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
2154 ; GFX940-NEXT: buffer_wbl2 sc1
2155 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 sc0
2156 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2157 ; GFX940-NEXT: buffer_inv sc1
2158 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2159 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
2160 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
2161 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
2162 ; GFX940-NEXT: s_cbranch_execnz .LBB12_1
2163 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
2164 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
2165 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2167 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz:
2169 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2170 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2171 ; GFX11-NEXT: global_atomic_max_f32 v[0:1], v2, off offset:2044
2172 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2173 ; GFX11-NEXT: buffer_gl1_inv
2174 ; GFX11-NEXT: buffer_gl0_inv
2175 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2177 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz:
2179 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2180 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2181 ; GFX10-NEXT: global_atomic_fmax v[0:1], v2, off offset:2044
2182 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2183 ; GFX10-NEXT: buffer_gl1_inv
2184 ; GFX10-NEXT: buffer_gl0_inv
2185 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2187 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz:
2189 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2190 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
2191 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
2192 ; GFX90A-NEXT: v_max_f32_e32 v4, v2, v2
2193 ; GFX90A-NEXT: .LBB12_1: ; %atomicrmw.start
2194 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
2195 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2196 ; GFX90A-NEXT: v_max_f32_e32 v2, v3, v3
2197 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
2198 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
2199 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2200 ; GFX90A-NEXT: buffer_wbinvl1
2201 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2202 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2203 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
2204 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
2205 ; GFX90A-NEXT: s_cbranch_execnz .LBB12_1
2206 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
2207 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2208 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2210 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz:
2212 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2213 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
2214 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2215 ; GFX908-NEXT: v_max_f32_e32 v4, v2, v2
2216 ; GFX908-NEXT: .LBB12_1: ; %atomicrmw.start
2217 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2218 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2219 ; GFX908-NEXT: v_max_f32_e32 v2, v3, v3
2220 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
2221 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
2222 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2223 ; GFX908-NEXT: buffer_wbinvl1
2224 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2225 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2226 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
2227 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2228 ; GFX908-NEXT: s_cbranch_execnz .LBB12_1
2229 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2230 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2231 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2233 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz:
2235 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2236 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
2237 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2238 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2239 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2240 ; GFX8-NEXT: v_mul_f32_e32 v4, 1.0, v2
2241 ; GFX8-NEXT: .LBB12_1: ; %atomicrmw.start
2242 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2243 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2244 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v3
2245 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
2246 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
2247 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2248 ; GFX8-NEXT: buffer_wbinvl1
2249 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2250 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2251 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
2252 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2253 ; GFX8-NEXT: s_cbranch_execnz .LBB12_1
2254 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2255 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2256 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2258 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz:
2260 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2261 ; GFX7-NEXT: s_mov_b32 s6, 0
2262 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
2263 ; GFX7-NEXT: s_mov_b32 s4, s6
2264 ; GFX7-NEXT: s_mov_b32 s5, s6
2265 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 offset:2044
2266 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2267 ; GFX7-NEXT: buffer_wbinvl1
2268 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2270 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_pos__ftz:
2272 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2273 ; GFX6-NEXT: s_mov_b32 s6, 0
2274 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
2275 ; GFX6-NEXT: s_mov_b32 s4, s6
2276 ; GFX6-NEXT: s_mov_b32 s5, s6
2277 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64 offset:2044
2278 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2279 ; GFX6-NEXT: buffer_wbinvl1
2280 ; GFX6-NEXT: s_waitcnt expcnt(0)
2281 ; GFX6-NEXT: s_setpc_b64 s[30:31]
2282 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 511
2283 %unused = atomicrmw fmax ptr addrspace(1) %gep, float %val syncscope("agent") seq_cst
2287 define void @global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz(ptr addrspace(1) %ptr, float %val) #1 {
2288 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz:
2290 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2291 ; GFX12-NEXT: s_wait_expcnt 0x0
2292 ; GFX12-NEXT: s_wait_samplecnt 0x0
2293 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2294 ; GFX12-NEXT: s_wait_kmcnt 0x0
2295 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
2296 ; GFX12-NEXT: s_wait_storecnt 0x0
2297 ; GFX12-NEXT: global_atomic_max_num_f32 v[0:1], v2, off offset:-2048 scope:SCOPE_DEV
2298 ; GFX12-NEXT: s_wait_storecnt 0x0
2299 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
2300 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2302 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz:
2304 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2305 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:-2048
2306 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
2307 ; GFX940-NEXT: v_max_f32_e32 v4, v2, v2
2308 ; GFX940-NEXT: .LBB13_1: ; %atomicrmw.start
2309 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
2310 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2311 ; GFX940-NEXT: v_max_f32_e32 v2, v3, v3
2312 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
2313 ; GFX940-NEXT: buffer_wbl2 sc1
2314 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 sc0
2315 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2316 ; GFX940-NEXT: buffer_inv sc1
2317 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2318 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
2319 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
2320 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
2321 ; GFX940-NEXT: s_cbranch_execnz .LBB13_1
2322 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
2323 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
2324 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2326 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz:
2328 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2329 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2330 ; GFX11-NEXT: global_atomic_max_f32 v[0:1], v2, off offset:-2048
2331 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2332 ; GFX11-NEXT: buffer_gl1_inv
2333 ; GFX11-NEXT: buffer_gl0_inv
2334 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2336 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz:
2338 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2339 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2340 ; GFX10-NEXT: global_atomic_fmax v[0:1], v2, off offset:-2048
2341 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2342 ; GFX10-NEXT: buffer_gl1_inv
2343 ; GFX10-NEXT: buffer_gl0_inv
2344 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2346 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz:
2348 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2349 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:-2048
2350 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
2351 ; GFX90A-NEXT: v_max_f32_e32 v4, v2, v2
2352 ; GFX90A-NEXT: .LBB13_1: ; %atomicrmw.start
2353 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
2354 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2355 ; GFX90A-NEXT: v_max_f32_e32 v2, v3, v3
2356 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
2357 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
2358 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2359 ; GFX90A-NEXT: buffer_wbinvl1
2360 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2361 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2362 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
2363 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
2364 ; GFX90A-NEXT: s_cbranch_execnz .LBB13_1
2365 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
2366 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2367 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2369 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz:
2371 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2372 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:-2048
2373 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2374 ; GFX908-NEXT: v_max_f32_e32 v4, v2, v2
2375 ; GFX908-NEXT: .LBB13_1: ; %atomicrmw.start
2376 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2377 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2378 ; GFX908-NEXT: v_max_f32_e32 v2, v3, v3
2379 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
2380 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
2381 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2382 ; GFX908-NEXT: buffer_wbinvl1
2383 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2384 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2385 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
2386 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2387 ; GFX908-NEXT: s_cbranch_execnz .LBB13_1
2388 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2389 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2390 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2392 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz:
2394 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2395 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff800, v0
2396 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
2397 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2398 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2399 ; GFX8-NEXT: v_mul_f32_e32 v4, 1.0, v2
2400 ; GFX8-NEXT: .LBB13_1: ; %atomicrmw.start
2401 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2402 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2403 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v3
2404 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
2405 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
2406 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2407 ; GFX8-NEXT: buffer_wbinvl1
2408 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2409 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2410 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
2411 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2412 ; GFX8-NEXT: s_cbranch_execnz .LBB13_1
2413 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2414 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2415 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2417 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz:
2419 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2420 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
2421 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
2422 ; GFX7-NEXT: s_mov_b32 s6, 0
2423 ; GFX7-NEXT: s_mov_b32 s5, -1
2424 ; GFX7-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64
2425 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2426 ; GFX7-NEXT: buffer_wbinvl1
2427 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2429 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f32__offset12b_neg__ftz:
2431 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2432 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
2433 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
2434 ; GFX6-NEXT: s_mov_b32 s6, 0
2435 ; GFX6-NEXT: s_mov_b32 s5, -1
2436 ; GFX6-NEXT: buffer_atomic_fmax v2, v[0:1], s[4:7], 0 addr64
2437 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2438 ; GFX6-NEXT: buffer_wbinvl1
2439 ; GFX6-NEXT: s_waitcnt expcnt(0)
2440 ; GFX6-NEXT: s_setpc_b64 s[30:31]
2441 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 -512
2442 %unused = atomicrmw fmax ptr addrspace(1) %gep, float %val syncscope("agent") seq_cst
2446 define float @global_system_atomic_fmax_ret_f32__offset12b_pos__ftz(ptr addrspace(1) %ptr, float %val) #1 {
2447 ; GFX12-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos__ftz:
2449 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2450 ; GFX12-NEXT: s_wait_expcnt 0x0
2451 ; GFX12-NEXT: s_wait_samplecnt 0x0
2452 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2453 ; GFX12-NEXT: s_wait_kmcnt 0x0
2454 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
2455 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v2
2456 ; GFX12-NEXT: s_mov_b32 s0, 0
2457 ; GFX12-NEXT: .LBB14_1: ; %atomicrmw.start
2458 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
2459 ; GFX12-NEXT: s_wait_loadcnt 0x0
2460 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
2461 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2462 ; GFX12-NEXT: v_max_num_f32_e32 v3, v4, v4
2463 ; GFX12-NEXT: v_max_num_f32_e32 v3, v3, v2
2464 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
2465 ; GFX12-NEXT: s_wait_storecnt 0x0
2466 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
2467 ; GFX12-NEXT: s_wait_loadcnt 0x0
2468 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
2469 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2470 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
2471 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2472 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2473 ; GFX12-NEXT: s_cbranch_execnz .LBB14_1
2474 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
2475 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
2476 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
2477 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2479 ; GFX940-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos__ftz:
2481 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2482 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
2483 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
2484 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v2
2485 ; GFX940-NEXT: .LBB14_1: ; %atomicrmw.start
2486 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
2487 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2488 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
2489 ; GFX940-NEXT: v_max_f32_e32 v3, v5, v5
2490 ; GFX940-NEXT: v_max_f32_e32 v4, v3, v2
2491 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
2492 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 sc0 sc1
2493 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2494 ; GFX940-NEXT: buffer_inv sc0 sc1
2495 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
2496 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
2497 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
2498 ; GFX940-NEXT: s_cbranch_execnz .LBB14_1
2499 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
2500 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
2501 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
2502 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2504 ; GFX11-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos__ftz:
2506 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2507 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
2508 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v2
2509 ; GFX11-NEXT: s_mov_b32 s0, 0
2510 ; GFX11-NEXT: .LBB14_1: ; %atomicrmw.start
2511 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
2512 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2513 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
2514 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2515 ; GFX11-NEXT: v_max_f32_e32 v3, v4, v4
2516 ; GFX11-NEXT: v_max_f32_e32 v3, v3, v2
2517 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2518 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2044 glc
2519 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2520 ; GFX11-NEXT: buffer_gl1_inv
2521 ; GFX11-NEXT: buffer_gl0_inv
2522 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2523 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2524 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2525 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2526 ; GFX11-NEXT: s_cbranch_execnz .LBB14_1
2527 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
2528 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
2529 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
2530 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2532 ; GFX10-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos__ftz:
2534 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2535 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
2536 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v2
2537 ; GFX10-NEXT: s_mov_b32 s4, 0
2538 ; GFX10-NEXT: .LBB14_1: ; %atomicrmw.start
2539 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2540 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2541 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
2542 ; GFX10-NEXT: v_max_f32_e32 v3, v4, v4
2543 ; GFX10-NEXT: v_max_f32_e32 v3, v3, v2
2544 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2545 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
2546 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2547 ; GFX10-NEXT: buffer_gl1_inv
2548 ; GFX10-NEXT: buffer_gl0_inv
2549 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2550 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2551 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2552 ; GFX10-NEXT: s_cbranch_execnz .LBB14_1
2553 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2554 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2555 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
2556 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2558 ; GFX90A-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos__ftz:
2560 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2561 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
2562 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
2563 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v2
2564 ; GFX90A-NEXT: .LBB14_1: ; %atomicrmw.start
2565 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
2566 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2567 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
2568 ; GFX90A-NEXT: v_max_f32_e32 v3, v5, v5
2569 ; GFX90A-NEXT: v_max_f32_e32 v4, v3, v2
2570 ; GFX90A-NEXT: buffer_wbl2
2571 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 glc
2572 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2573 ; GFX90A-NEXT: buffer_invl2
2574 ; GFX90A-NEXT: buffer_wbinvl1
2575 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
2576 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2577 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
2578 ; GFX90A-NEXT: s_cbranch_execnz .LBB14_1
2579 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
2580 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2581 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
2582 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2584 ; GFX908-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos__ftz:
2586 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2587 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
2588 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2589 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v2
2590 ; GFX908-NEXT: .LBB14_1: ; %atomicrmw.start
2591 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2592 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2593 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
2594 ; GFX908-NEXT: v_max_f32_e32 v3, v4, v4
2595 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
2596 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
2597 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2598 ; GFX908-NEXT: buffer_wbinvl1
2599 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2600 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2601 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2602 ; GFX908-NEXT: s_cbranch_execnz .LBB14_1
2603 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2604 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2605 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
2606 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2608 ; GFX8-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos__ftz:
2610 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2611 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
2612 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
2613 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
2614 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2615 ; GFX8-NEXT: v_mul_f32_e32 v1, 1.0, v2
2616 ; GFX8-NEXT: .LBB14_1: ; %atomicrmw.start
2617 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2618 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2619 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
2620 ; GFX8-NEXT: v_mul_f32_e32 v0, 1.0, v6
2621 ; GFX8-NEXT: v_max_f32_e32 v5, v0, v1
2622 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
2623 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2624 ; GFX8-NEXT: buffer_wbinvl1
2625 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
2626 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2627 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2628 ; GFX8-NEXT: s_cbranch_execnz .LBB14_1
2629 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2630 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2631 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2633 ; GFX7-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos__ftz:
2635 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2636 ; GFX7-NEXT: s_mov_b32 s6, 0
2637 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
2638 ; GFX7-NEXT: s_mov_b32 s4, s6
2639 ; GFX7-NEXT: s_mov_b32 s5, s6
2640 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2044
2641 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
2642 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
2643 ; GFX7-NEXT: .LBB14_1: ; %atomicrmw.start
2644 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2645 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2646 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
2647 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v5
2648 ; GFX7-NEXT: v_max_f32_e32 v4, v3, v2
2649 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
2650 ; GFX7-NEXT: v_mov_b32_e32 v4, v5
2651 ; GFX7-NEXT: buffer_atomic_cmpswap v[3:4], v[0:1], s[4:7], 0 addr64 offset:2044 glc
2652 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2653 ; GFX7-NEXT: buffer_wbinvl1
2654 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
2655 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
2656 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
2657 ; GFX7-NEXT: s_cbranch_execnz .LBB14_1
2658 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2659 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
2660 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
2661 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2663 ; GFX6-LABEL: global_system_atomic_fmax_ret_f32__offset12b_pos__ftz:
2665 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2666 ; GFX6-NEXT: s_mov_b32 s6, 0
2667 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
2668 ; GFX6-NEXT: s_mov_b32 s4, s6
2669 ; GFX6-NEXT: s_mov_b32 s5, s6
2670 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2044
2671 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
2672 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
2673 ; GFX6-NEXT: .LBB14_1: ; %atomicrmw.start
2674 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
2675 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2676 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
2677 ; GFX6-NEXT: s_waitcnt expcnt(0)
2678 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v5
2679 ; GFX6-NEXT: v_max_f32_e32 v4, v3, v2
2680 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
2681 ; GFX6-NEXT: v_mov_b32_e32 v4, v5
2682 ; GFX6-NEXT: buffer_atomic_cmpswap v[3:4], v[0:1], s[4:7], 0 addr64 offset:2044 glc
2683 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2684 ; GFX6-NEXT: buffer_wbinvl1
2685 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
2686 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
2687 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
2688 ; GFX6-NEXT: s_cbranch_execnz .LBB14_1
2689 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
2690 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
2691 ; GFX6-NEXT: v_mov_b32_e32 v0, v3
2692 ; GFX6-NEXT: s_waitcnt expcnt(0)
2693 ; GFX6-NEXT: s_setpc_b64 s[30:31]
2694 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 511
2695 %result = atomicrmw fmax ptr addrspace(1) %gep, float %val seq_cst
2699 define void @global_system_atomic_fmax_noret_f32__offset12b_pos__ftz(ptr addrspace(1) %ptr, float %val) #1 {
2700 ; GFX12-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos__ftz:
2702 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2703 ; GFX12-NEXT: s_wait_expcnt 0x0
2704 ; GFX12-NEXT: s_wait_samplecnt 0x0
2705 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2706 ; GFX12-NEXT: s_wait_kmcnt 0x0
2707 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
2708 ; GFX12-NEXT: v_max_num_f32_e32 v4, v2, v2
2709 ; GFX12-NEXT: s_mov_b32 s0, 0
2710 ; GFX12-NEXT: .LBB15_1: ; %atomicrmw.start
2711 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
2712 ; GFX12-NEXT: s_wait_loadcnt 0x0
2713 ; GFX12-NEXT: v_max_num_f32_e32 v2, v3, v3
2714 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
2715 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v4
2716 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
2717 ; GFX12-NEXT: s_wait_storecnt 0x0
2718 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
2719 ; GFX12-NEXT: s_wait_loadcnt 0x0
2720 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
2721 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
2722 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
2723 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
2724 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2725 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2726 ; GFX12-NEXT: s_cbranch_execnz .LBB15_1
2727 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
2728 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
2729 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2731 ; GFX940-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos__ftz:
2733 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2734 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
2735 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
2736 ; GFX940-NEXT: v_max_f32_e32 v4, v2, v2
2737 ; GFX940-NEXT: .LBB15_1: ; %atomicrmw.start
2738 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
2739 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2740 ; GFX940-NEXT: v_max_f32_e32 v2, v3, v3
2741 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
2742 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
2743 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 sc0 sc1
2744 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2745 ; GFX940-NEXT: buffer_inv sc0 sc1
2746 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2747 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
2748 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
2749 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
2750 ; GFX940-NEXT: s_cbranch_execnz .LBB15_1
2751 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
2752 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
2753 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2755 ; GFX11-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos__ftz:
2757 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2758 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
2759 ; GFX11-NEXT: v_max_f32_e32 v4, v2, v2
2760 ; GFX11-NEXT: s_mov_b32 s0, 0
2761 ; GFX11-NEXT: .LBB15_1: ; %atomicrmw.start
2762 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
2763 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2764 ; GFX11-NEXT: v_max_f32_e32 v2, v3, v3
2765 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
2766 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v4
2767 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2768 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 glc
2769 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2770 ; GFX11-NEXT: buffer_gl1_inv
2771 ; GFX11-NEXT: buffer_gl0_inv
2772 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
2773 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
2774 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2775 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2776 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2777 ; GFX11-NEXT: s_cbranch_execnz .LBB15_1
2778 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
2779 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
2780 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2782 ; GFX10-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos__ftz:
2784 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2785 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
2786 ; GFX10-NEXT: v_max_f32_e32 v4, v2, v2
2787 ; GFX10-NEXT: s_mov_b32 s4, 0
2788 ; GFX10-NEXT: .LBB15_1: ; %atomicrmw.start
2789 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2790 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2791 ; GFX10-NEXT: v_max_f32_e32 v2, v3, v3
2792 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v4
2793 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2794 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
2795 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2796 ; GFX10-NEXT: buffer_gl1_inv
2797 ; GFX10-NEXT: buffer_gl0_inv
2798 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
2799 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
2800 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2801 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2802 ; GFX10-NEXT: s_cbranch_execnz .LBB15_1
2803 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2804 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2805 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2807 ; GFX90A-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos__ftz:
2809 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2810 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
2811 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
2812 ; GFX90A-NEXT: v_max_f32_e32 v4, v2, v2
2813 ; GFX90A-NEXT: .LBB15_1: ; %atomicrmw.start
2814 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
2815 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2816 ; GFX90A-NEXT: v_max_f32_e32 v2, v3, v3
2817 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
2818 ; GFX90A-NEXT: buffer_wbl2
2819 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
2820 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2821 ; GFX90A-NEXT: buffer_invl2
2822 ; GFX90A-NEXT: buffer_wbinvl1
2823 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2824 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2825 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
2826 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
2827 ; GFX90A-NEXT: s_cbranch_execnz .LBB15_1
2828 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
2829 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2830 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2832 ; GFX908-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos__ftz:
2834 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2835 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
2836 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2837 ; GFX908-NEXT: v_max_f32_e32 v4, v2, v2
2838 ; GFX908-NEXT: .LBB15_1: ; %atomicrmw.start
2839 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2840 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2841 ; GFX908-NEXT: v_max_f32_e32 v2, v3, v3
2842 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
2843 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
2844 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2845 ; GFX908-NEXT: buffer_wbinvl1
2846 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2847 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2848 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
2849 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2850 ; GFX908-NEXT: s_cbranch_execnz .LBB15_1
2851 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2852 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2853 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2855 ; GFX8-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos__ftz:
2857 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2858 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
2859 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2860 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2861 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2862 ; GFX8-NEXT: v_mul_f32_e32 v4, 1.0, v2
2863 ; GFX8-NEXT: .LBB15_1: ; %atomicrmw.start
2864 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2865 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2866 ; GFX8-NEXT: v_mul_f32_e32 v2, 1.0, v3
2867 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
2868 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
2869 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2870 ; GFX8-NEXT: buffer_wbinvl1
2871 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
2872 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2873 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
2874 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2875 ; GFX8-NEXT: s_cbranch_execnz .LBB15_1
2876 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2877 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2878 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2880 ; GFX7-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos__ftz:
2882 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2883 ; GFX7-NEXT: s_mov_b32 s6, 0
2884 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
2885 ; GFX7-NEXT: s_mov_b32 s4, s6
2886 ; GFX7-NEXT: s_mov_b32 s5, s6
2887 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2044
2888 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
2889 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v2
2890 ; GFX7-NEXT: .LBB15_1: ; %atomicrmw.start
2891 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2892 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2893 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v3
2894 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v4
2895 ; GFX7-NEXT: v_mov_b32_e32 v6, v3
2896 ; GFX7-NEXT: v_mov_b32_e32 v5, v2
2897 ; GFX7-NEXT: buffer_atomic_cmpswap v[5:6], v[0:1], s[4:7], 0 addr64 offset:2044 glc
2898 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2899 ; GFX7-NEXT: buffer_wbinvl1
2900 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
2901 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
2902 ; GFX7-NEXT: v_mov_b32_e32 v3, v5
2903 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
2904 ; GFX7-NEXT: s_cbranch_execnz .LBB15_1
2905 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2906 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
2907 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2909 ; GFX6-LABEL: global_system_atomic_fmax_noret_f32__offset12b_pos__ftz:
2911 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2912 ; GFX6-NEXT: s_mov_b32 s6, 0
2913 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
2914 ; GFX6-NEXT: s_mov_b32 s4, s6
2915 ; GFX6-NEXT: s_mov_b32 s5, s6
2916 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2044
2917 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
2918 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v2
2919 ; GFX6-NEXT: .LBB15_1: ; %atomicrmw.start
2920 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
2921 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2922 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v3
2923 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v4
2924 ; GFX6-NEXT: s_waitcnt expcnt(0)
2925 ; GFX6-NEXT: v_mov_b32_e32 v6, v3
2926 ; GFX6-NEXT: v_mov_b32_e32 v5, v2
2927 ; GFX6-NEXT: buffer_atomic_cmpswap v[5:6], v[0:1], s[4:7], 0 addr64 offset:2044 glc
2928 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2929 ; GFX6-NEXT: buffer_wbinvl1
2930 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
2931 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
2932 ; GFX6-NEXT: v_mov_b32_e32 v3, v5
2933 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
2934 ; GFX6-NEXT: s_cbranch_execnz .LBB15_1
2935 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
2936 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
2937 ; GFX6-NEXT: s_waitcnt expcnt(0)
2938 ; GFX6-NEXT: s_setpc_b64 s[30:31]
2939 %gep = getelementptr float, ptr addrspace(1) %ptr, i64 511
2940 %unused = atomicrmw fmax ptr addrspace(1) %gep, float %val seq_cst
2944 ; --------------------------------------------------------------------
2946 ; --------------------------------------------------------------------
2948 define double @global_agent_atomic_fmax_ret_f64(ptr addrspace(1) %ptr, double %val) #0 {
2949 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f64:
2951 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2952 ; GFX12-NEXT: s_wait_expcnt 0x0
2953 ; GFX12-NEXT: s_wait_samplecnt 0x0
2954 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2955 ; GFX12-NEXT: s_wait_kmcnt 0x0
2956 ; GFX12-NEXT: global_load_b64 v[4:5], v[0:1], off
2957 ; GFX12-NEXT: v_max_num_f64_e32 v[2:3], v[2:3], v[2:3]
2958 ; GFX12-NEXT: s_mov_b32 s0, 0
2959 ; GFX12-NEXT: .LBB16_1: ; %atomicrmw.start
2960 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
2961 ; GFX12-NEXT: s_wait_loadcnt 0x0
2962 ; GFX12-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
2963 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
2964 ; GFX12-NEXT: v_max_num_f64_e32 v[4:5], v[6:7], v[6:7]
2965 ; GFX12-NEXT: v_max_num_f64_e32 v[4:5], v[4:5], v[2:3]
2966 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
2967 ; GFX12-NEXT: s_wait_storecnt 0x0
2968 ; GFX12-NEXT: global_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
2969 ; GFX12-NEXT: s_wait_loadcnt 0x0
2970 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
2971 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
2972 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
2973 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
2974 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2975 ; GFX12-NEXT: s_cbranch_execnz .LBB16_1
2976 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
2977 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
2978 ; GFX12-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
2979 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2981 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f64:
2983 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2984 ; GFX940-NEXT: buffer_wbl2 sc1
2985 ; GFX940-NEXT: global_atomic_max_f64 v[0:1], v[0:1], v[2:3], off sc0
2986 ; GFX940-NEXT: s_waitcnt vmcnt(0)
2987 ; GFX940-NEXT: buffer_inv sc1
2988 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2990 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f64:
2992 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2993 ; GFX11-NEXT: global_load_b64 v[4:5], v[0:1], off
2994 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
2995 ; GFX11-NEXT: s_mov_b32 s0, 0
2996 ; GFX11-NEXT: .LBB16_1: ; %atomicrmw.start
2997 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
2998 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2999 ; GFX11-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
3000 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3001 ; GFX11-NEXT: v_max_f64 v[4:5], v[6:7], v[6:7]
3002 ; GFX11-NEXT: v_max_f64 v[4:5], v[4:5], v[2:3]
3003 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3004 ; GFX11-NEXT: global_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7], off glc
3005 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3006 ; GFX11-NEXT: buffer_gl1_inv
3007 ; GFX11-NEXT: buffer_gl0_inv
3008 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
3009 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3010 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3011 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3012 ; GFX11-NEXT: s_cbranch_execnz .LBB16_1
3013 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3014 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3015 ; GFX11-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
3016 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3018 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f64:
3020 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3021 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3022 ; GFX10-NEXT: global_atomic_fmax_x2 v[0:1], v[0:1], v[2:3], off glc
3023 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3024 ; GFX10-NEXT: buffer_gl1_inv
3025 ; GFX10-NEXT: buffer_gl0_inv
3026 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3028 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f64:
3030 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3031 ; GFX90A-NEXT: global_atomic_max_f64 v[0:1], v[0:1], v[2:3], off glc
3032 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3033 ; GFX90A-NEXT: buffer_wbinvl1
3034 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3036 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f64:
3038 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3039 ; GFX908-NEXT: global_load_dwordx2 v[4:5], v[0:1], off
3040 ; GFX908-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3041 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3042 ; GFX908-NEXT: .LBB16_1: ; %atomicrmw.start
3043 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3044 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3045 ; GFX908-NEXT: v_mov_b32_e32 v7, v5
3046 ; GFX908-NEXT: v_mov_b32_e32 v6, v4
3047 ; GFX908-NEXT: v_max_f64 v[4:5], v[6:7], v[6:7]
3048 ; GFX908-NEXT: v_max_f64 v[4:5], v[4:5], v[2:3]
3049 ; GFX908-NEXT: global_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7], off glc
3050 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3051 ; GFX908-NEXT: buffer_wbinvl1
3052 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
3053 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3054 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3055 ; GFX908-NEXT: s_cbranch_execnz .LBB16_1
3056 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3057 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3058 ; GFX908-NEXT: v_mov_b32_e32 v0, v4
3059 ; GFX908-NEXT: v_mov_b32_e32 v1, v5
3060 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3062 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f64:
3064 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3065 ; GFX8-NEXT: flat_load_dwordx2 v[4:5], v[0:1]
3066 ; GFX8-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3067 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3068 ; GFX8-NEXT: .LBB16_1: ; %atomicrmw.start
3069 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3070 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3071 ; GFX8-NEXT: v_mov_b32_e32 v7, v5
3072 ; GFX8-NEXT: v_mov_b32_e32 v6, v4
3073 ; GFX8-NEXT: v_max_f64 v[4:5], v[6:7], v[6:7]
3074 ; GFX8-NEXT: v_max_f64 v[4:5], v[4:5], v[2:3]
3075 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
3076 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3077 ; GFX8-NEXT: buffer_wbinvl1
3078 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
3079 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3080 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3081 ; GFX8-NEXT: s_cbranch_execnz .LBB16_1
3082 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3083 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3084 ; GFX8-NEXT: v_mov_b32_e32 v0, v4
3085 ; GFX8-NEXT: v_mov_b32_e32 v1, v5
3086 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3088 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f64:
3090 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3091 ; GFX7-NEXT: s_mov_b32 s6, 0
3092 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
3093 ; GFX7-NEXT: s_mov_b32 s4, s6
3094 ; GFX7-NEXT: s_mov_b32 s5, s6
3095 ; GFX7-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64 glc
3096 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3097 ; GFX7-NEXT: buffer_wbinvl1
3098 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
3099 ; GFX7-NEXT: v_mov_b32_e32 v1, v3
3100 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3102 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f64:
3104 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3105 ; GFX6-NEXT: s_mov_b32 s6, 0
3106 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
3107 ; GFX6-NEXT: s_mov_b32 s4, s6
3108 ; GFX6-NEXT: s_mov_b32 s5, s6
3109 ; GFX6-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64 glc
3110 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3111 ; GFX6-NEXT: buffer_wbinvl1
3112 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
3113 ; GFX6-NEXT: v_mov_b32_e32 v1, v3
3114 ; GFX6-NEXT: s_waitcnt expcnt(0)
3115 ; GFX6-NEXT: s_setpc_b64 s[30:31]
3116 %result = atomicrmw fmax ptr addrspace(1) %ptr, double %val syncscope("agent") seq_cst
3120 define double @global_agent_atomic_fmax_ret_f64__offset12b_pos(ptr addrspace(1) %ptr, double %val) #0 {
3121 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_pos:
3123 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3124 ; GFX12-NEXT: s_wait_expcnt 0x0
3125 ; GFX12-NEXT: s_wait_samplecnt 0x0
3126 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3127 ; GFX12-NEXT: s_wait_kmcnt 0x0
3128 ; GFX12-NEXT: global_load_b64 v[4:5], v[0:1], off offset:2040
3129 ; GFX12-NEXT: v_max_num_f64_e32 v[2:3], v[2:3], v[2:3]
3130 ; GFX12-NEXT: s_mov_b32 s0, 0
3131 ; GFX12-NEXT: .LBB17_1: ; %atomicrmw.start
3132 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3133 ; GFX12-NEXT: s_wait_loadcnt 0x0
3134 ; GFX12-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
3135 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3136 ; GFX12-NEXT: v_max_num_f64_e32 v[4:5], v[6:7], v[6:7]
3137 ; GFX12-NEXT: v_max_num_f64_e32 v[4:5], v[4:5], v[2:3]
3138 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
3139 ; GFX12-NEXT: s_wait_storecnt 0x0
3140 ; GFX12-NEXT: global_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7], off offset:2040 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
3141 ; GFX12-NEXT: s_wait_loadcnt 0x0
3142 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
3143 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
3144 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3145 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3146 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3147 ; GFX12-NEXT: s_cbranch_execnz .LBB17_1
3148 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3149 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3150 ; GFX12-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
3151 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3153 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_pos:
3155 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3156 ; GFX940-NEXT: buffer_wbl2 sc1
3157 ; GFX940-NEXT: global_atomic_max_f64 v[0:1], v[0:1], v[2:3], off offset:2040 sc0
3158 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3159 ; GFX940-NEXT: buffer_inv sc1
3160 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3162 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_pos:
3164 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3165 ; GFX11-NEXT: global_load_b64 v[4:5], v[0:1], off offset:2040
3166 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3167 ; GFX11-NEXT: s_mov_b32 s0, 0
3168 ; GFX11-NEXT: .LBB17_1: ; %atomicrmw.start
3169 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
3170 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3171 ; GFX11-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
3172 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3173 ; GFX11-NEXT: v_max_f64 v[4:5], v[6:7], v[6:7]
3174 ; GFX11-NEXT: v_max_f64 v[4:5], v[4:5], v[2:3]
3175 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3176 ; GFX11-NEXT: global_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7], off offset:2040 glc
3177 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3178 ; GFX11-NEXT: buffer_gl1_inv
3179 ; GFX11-NEXT: buffer_gl0_inv
3180 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
3181 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3182 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3183 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3184 ; GFX11-NEXT: s_cbranch_execnz .LBB17_1
3185 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3186 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3187 ; GFX11-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
3188 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3190 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_pos:
3192 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3193 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3194 ; GFX10-NEXT: global_atomic_fmax_x2 v[0:1], v[0:1], v[2:3], off offset:2040 glc
3195 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3196 ; GFX10-NEXT: buffer_gl1_inv
3197 ; GFX10-NEXT: buffer_gl0_inv
3198 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3200 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_pos:
3202 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3203 ; GFX90A-NEXT: global_atomic_max_f64 v[0:1], v[0:1], v[2:3], off offset:2040 glc
3204 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3205 ; GFX90A-NEXT: buffer_wbinvl1
3206 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3208 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_pos:
3210 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3211 ; GFX908-NEXT: global_load_dwordx2 v[4:5], v[0:1], off offset:2040
3212 ; GFX908-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3213 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3214 ; GFX908-NEXT: .LBB17_1: ; %atomicrmw.start
3215 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3216 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3217 ; GFX908-NEXT: v_mov_b32_e32 v7, v5
3218 ; GFX908-NEXT: v_mov_b32_e32 v6, v4
3219 ; GFX908-NEXT: v_max_f64 v[4:5], v[6:7], v[6:7]
3220 ; GFX908-NEXT: v_max_f64 v[4:5], v[4:5], v[2:3]
3221 ; GFX908-NEXT: global_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7], off offset:2040 glc
3222 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3223 ; GFX908-NEXT: buffer_wbinvl1
3224 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
3225 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3226 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3227 ; GFX908-NEXT: s_cbranch_execnz .LBB17_1
3228 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3229 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3230 ; GFX908-NEXT: v_mov_b32_e32 v0, v4
3231 ; GFX908-NEXT: v_mov_b32_e32 v1, v5
3232 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3234 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_pos:
3236 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3237 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7f8, v0
3238 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
3239 ; GFX8-NEXT: flat_load_dwordx2 v[0:1], v[4:5]
3240 ; GFX8-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3241 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3242 ; GFX8-NEXT: .LBB17_1: ; %atomicrmw.start
3243 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3244 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3245 ; GFX8-NEXT: v_mov_b32_e32 v9, v1
3246 ; GFX8-NEXT: v_mov_b32_e32 v8, v0
3247 ; GFX8-NEXT: v_max_f64 v[0:1], v[8:9], v[8:9]
3248 ; GFX8-NEXT: v_max_f64 v[6:7], v[0:1], v[2:3]
3249 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[4:5], v[6:9] glc
3250 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3251 ; GFX8-NEXT: buffer_wbinvl1
3252 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[8:9]
3253 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3254 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3255 ; GFX8-NEXT: s_cbranch_execnz .LBB17_1
3256 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3257 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3258 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3260 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_pos:
3262 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3263 ; GFX7-NEXT: s_mov_b32 s6, 0
3264 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
3265 ; GFX7-NEXT: s_mov_b32 s4, s6
3266 ; GFX7-NEXT: s_mov_b32 s5, s6
3267 ; GFX7-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64 offset:2040 glc
3268 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3269 ; GFX7-NEXT: buffer_wbinvl1
3270 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
3271 ; GFX7-NEXT: v_mov_b32_e32 v1, v3
3272 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3274 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_pos:
3276 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3277 ; GFX6-NEXT: s_mov_b32 s6, 0
3278 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
3279 ; GFX6-NEXT: s_mov_b32 s4, s6
3280 ; GFX6-NEXT: s_mov_b32 s5, s6
3281 ; GFX6-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64 offset:2040 glc
3282 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3283 ; GFX6-NEXT: buffer_wbinvl1
3284 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
3285 ; GFX6-NEXT: v_mov_b32_e32 v1, v3
3286 ; GFX6-NEXT: s_waitcnt expcnt(0)
3287 ; GFX6-NEXT: s_setpc_b64 s[30:31]
3288 %gep = getelementptr double, ptr addrspace(1) %ptr, i64 255
3289 %result = atomicrmw fmax ptr addrspace(1) %gep, double %val syncscope("agent") seq_cst
3293 define double @global_agent_atomic_fmax_ret_f64__offset12b_neg(ptr addrspace(1) %ptr, double %val) #0 {
3294 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_neg:
3296 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3297 ; GFX12-NEXT: s_wait_expcnt 0x0
3298 ; GFX12-NEXT: s_wait_samplecnt 0x0
3299 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3300 ; GFX12-NEXT: s_wait_kmcnt 0x0
3301 ; GFX12-NEXT: global_load_b64 v[4:5], v[0:1], off offset:-2048
3302 ; GFX12-NEXT: v_max_num_f64_e32 v[2:3], v[2:3], v[2:3]
3303 ; GFX12-NEXT: s_mov_b32 s0, 0
3304 ; GFX12-NEXT: .LBB18_1: ; %atomicrmw.start
3305 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3306 ; GFX12-NEXT: s_wait_loadcnt 0x0
3307 ; GFX12-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
3308 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3309 ; GFX12-NEXT: v_max_num_f64_e32 v[4:5], v[6:7], v[6:7]
3310 ; GFX12-NEXT: v_max_num_f64_e32 v[4:5], v[4:5], v[2:3]
3311 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
3312 ; GFX12-NEXT: s_wait_storecnt 0x0
3313 ; GFX12-NEXT: global_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7], off offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
3314 ; GFX12-NEXT: s_wait_loadcnt 0x0
3315 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
3316 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
3317 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3318 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3319 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3320 ; GFX12-NEXT: s_cbranch_execnz .LBB18_1
3321 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3322 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3323 ; GFX12-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
3324 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3326 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_neg:
3328 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3329 ; GFX940-NEXT: buffer_wbl2 sc1
3330 ; GFX940-NEXT: global_atomic_max_f64 v[0:1], v[0:1], v[2:3], off offset:-2048 sc0
3331 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3332 ; GFX940-NEXT: buffer_inv sc1
3333 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3335 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_neg:
3337 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3338 ; GFX11-NEXT: global_load_b64 v[4:5], v[0:1], off offset:-2048
3339 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3340 ; GFX11-NEXT: s_mov_b32 s0, 0
3341 ; GFX11-NEXT: .LBB18_1: ; %atomicrmw.start
3342 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
3343 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3344 ; GFX11-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
3345 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3346 ; GFX11-NEXT: v_max_f64 v[4:5], v[6:7], v[6:7]
3347 ; GFX11-NEXT: v_max_f64 v[4:5], v[4:5], v[2:3]
3348 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3349 ; GFX11-NEXT: global_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7], off offset:-2048 glc
3350 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3351 ; GFX11-NEXT: buffer_gl1_inv
3352 ; GFX11-NEXT: buffer_gl0_inv
3353 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
3354 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3355 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3356 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3357 ; GFX11-NEXT: s_cbranch_execnz .LBB18_1
3358 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3359 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3360 ; GFX11-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
3361 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3363 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_neg:
3365 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3366 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3367 ; GFX10-NEXT: global_atomic_fmax_x2 v[0:1], v[0:1], v[2:3], off offset:-2048 glc
3368 ; GFX10-NEXT: s_waitcnt vmcnt(0)
3369 ; GFX10-NEXT: buffer_gl1_inv
3370 ; GFX10-NEXT: buffer_gl0_inv
3371 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3373 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_neg:
3375 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3376 ; GFX90A-NEXT: global_atomic_max_f64 v[0:1], v[0:1], v[2:3], off offset:-2048 glc
3377 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3378 ; GFX90A-NEXT: buffer_wbinvl1
3379 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3381 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_neg:
3383 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3384 ; GFX908-NEXT: global_load_dwordx2 v[4:5], v[0:1], off offset:-2048
3385 ; GFX908-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3386 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3387 ; GFX908-NEXT: .LBB18_1: ; %atomicrmw.start
3388 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3389 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3390 ; GFX908-NEXT: v_mov_b32_e32 v7, v5
3391 ; GFX908-NEXT: v_mov_b32_e32 v6, v4
3392 ; GFX908-NEXT: v_max_f64 v[4:5], v[6:7], v[6:7]
3393 ; GFX908-NEXT: v_max_f64 v[4:5], v[4:5], v[2:3]
3394 ; GFX908-NEXT: global_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7], off offset:-2048 glc
3395 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3396 ; GFX908-NEXT: buffer_wbinvl1
3397 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
3398 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3399 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3400 ; GFX908-NEXT: s_cbranch_execnz .LBB18_1
3401 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3402 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3403 ; GFX908-NEXT: v_mov_b32_e32 v0, v4
3404 ; GFX908-NEXT: v_mov_b32_e32 v1, v5
3405 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3407 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_neg:
3409 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3410 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0xfffff800, v0
3411 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, -1, v1, vcc
3412 ; GFX8-NEXT: flat_load_dwordx2 v[0:1], v[4:5]
3413 ; GFX8-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3414 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3415 ; GFX8-NEXT: .LBB18_1: ; %atomicrmw.start
3416 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3417 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3418 ; GFX8-NEXT: v_mov_b32_e32 v9, v1
3419 ; GFX8-NEXT: v_mov_b32_e32 v8, v0
3420 ; GFX8-NEXT: v_max_f64 v[0:1], v[8:9], v[8:9]
3421 ; GFX8-NEXT: v_max_f64 v[6:7], v[0:1], v[2:3]
3422 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[4:5], v[6:9] glc
3423 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3424 ; GFX8-NEXT: buffer_wbinvl1
3425 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[8:9]
3426 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3427 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3428 ; GFX8-NEXT: s_cbranch_execnz .LBB18_1
3429 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3430 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3431 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3433 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_neg:
3435 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3436 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
3437 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
3438 ; GFX7-NEXT: s_mov_b32 s6, 0
3439 ; GFX7-NEXT: s_mov_b32 s5, -1
3440 ; GFX7-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64 glc
3441 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3442 ; GFX7-NEXT: buffer_wbinvl1
3443 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
3444 ; GFX7-NEXT: v_mov_b32_e32 v1, v3
3445 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3447 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f64__offset12b_neg:
3449 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3450 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
3451 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
3452 ; GFX6-NEXT: s_mov_b32 s6, 0
3453 ; GFX6-NEXT: s_mov_b32 s5, -1
3454 ; GFX6-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64 glc
3455 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3456 ; GFX6-NEXT: buffer_wbinvl1
3457 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
3458 ; GFX6-NEXT: v_mov_b32_e32 v1, v3
3459 ; GFX6-NEXT: s_waitcnt expcnt(0)
3460 ; GFX6-NEXT: s_setpc_b64 s[30:31]
3461 %gep = getelementptr double, ptr addrspace(1) %ptr, i64 -256
3462 %result = atomicrmw fmax ptr addrspace(1) %gep, double %val syncscope("agent") seq_cst
3466 define void @global_agent_atomic_fmax_noret_f64(ptr addrspace(1) %ptr, double %val) #0 {
3467 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f64:
3469 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3470 ; GFX12-NEXT: s_wait_expcnt 0x0
3471 ; GFX12-NEXT: s_wait_samplecnt 0x0
3472 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3473 ; GFX12-NEXT: s_wait_kmcnt 0x0
3474 ; GFX12-NEXT: global_load_b64 v[4:5], v[0:1], off
3475 ; GFX12-NEXT: v_max_num_f64_e32 v[6:7], v[2:3], v[2:3]
3476 ; GFX12-NEXT: s_mov_b32 s0, 0
3477 ; GFX12-NEXT: .LBB19_1: ; %atomicrmw.start
3478 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3479 ; GFX12-NEXT: s_wait_loadcnt 0x0
3480 ; GFX12-NEXT: v_max_num_f64_e32 v[2:3], v[4:5], v[4:5]
3481 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3482 ; GFX12-NEXT: v_max_num_f64_e32 v[2:3], v[2:3], v[6:7]
3483 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
3484 ; GFX12-NEXT: s_wait_storecnt 0x0
3485 ; GFX12-NEXT: global_atomic_cmpswap_b64 v[2:3], v[0:1], v[2:5], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
3486 ; GFX12-NEXT: s_wait_loadcnt 0x0
3487 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
3488 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5]
3489 ; GFX12-NEXT: v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2
3490 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3491 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3492 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3493 ; GFX12-NEXT: s_cbranch_execnz .LBB19_1
3494 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3495 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3496 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3498 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f64:
3500 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3501 ; GFX940-NEXT: buffer_wbl2 sc1
3502 ; GFX940-NEXT: global_atomic_max_f64 v[0:1], v[2:3], off
3503 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3504 ; GFX940-NEXT: buffer_inv sc1
3505 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3507 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f64:
3509 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3510 ; GFX11-NEXT: global_load_b64 v[4:5], v[0:1], off
3511 ; GFX11-NEXT: v_max_f64 v[6:7], v[2:3], v[2:3]
3512 ; GFX11-NEXT: s_mov_b32 s0, 0
3513 ; GFX11-NEXT: .LBB19_1: ; %atomicrmw.start
3514 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
3515 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3516 ; GFX11-NEXT: v_max_f64 v[2:3], v[4:5], v[4:5]
3517 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
3518 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[6:7]
3519 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3520 ; GFX11-NEXT: global_atomic_cmpswap_b64 v[2:3], v[0:1], v[2:5], off glc
3521 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3522 ; GFX11-NEXT: buffer_gl1_inv
3523 ; GFX11-NEXT: buffer_gl0_inv
3524 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5]
3525 ; GFX11-NEXT: v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2
3526 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3527 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3528 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3529 ; GFX11-NEXT: s_cbranch_execnz .LBB19_1
3530 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3531 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3532 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3534 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f64:
3536 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3537 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3538 ; GFX10-NEXT: global_atomic_fmax_x2 v[0:1], v[2:3], off
3539 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3540 ; GFX10-NEXT: buffer_gl1_inv
3541 ; GFX10-NEXT: buffer_gl0_inv
3542 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3544 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f64:
3546 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3547 ; GFX90A-NEXT: global_atomic_max_f64 v[0:1], v[2:3], off
3548 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3549 ; GFX90A-NEXT: buffer_wbinvl1
3550 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3552 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f64:
3554 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3555 ; GFX908-NEXT: global_load_dwordx2 v[4:5], v[0:1], off
3556 ; GFX908-NEXT: v_max_f64 v[6:7], v[2:3], v[2:3]
3557 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3558 ; GFX908-NEXT: .LBB19_1: ; %atomicrmw.start
3559 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3560 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3561 ; GFX908-NEXT: v_max_f64 v[2:3], v[4:5], v[4:5]
3562 ; GFX908-NEXT: v_max_f64 v[2:3], v[2:3], v[6:7]
3563 ; GFX908-NEXT: global_atomic_cmpswap_x2 v[2:3], v[0:1], v[2:5], off glc
3564 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3565 ; GFX908-NEXT: buffer_wbinvl1
3566 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[2:3], v[4:5]
3567 ; GFX908-NEXT: v_mov_b32_e32 v5, v3
3568 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3569 ; GFX908-NEXT: v_mov_b32_e32 v4, v2
3570 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3571 ; GFX908-NEXT: s_cbranch_execnz .LBB19_1
3572 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3573 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3574 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3576 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f64:
3578 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3579 ; GFX8-NEXT: flat_load_dwordx2 v[4:5], v[0:1]
3580 ; GFX8-NEXT: v_max_f64 v[6:7], v[2:3], v[2:3]
3581 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3582 ; GFX8-NEXT: .LBB19_1: ; %atomicrmw.start
3583 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3584 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3585 ; GFX8-NEXT: v_max_f64 v[2:3], v[4:5], v[4:5]
3586 ; GFX8-NEXT: v_max_f64 v[2:3], v[2:3], v[6:7]
3587 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[2:3], v[0:1], v[2:5] glc
3588 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3589 ; GFX8-NEXT: buffer_wbinvl1
3590 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[2:3], v[4:5]
3591 ; GFX8-NEXT: v_mov_b32_e32 v5, v3
3592 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3593 ; GFX8-NEXT: v_mov_b32_e32 v4, v2
3594 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3595 ; GFX8-NEXT: s_cbranch_execnz .LBB19_1
3596 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3597 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3598 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3600 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f64:
3602 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3603 ; GFX7-NEXT: s_mov_b32 s6, 0
3604 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
3605 ; GFX7-NEXT: s_mov_b32 s4, s6
3606 ; GFX7-NEXT: s_mov_b32 s5, s6
3607 ; GFX7-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64
3608 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3609 ; GFX7-NEXT: buffer_wbinvl1
3610 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3612 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f64:
3614 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3615 ; GFX6-NEXT: s_mov_b32 s6, 0
3616 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
3617 ; GFX6-NEXT: s_mov_b32 s4, s6
3618 ; GFX6-NEXT: s_mov_b32 s5, s6
3619 ; GFX6-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64
3620 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3621 ; GFX6-NEXT: buffer_wbinvl1
3622 ; GFX6-NEXT: s_waitcnt expcnt(0)
3623 ; GFX6-NEXT: s_setpc_b64 s[30:31]
3624 %unused = atomicrmw fmax ptr addrspace(1) %ptr, double %val syncscope("agent") seq_cst
3628 define void @global_agent_atomic_fmax_noret_f64__offset12b_pos(ptr addrspace(1) %ptr, double %val) #0 {
3629 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_pos:
3631 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3632 ; GFX12-NEXT: s_wait_expcnt 0x0
3633 ; GFX12-NEXT: s_wait_samplecnt 0x0
3634 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3635 ; GFX12-NEXT: s_wait_kmcnt 0x0
3636 ; GFX12-NEXT: global_load_b64 v[4:5], v[0:1], off offset:2040
3637 ; GFX12-NEXT: v_max_num_f64_e32 v[6:7], v[2:3], v[2:3]
3638 ; GFX12-NEXT: s_mov_b32 s0, 0
3639 ; GFX12-NEXT: .LBB20_1: ; %atomicrmw.start
3640 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3641 ; GFX12-NEXT: s_wait_loadcnt 0x0
3642 ; GFX12-NEXT: v_max_num_f64_e32 v[2:3], v[4:5], v[4:5]
3643 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3644 ; GFX12-NEXT: v_max_num_f64_e32 v[2:3], v[2:3], v[6:7]
3645 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
3646 ; GFX12-NEXT: s_wait_storecnt 0x0
3647 ; GFX12-NEXT: global_atomic_cmpswap_b64 v[2:3], v[0:1], v[2:5], off offset:2040 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
3648 ; GFX12-NEXT: s_wait_loadcnt 0x0
3649 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
3650 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5]
3651 ; GFX12-NEXT: v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2
3652 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3653 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3654 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3655 ; GFX12-NEXT: s_cbranch_execnz .LBB20_1
3656 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3657 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3658 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3660 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_pos:
3662 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3663 ; GFX940-NEXT: buffer_wbl2 sc1
3664 ; GFX940-NEXT: global_atomic_max_f64 v[0:1], v[2:3], off offset:2040
3665 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3666 ; GFX940-NEXT: buffer_inv sc1
3667 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3669 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_pos:
3671 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3672 ; GFX11-NEXT: global_load_b64 v[4:5], v[0:1], off offset:2040
3673 ; GFX11-NEXT: v_max_f64 v[6:7], v[2:3], v[2:3]
3674 ; GFX11-NEXT: s_mov_b32 s0, 0
3675 ; GFX11-NEXT: .LBB20_1: ; %atomicrmw.start
3676 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
3677 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3678 ; GFX11-NEXT: v_max_f64 v[2:3], v[4:5], v[4:5]
3679 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
3680 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[6:7]
3681 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3682 ; GFX11-NEXT: global_atomic_cmpswap_b64 v[2:3], v[0:1], v[2:5], off offset:2040 glc
3683 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3684 ; GFX11-NEXT: buffer_gl1_inv
3685 ; GFX11-NEXT: buffer_gl0_inv
3686 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5]
3687 ; GFX11-NEXT: v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2
3688 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3689 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3690 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3691 ; GFX11-NEXT: s_cbranch_execnz .LBB20_1
3692 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3693 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3694 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3696 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_pos:
3698 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3699 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3700 ; GFX10-NEXT: global_atomic_fmax_x2 v[0:1], v[2:3], off offset:2040
3701 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3702 ; GFX10-NEXT: buffer_gl1_inv
3703 ; GFX10-NEXT: buffer_gl0_inv
3704 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3706 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_pos:
3708 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3709 ; GFX90A-NEXT: global_atomic_max_f64 v[0:1], v[2:3], off offset:2040
3710 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3711 ; GFX90A-NEXT: buffer_wbinvl1
3712 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3714 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_pos:
3716 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3717 ; GFX908-NEXT: global_load_dwordx2 v[4:5], v[0:1], off offset:2040
3718 ; GFX908-NEXT: v_max_f64 v[6:7], v[2:3], v[2:3]
3719 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3720 ; GFX908-NEXT: .LBB20_1: ; %atomicrmw.start
3721 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3722 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3723 ; GFX908-NEXT: v_max_f64 v[2:3], v[4:5], v[4:5]
3724 ; GFX908-NEXT: v_max_f64 v[2:3], v[2:3], v[6:7]
3725 ; GFX908-NEXT: global_atomic_cmpswap_x2 v[2:3], v[0:1], v[2:5], off offset:2040 glc
3726 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3727 ; GFX908-NEXT: buffer_wbinvl1
3728 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[2:3], v[4:5]
3729 ; GFX908-NEXT: v_mov_b32_e32 v5, v3
3730 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3731 ; GFX908-NEXT: v_mov_b32_e32 v4, v2
3732 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3733 ; GFX908-NEXT: s_cbranch_execnz .LBB20_1
3734 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3735 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3736 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3738 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_pos:
3740 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3741 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7f8, v0
3742 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
3743 ; GFX8-NEXT: flat_load_dwordx2 v[4:5], v[0:1]
3744 ; GFX8-NEXT: v_max_f64 v[6:7], v[2:3], v[2:3]
3745 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3746 ; GFX8-NEXT: .LBB20_1: ; %atomicrmw.start
3747 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3748 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3749 ; GFX8-NEXT: v_max_f64 v[2:3], v[4:5], v[4:5]
3750 ; GFX8-NEXT: v_max_f64 v[2:3], v[2:3], v[6:7]
3751 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[2:3], v[0:1], v[2:5] glc
3752 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3753 ; GFX8-NEXT: buffer_wbinvl1
3754 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[2:3], v[4:5]
3755 ; GFX8-NEXT: v_mov_b32_e32 v5, v3
3756 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3757 ; GFX8-NEXT: v_mov_b32_e32 v4, v2
3758 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3759 ; GFX8-NEXT: s_cbranch_execnz .LBB20_1
3760 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3761 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3762 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3764 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_pos:
3766 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3767 ; GFX7-NEXT: s_mov_b32 s6, 0
3768 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
3769 ; GFX7-NEXT: s_mov_b32 s4, s6
3770 ; GFX7-NEXT: s_mov_b32 s5, s6
3771 ; GFX7-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64 offset:2040
3772 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3773 ; GFX7-NEXT: buffer_wbinvl1
3774 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3776 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_pos:
3778 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3779 ; GFX6-NEXT: s_mov_b32 s6, 0
3780 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
3781 ; GFX6-NEXT: s_mov_b32 s4, s6
3782 ; GFX6-NEXT: s_mov_b32 s5, s6
3783 ; GFX6-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64 offset:2040
3784 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3785 ; GFX6-NEXT: buffer_wbinvl1
3786 ; GFX6-NEXT: s_waitcnt expcnt(0)
3787 ; GFX6-NEXT: s_setpc_b64 s[30:31]
3788 %gep = getelementptr double, ptr addrspace(1) %ptr, i64 255
3789 %unused = atomicrmw fmax ptr addrspace(1) %gep, double %val syncscope("agent") seq_cst
3793 define void @global_agent_atomic_fmax_noret_f64__offset12b_neg(ptr addrspace(1) %ptr, double %val) #0 {
3794 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_neg:
3796 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3797 ; GFX12-NEXT: s_wait_expcnt 0x0
3798 ; GFX12-NEXT: s_wait_samplecnt 0x0
3799 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3800 ; GFX12-NEXT: s_wait_kmcnt 0x0
3801 ; GFX12-NEXT: global_load_b64 v[4:5], v[0:1], off offset:-2048
3802 ; GFX12-NEXT: v_max_num_f64_e32 v[6:7], v[2:3], v[2:3]
3803 ; GFX12-NEXT: s_mov_b32 s0, 0
3804 ; GFX12-NEXT: .LBB21_1: ; %atomicrmw.start
3805 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3806 ; GFX12-NEXT: s_wait_loadcnt 0x0
3807 ; GFX12-NEXT: v_max_num_f64_e32 v[2:3], v[4:5], v[4:5]
3808 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3809 ; GFX12-NEXT: v_max_num_f64_e32 v[2:3], v[2:3], v[6:7]
3810 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
3811 ; GFX12-NEXT: s_wait_storecnt 0x0
3812 ; GFX12-NEXT: global_atomic_cmpswap_b64 v[2:3], v[0:1], v[2:5], off offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
3813 ; GFX12-NEXT: s_wait_loadcnt 0x0
3814 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
3815 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5]
3816 ; GFX12-NEXT: v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2
3817 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3818 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3819 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3820 ; GFX12-NEXT: s_cbranch_execnz .LBB21_1
3821 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3822 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3823 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3825 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_neg:
3827 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3828 ; GFX940-NEXT: buffer_wbl2 sc1
3829 ; GFX940-NEXT: global_atomic_max_f64 v[0:1], v[2:3], off offset:-2048
3830 ; GFX940-NEXT: s_waitcnt vmcnt(0)
3831 ; GFX940-NEXT: buffer_inv sc1
3832 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3834 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_neg:
3836 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3837 ; GFX11-NEXT: global_load_b64 v[4:5], v[0:1], off offset:-2048
3838 ; GFX11-NEXT: v_max_f64 v[6:7], v[2:3], v[2:3]
3839 ; GFX11-NEXT: s_mov_b32 s0, 0
3840 ; GFX11-NEXT: .LBB21_1: ; %atomicrmw.start
3841 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
3842 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3843 ; GFX11-NEXT: v_max_f64 v[2:3], v[4:5], v[4:5]
3844 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
3845 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[6:7]
3846 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3847 ; GFX11-NEXT: global_atomic_cmpswap_b64 v[2:3], v[0:1], v[2:5], off offset:-2048 glc
3848 ; GFX11-NEXT: s_waitcnt vmcnt(0)
3849 ; GFX11-NEXT: buffer_gl1_inv
3850 ; GFX11-NEXT: buffer_gl0_inv
3851 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[4:5]
3852 ; GFX11-NEXT: v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2
3853 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3854 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3855 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3856 ; GFX11-NEXT: s_cbranch_execnz .LBB21_1
3857 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3858 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3859 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3861 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_neg:
3863 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3864 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3865 ; GFX10-NEXT: global_atomic_fmax_x2 v[0:1], v[2:3], off offset:-2048
3866 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3867 ; GFX10-NEXT: buffer_gl1_inv
3868 ; GFX10-NEXT: buffer_gl0_inv
3869 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3871 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_neg:
3873 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3874 ; GFX90A-NEXT: global_atomic_max_f64 v[0:1], v[2:3], off offset:-2048
3875 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3876 ; GFX90A-NEXT: buffer_wbinvl1
3877 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3879 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_neg:
3881 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3882 ; GFX908-NEXT: global_load_dwordx2 v[4:5], v[0:1], off offset:-2048
3883 ; GFX908-NEXT: v_max_f64 v[6:7], v[2:3], v[2:3]
3884 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3885 ; GFX908-NEXT: .LBB21_1: ; %atomicrmw.start
3886 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3887 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3888 ; GFX908-NEXT: v_max_f64 v[2:3], v[4:5], v[4:5]
3889 ; GFX908-NEXT: v_max_f64 v[2:3], v[2:3], v[6:7]
3890 ; GFX908-NEXT: global_atomic_cmpswap_x2 v[2:3], v[0:1], v[2:5], off offset:-2048 glc
3891 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3892 ; GFX908-NEXT: buffer_wbinvl1
3893 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[2:3], v[4:5]
3894 ; GFX908-NEXT: v_mov_b32_e32 v5, v3
3895 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3896 ; GFX908-NEXT: v_mov_b32_e32 v4, v2
3897 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3898 ; GFX908-NEXT: s_cbranch_execnz .LBB21_1
3899 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3900 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3901 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3903 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_neg:
3905 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3906 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff800, v0
3907 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
3908 ; GFX8-NEXT: flat_load_dwordx2 v[4:5], v[0:1]
3909 ; GFX8-NEXT: v_max_f64 v[6:7], v[2:3], v[2:3]
3910 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3911 ; GFX8-NEXT: .LBB21_1: ; %atomicrmw.start
3912 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3913 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3914 ; GFX8-NEXT: v_max_f64 v[2:3], v[4:5], v[4:5]
3915 ; GFX8-NEXT: v_max_f64 v[2:3], v[2:3], v[6:7]
3916 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[2:3], v[0:1], v[2:5] glc
3917 ; GFX8-NEXT: s_waitcnt vmcnt(0)
3918 ; GFX8-NEXT: buffer_wbinvl1
3919 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[2:3], v[4:5]
3920 ; GFX8-NEXT: v_mov_b32_e32 v5, v3
3921 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3922 ; GFX8-NEXT: v_mov_b32_e32 v4, v2
3923 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3924 ; GFX8-NEXT: s_cbranch_execnz .LBB21_1
3925 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3926 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3927 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3929 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_neg:
3931 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3932 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
3933 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
3934 ; GFX7-NEXT: s_mov_b32 s6, 0
3935 ; GFX7-NEXT: s_mov_b32 s5, -1
3936 ; GFX7-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64
3937 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3938 ; GFX7-NEXT: buffer_wbinvl1
3939 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3941 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f64__offset12b_neg:
3943 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3944 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
3945 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
3946 ; GFX6-NEXT: s_mov_b32 s6, 0
3947 ; GFX6-NEXT: s_mov_b32 s5, -1
3948 ; GFX6-NEXT: buffer_atomic_fmax_x2 v[2:3], v[0:1], s[4:7], 0 addr64
3949 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3950 ; GFX6-NEXT: buffer_wbinvl1
3951 ; GFX6-NEXT: s_waitcnt expcnt(0)
3952 ; GFX6-NEXT: s_setpc_b64 s[30:31]
3953 %gep = getelementptr double, ptr addrspace(1) %ptr, i64 -256
3954 %unused = atomicrmw fmax ptr addrspace(1) %gep, double %val syncscope("agent") seq_cst
3958 ; --------------------------------------------------------------------
3960 ; --------------------------------------------------------------------
3962 define half @global_agent_atomic_fmax_ret_f16(ptr addrspace(1) %ptr, half %val) #0 {
3963 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f16:
3965 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3966 ; GFX12-NEXT: s_wait_expcnt 0x0
3967 ; GFX12-NEXT: s_wait_samplecnt 0x0
3968 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3969 ; GFX12-NEXT: s_wait_kmcnt 0x0
3970 ; GFX12-NEXT: v_mov_b32_e32 v3, v0
3971 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v2
3972 ; GFX12-NEXT: s_mov_b32 s0, 0
3973 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
3974 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
3975 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
3976 ; GFX12-NEXT: global_load_b32 v5, v[0:1], off
3977 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
3978 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
3979 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3980 ; GFX12-NEXT: v_not_b32_e32 v4, v4
3981 ; GFX12-NEXT: .LBB22_1: ; %atomicrmw.start
3982 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3983 ; GFX12-NEXT: s_wait_loadcnt 0x0
3984 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
3985 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3986 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
3987 ; GFX12-NEXT: v_max_num_f16_e32 v5, v5, v5
3988 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3989 ; GFX12-NEXT: v_max_num_f16_e32 v5, v5, v2
3990 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff, v5
3991 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
3992 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
3993 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
3994 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
3995 ; GFX12-NEXT: s_wait_storecnt 0x0
3996 ; GFX12-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
3997 ; GFX12-NEXT: s_wait_loadcnt 0x0
3998 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
3999 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
4000 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
4001 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4002 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4003 ; GFX12-NEXT: s_cbranch_execnz .LBB22_1
4004 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
4005 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
4006 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4007 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4009 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f16:
4011 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4012 ; GFX940-NEXT: v_mov_b32_e32 v3, v0
4013 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v3
4014 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
4015 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v3
4016 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4017 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
4018 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
4019 ; GFX940-NEXT: v_not_b32_e32 v4, v4
4020 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
4021 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v2
4022 ; GFX940-NEXT: .LBB22_1: ; %atomicrmw.start
4023 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
4024 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4025 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
4026 ; GFX940-NEXT: v_lshrrev_b32_e32 v5, v3, v7
4027 ; GFX940-NEXT: v_max_f16_e32 v5, v5, v5
4028 ; GFX940-NEXT: v_max_f16_e32 v5, v5, v2
4029 ; GFX940-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4030 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
4031 ; GFX940-NEXT: buffer_wbl2 sc1
4032 ; GFX940-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off sc0
4033 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4034 ; GFX940-NEXT: buffer_inv sc1
4035 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
4036 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
4037 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
4038 ; GFX940-NEXT: s_cbranch_execnz .LBB22_1
4039 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
4040 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
4041 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4042 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4044 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f16:
4046 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4047 ; GFX11-NEXT: v_mov_b32_e32 v3, v0
4048 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v2
4049 ; GFX11-NEXT: s_mov_b32 s0, 0
4050 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
4051 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
4052 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
4053 ; GFX11-NEXT: global_load_b32 v5, v[0:1], off
4054 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4055 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
4056 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
4057 ; GFX11-NEXT: v_not_b32_e32 v4, v4
4058 ; GFX11-NEXT: .LBB22_1: ; %atomicrmw.start
4059 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
4060 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4061 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
4062 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4063 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4064 ; GFX11-NEXT: v_max_f16_e32 v5, v5, v5
4065 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4066 ; GFX11-NEXT: v_max_f16_e32 v5, v5, v2
4067 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff, v5
4068 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4069 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4070 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
4071 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4072 ; GFX11-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off glc
4073 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4074 ; GFX11-NEXT: buffer_gl1_inv
4075 ; GFX11-NEXT: buffer_gl0_inv
4076 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
4077 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
4078 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4079 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4080 ; GFX11-NEXT: s_cbranch_execnz .LBB22_1
4081 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
4082 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
4083 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4084 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4086 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f16:
4088 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4089 ; GFX10-NEXT: v_mov_b32_e32 v3, v0
4090 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
4091 ; GFX10-NEXT: s_mov_b32 s4, 0
4092 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
4093 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
4094 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
4095 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4096 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
4097 ; GFX10-NEXT: v_not_b32_e32 v4, v4
4098 ; GFX10-NEXT: .LBB22_1: ; %atomicrmw.start
4099 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4100 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4101 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
4102 ; GFX10-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4103 ; GFX10-NEXT: v_max_f16_e32 v5, v5, v5
4104 ; GFX10-NEXT: v_max_f16_e32 v5, v5, v2
4105 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
4106 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
4107 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4108 ; GFX10-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
4109 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4110 ; GFX10-NEXT: buffer_gl1_inv
4111 ; GFX10-NEXT: buffer_gl0_inv
4112 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
4113 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4114 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4115 ; GFX10-NEXT: s_cbranch_execnz .LBB22_1
4116 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4117 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4118 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4119 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4121 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f16:
4123 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4124 ; GFX90A-NEXT: v_mov_b32_e32 v3, v0
4125 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
4126 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
4127 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
4128 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4129 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
4130 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
4131 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
4132 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
4133 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v2
4134 ; GFX90A-NEXT: .LBB22_1: ; %atomicrmw.start
4135 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
4136 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4137 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
4138 ; GFX90A-NEXT: v_lshrrev_b32_e32 v5, v3, v7
4139 ; GFX90A-NEXT: v_max_f16_e32 v5, v5, v5
4140 ; GFX90A-NEXT: v_max_f16_e32 v5, v5, v2
4141 ; GFX90A-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4142 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
4143 ; GFX90A-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off glc
4144 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4145 ; GFX90A-NEXT: buffer_wbinvl1
4146 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
4147 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4148 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
4149 ; GFX90A-NEXT: s_cbranch_execnz .LBB22_1
4150 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
4151 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4152 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4153 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4155 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f16:
4157 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4158 ; GFX908-NEXT: v_mov_b32_e32 v3, v0
4159 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
4160 ; GFX908-NEXT: global_load_dword v5, v[0:1], off
4161 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
4162 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4163 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
4164 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
4165 ; GFX908-NEXT: v_not_b32_e32 v4, v4
4166 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4167 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v2
4168 ; GFX908-NEXT: .LBB22_1: ; %atomicrmw.start
4169 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4170 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4171 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
4172 ; GFX908-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4173 ; GFX908-NEXT: v_max_f16_e32 v5, v5, v5
4174 ; GFX908-NEXT: v_max_f16_e32 v5, v5, v2
4175 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4176 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
4177 ; GFX908-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
4178 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4179 ; GFX908-NEXT: buffer_wbinvl1
4180 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
4181 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4182 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4183 ; GFX908-NEXT: s_cbranch_execnz .LBB22_1
4184 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4185 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4186 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4187 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4189 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f16:
4191 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4192 ; GFX8-NEXT: v_mov_b32_e32 v3, v0
4193 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
4194 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
4195 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
4196 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4197 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
4198 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
4199 ; GFX8-NEXT: v_not_b32_e32 v4, v4
4200 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4201 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
4202 ; GFX8-NEXT: .LBB22_1: ; %atomicrmw.start
4203 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4204 ; GFX8-NEXT: s_waitcnt vmcnt(0)
4205 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
4206 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4207 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v5
4208 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v2
4209 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
4210 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4211 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
4212 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
4213 ; GFX8-NEXT: s_waitcnt vmcnt(0)
4214 ; GFX8-NEXT: buffer_wbinvl1
4215 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
4216 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4217 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4218 ; GFX8-NEXT: s_cbranch_execnz .LBB22_1
4219 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4220 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4221 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4222 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4224 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f16:
4226 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4227 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
4228 ; GFX7-NEXT: s_mov_b32 s6, 0
4229 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
4230 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
4231 ; GFX7-NEXT: s_mov_b32 s4, s6
4232 ; GFX7-NEXT: s_mov_b32 s5, s6
4233 ; GFX7-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
4234 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
4235 ; GFX7-NEXT: v_and_b32_e32 v3, 3, v3
4236 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 3, v3
4237 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
4238 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v2
4239 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v5
4240 ; GFX7-NEXT: v_not_b32_e32 v7, v2
4241 ; GFX7-NEXT: .LBB22_1: ; %atomicrmw.start
4242 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4243 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4244 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v5, v4
4245 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
4246 ; GFX7-NEXT: v_and_b32_e32 v3, v4, v7
4247 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v6
4248 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
4249 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v5, v2
4250 ; GFX7-NEXT: v_or_b32_e32 v3, v3, v2
4251 ; GFX7-NEXT: v_mov_b32_e32 v2, v3
4252 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
4253 ; GFX7-NEXT: buffer_atomic_cmpswap v[2:3], v[0:1], s[4:7], 0 addr64 glc
4254 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4255 ; GFX7-NEXT: buffer_wbinvl1
4256 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
4257 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
4258 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
4259 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
4260 ; GFX7-NEXT: s_cbranch_execnz .LBB22_1
4261 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4262 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
4263 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v5, v2
4264 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
4265 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4267 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f16:
4269 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4270 ; GFX6-NEXT: v_mov_b32_e32 v3, v0
4271 ; GFX6-NEXT: s_mov_b32 s6, 0
4272 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v3
4273 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
4274 ; GFX6-NEXT: s_mov_b32 s4, s6
4275 ; GFX6-NEXT: s_mov_b32 s5, s6
4276 ; GFX6-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
4277 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
4278 ; GFX6-NEXT: v_and_b32_e32 v3, 3, v3
4279 ; GFX6-NEXT: v_lshlrev_b32_e32 v5, 3, v3
4280 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
4281 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v2
4282 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v5
4283 ; GFX6-NEXT: v_not_b32_e32 v7, v2
4284 ; GFX6-NEXT: .LBB22_1: ; %atomicrmw.start
4285 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
4286 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0)
4287 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v5, v4
4288 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v2
4289 ; GFX6-NEXT: v_and_b32_e32 v3, v4, v7
4290 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v6
4291 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
4292 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v5, v2
4293 ; GFX6-NEXT: v_or_b32_e32 v3, v3, v2
4294 ; GFX6-NEXT: v_mov_b32_e32 v2, v3
4295 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
4296 ; GFX6-NEXT: buffer_atomic_cmpswap v[2:3], v[0:1], s[4:7], 0 addr64 glc
4297 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4298 ; GFX6-NEXT: buffer_wbinvl1
4299 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
4300 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
4301 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
4302 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
4303 ; GFX6-NEXT: s_cbranch_execnz .LBB22_1
4304 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
4305 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
4306 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v5, v2
4307 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v0
4308 ; GFX6-NEXT: s_waitcnt expcnt(0)
4309 ; GFX6-NEXT: s_setpc_b64 s[30:31]
4310 %result = atomicrmw fmax ptr addrspace(1) %ptr, half %val syncscope("agent") seq_cst
4314 define half @global_agent_atomic_fmax_ret_f16__offset12b_pos(ptr addrspace(1) %ptr, half %val) #0 {
4315 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos:
4317 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4318 ; GFX12-NEXT: s_wait_expcnt 0x0
4319 ; GFX12-NEXT: s_wait_samplecnt 0x0
4320 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4321 ; GFX12-NEXT: s_wait_kmcnt 0x0
4322 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
4323 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
4324 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v2
4325 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
4326 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
4327 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
4328 ; GFX12-NEXT: s_mov_b32 s0, 0
4329 ; GFX12-NEXT: global_load_b32 v5, v[0:1], off
4330 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4331 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
4332 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
4333 ; GFX12-NEXT: v_not_b32_e32 v4, v4
4334 ; GFX12-NEXT: .LBB23_1: ; %atomicrmw.start
4335 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
4336 ; GFX12-NEXT: s_wait_loadcnt 0x0
4337 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
4338 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4339 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4340 ; GFX12-NEXT: v_max_num_f16_e32 v5, v5, v5
4341 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4342 ; GFX12-NEXT: v_max_num_f16_e32 v5, v5, v2
4343 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff, v5
4344 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4345 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4346 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
4347 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
4348 ; GFX12-NEXT: s_wait_storecnt 0x0
4349 ; GFX12-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
4350 ; GFX12-NEXT: s_wait_loadcnt 0x0
4351 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
4352 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
4353 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
4354 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4355 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4356 ; GFX12-NEXT: s_cbranch_execnz .LBB23_1
4357 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
4358 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
4359 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4360 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4362 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos:
4364 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4365 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
4366 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
4367 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
4368 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
4369 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
4370 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
4371 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4372 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
4373 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
4374 ; GFX940-NEXT: v_not_b32_e32 v4, v4
4375 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
4376 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v2
4377 ; GFX940-NEXT: .LBB23_1: ; %atomicrmw.start
4378 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
4379 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4380 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
4381 ; GFX940-NEXT: v_lshrrev_b32_e32 v5, v3, v7
4382 ; GFX940-NEXT: v_max_f16_e32 v5, v5, v5
4383 ; GFX940-NEXT: v_max_f16_e32 v5, v5, v2
4384 ; GFX940-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4385 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
4386 ; GFX940-NEXT: buffer_wbl2 sc1
4387 ; GFX940-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off sc0
4388 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4389 ; GFX940-NEXT: buffer_inv sc1
4390 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
4391 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
4392 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
4393 ; GFX940-NEXT: s_cbranch_execnz .LBB23_1
4394 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
4395 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
4396 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4397 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4399 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos:
4401 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4402 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
4403 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
4404 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v2
4405 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
4406 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
4407 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
4408 ; GFX11-NEXT: s_mov_b32 s0, 0
4409 ; GFX11-NEXT: global_load_b32 v5, v[0:1], off
4410 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4411 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
4412 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
4413 ; GFX11-NEXT: v_not_b32_e32 v4, v4
4414 ; GFX11-NEXT: .LBB23_1: ; %atomicrmw.start
4415 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
4416 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4417 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
4418 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4419 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4420 ; GFX11-NEXT: v_max_f16_e32 v5, v5, v5
4421 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4422 ; GFX11-NEXT: v_max_f16_e32 v5, v5, v2
4423 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff, v5
4424 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4425 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4426 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
4427 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4428 ; GFX11-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off glc
4429 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4430 ; GFX11-NEXT: buffer_gl1_inv
4431 ; GFX11-NEXT: buffer_gl0_inv
4432 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
4433 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
4434 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4435 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4436 ; GFX11-NEXT: s_cbranch_execnz .LBB23_1
4437 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
4438 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
4439 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4440 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4442 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos:
4444 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4445 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
4446 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
4447 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
4448 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
4449 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
4450 ; GFX10-NEXT: s_mov_b32 s4, 0
4451 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
4452 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4453 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
4454 ; GFX10-NEXT: v_not_b32_e32 v4, v4
4455 ; GFX10-NEXT: .LBB23_1: ; %atomicrmw.start
4456 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4457 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4458 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
4459 ; GFX10-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4460 ; GFX10-NEXT: v_max_f16_e32 v5, v5, v5
4461 ; GFX10-NEXT: v_max_f16_e32 v5, v5, v2
4462 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
4463 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
4464 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4465 ; GFX10-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
4466 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4467 ; GFX10-NEXT: buffer_gl1_inv
4468 ; GFX10-NEXT: buffer_gl0_inv
4469 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
4470 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4471 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4472 ; GFX10-NEXT: s_cbranch_execnz .LBB23_1
4473 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4474 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4475 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4476 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4478 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos:
4480 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4481 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
4482 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
4483 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
4484 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
4485 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
4486 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4487 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
4488 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
4489 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
4490 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
4491 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v2
4492 ; GFX90A-NEXT: .LBB23_1: ; %atomicrmw.start
4493 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
4494 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4495 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
4496 ; GFX90A-NEXT: v_lshrrev_b32_e32 v5, v3, v7
4497 ; GFX90A-NEXT: v_max_f16_e32 v5, v5, v5
4498 ; GFX90A-NEXT: v_max_f16_e32 v5, v5, v2
4499 ; GFX90A-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4500 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
4501 ; GFX90A-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off glc
4502 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4503 ; GFX90A-NEXT: buffer_wbinvl1
4504 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
4505 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4506 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
4507 ; GFX90A-NEXT: s_cbranch_execnz .LBB23_1
4508 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
4509 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4510 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4511 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4513 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos:
4515 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4516 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
4517 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
4518 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
4519 ; GFX908-NEXT: global_load_dword v5, v[0:1], off
4520 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
4521 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4522 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
4523 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
4524 ; GFX908-NEXT: v_not_b32_e32 v4, v4
4525 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4526 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v2
4527 ; GFX908-NEXT: .LBB23_1: ; %atomicrmw.start
4528 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4529 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4530 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
4531 ; GFX908-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4532 ; GFX908-NEXT: v_max_f16_e32 v5, v5, v5
4533 ; GFX908-NEXT: v_max_f16_e32 v5, v5, v2
4534 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4535 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
4536 ; GFX908-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
4537 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4538 ; GFX908-NEXT: buffer_wbinvl1
4539 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
4540 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4541 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4542 ; GFX908-NEXT: s_cbranch_execnz .LBB23_1
4543 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4544 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4545 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4546 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4548 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos:
4550 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4551 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
4552 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
4553 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
4554 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
4555 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
4556 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4557 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
4558 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
4559 ; GFX8-NEXT: v_not_b32_e32 v4, v4
4560 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4561 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
4562 ; GFX8-NEXT: .LBB23_1: ; %atomicrmw.start
4563 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4564 ; GFX8-NEXT: s_waitcnt vmcnt(0)
4565 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
4566 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4567 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v5
4568 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v2
4569 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
4570 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4571 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
4572 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
4573 ; GFX8-NEXT: s_waitcnt vmcnt(0)
4574 ; GFX8-NEXT: buffer_wbinvl1
4575 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
4576 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4577 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4578 ; GFX8-NEXT: s_cbranch_execnz .LBB23_1
4579 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4580 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4581 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4582 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4584 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos:
4586 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4587 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
4588 ; GFX7-NEXT: s_mov_b32 s6, 0
4589 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
4590 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
4591 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
4592 ; GFX7-NEXT: s_mov_b32 s4, s6
4593 ; GFX7-NEXT: s_mov_b32 s5, s6
4594 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
4595 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
4596 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
4597 ; GFX7-NEXT: v_lshlrev_b32_e32 v6, 3, v4
4598 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
4599 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v2
4600 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v6
4601 ; GFX7-NEXT: v_not_b32_e32 v8, v2
4602 ; GFX7-NEXT: .LBB23_1: ; %atomicrmw.start
4603 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4604 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4605 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v6, v3
4606 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
4607 ; GFX7-NEXT: v_and_b32_e32 v4, v3, v8
4608 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v7
4609 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
4610 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v6, v2
4611 ; GFX7-NEXT: v_or_b32_e32 v2, v4, v2
4612 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
4613 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
4614 ; GFX7-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
4615 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4616 ; GFX7-NEXT: buffer_wbinvl1
4617 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
4618 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
4619 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
4620 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
4621 ; GFX7-NEXT: s_cbranch_execnz .LBB23_1
4622 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4623 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
4624 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v6, v4
4625 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
4626 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4628 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos:
4630 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4631 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
4632 ; GFX6-NEXT: s_mov_b32 s6, 0
4633 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
4634 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
4635 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
4636 ; GFX6-NEXT: s_mov_b32 s4, s6
4637 ; GFX6-NEXT: s_mov_b32 s5, s6
4638 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
4639 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
4640 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
4641 ; GFX6-NEXT: v_lshlrev_b32_e32 v6, 3, v4
4642 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
4643 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v2
4644 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v6
4645 ; GFX6-NEXT: v_not_b32_e32 v8, v2
4646 ; GFX6-NEXT: .LBB23_1: ; %atomicrmw.start
4647 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
4648 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4649 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v6, v3
4650 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v2
4651 ; GFX6-NEXT: s_waitcnt expcnt(0)
4652 ; GFX6-NEXT: v_and_b32_e32 v4, v3, v8
4653 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v7
4654 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
4655 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v6, v2
4656 ; GFX6-NEXT: v_or_b32_e32 v2, v4, v2
4657 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
4658 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
4659 ; GFX6-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
4660 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4661 ; GFX6-NEXT: buffer_wbinvl1
4662 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
4663 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
4664 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
4665 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
4666 ; GFX6-NEXT: s_cbranch_execnz .LBB23_1
4667 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
4668 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
4669 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v6, v4
4670 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v0
4671 ; GFX6-NEXT: s_waitcnt expcnt(0)
4672 ; GFX6-NEXT: s_setpc_b64 s[30:31]
4673 %gep = getelementptr half, ptr addrspace(1) %ptr, i64 1023
4674 %result = atomicrmw fmax ptr addrspace(1) %gep, half %val syncscope("agent") seq_cst
4678 define half @global_agent_atomic_fmax_ret_f16__offset12b_neg(ptr addrspace(1) %ptr, half %val) #0 {
4679 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_neg:
4681 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4682 ; GFX12-NEXT: s_wait_expcnt 0x0
4683 ; GFX12-NEXT: s_wait_samplecnt 0x0
4684 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4685 ; GFX12-NEXT: s_wait_kmcnt 0x0
4686 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
4687 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
4688 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v2
4689 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
4690 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
4691 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
4692 ; GFX12-NEXT: s_mov_b32 s0, 0
4693 ; GFX12-NEXT: global_load_b32 v5, v[0:1], off
4694 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4695 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
4696 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
4697 ; GFX12-NEXT: v_not_b32_e32 v4, v4
4698 ; GFX12-NEXT: .LBB24_1: ; %atomicrmw.start
4699 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
4700 ; GFX12-NEXT: s_wait_loadcnt 0x0
4701 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
4702 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4703 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4704 ; GFX12-NEXT: v_max_num_f16_e32 v5, v5, v5
4705 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4706 ; GFX12-NEXT: v_max_num_f16_e32 v5, v5, v2
4707 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff, v5
4708 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4709 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4710 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
4711 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
4712 ; GFX12-NEXT: s_wait_storecnt 0x0
4713 ; GFX12-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
4714 ; GFX12-NEXT: s_wait_loadcnt 0x0
4715 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
4716 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
4717 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
4718 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4719 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4720 ; GFX12-NEXT: s_cbranch_execnz .LBB24_1
4721 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
4722 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
4723 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4724 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4726 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_neg:
4728 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4729 ; GFX940-NEXT: s_movk_i32 s0, 0xf800
4730 ; GFX940-NEXT: s_mov_b32 s1, -1
4731 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
4732 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
4733 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
4734 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
4735 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
4736 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4737 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
4738 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
4739 ; GFX940-NEXT: v_not_b32_e32 v4, v4
4740 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
4741 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v2
4742 ; GFX940-NEXT: .LBB24_1: ; %atomicrmw.start
4743 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
4744 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4745 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
4746 ; GFX940-NEXT: v_lshrrev_b32_e32 v5, v3, v7
4747 ; GFX940-NEXT: v_max_f16_e32 v5, v5, v5
4748 ; GFX940-NEXT: v_max_f16_e32 v5, v5, v2
4749 ; GFX940-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4750 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
4751 ; GFX940-NEXT: buffer_wbl2 sc1
4752 ; GFX940-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off sc0
4753 ; GFX940-NEXT: s_waitcnt vmcnt(0)
4754 ; GFX940-NEXT: buffer_inv sc1
4755 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
4756 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
4757 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
4758 ; GFX940-NEXT: s_cbranch_execnz .LBB24_1
4759 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
4760 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
4761 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4762 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4764 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_neg:
4766 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4767 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
4768 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
4769 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v2
4770 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
4771 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
4772 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
4773 ; GFX11-NEXT: s_mov_b32 s0, 0
4774 ; GFX11-NEXT: global_load_b32 v5, v[0:1], off
4775 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4776 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
4777 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
4778 ; GFX11-NEXT: v_not_b32_e32 v4, v4
4779 ; GFX11-NEXT: .LBB24_1: ; %atomicrmw.start
4780 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
4781 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4782 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
4783 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4784 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4785 ; GFX11-NEXT: v_max_f16_e32 v5, v5, v5
4786 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4787 ; GFX11-NEXT: v_max_f16_e32 v5, v5, v2
4788 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff, v5
4789 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
4790 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4791 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
4792 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4793 ; GFX11-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off glc
4794 ; GFX11-NEXT: s_waitcnt vmcnt(0)
4795 ; GFX11-NEXT: buffer_gl1_inv
4796 ; GFX11-NEXT: buffer_gl0_inv
4797 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
4798 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
4799 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4800 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4801 ; GFX11-NEXT: s_cbranch_execnz .LBB24_1
4802 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
4803 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
4804 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4805 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4807 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_neg:
4809 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4810 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
4811 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
4812 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
4813 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
4814 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
4815 ; GFX10-NEXT: s_mov_b32 s4, 0
4816 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
4817 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4818 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
4819 ; GFX10-NEXT: v_not_b32_e32 v4, v4
4820 ; GFX10-NEXT: .LBB24_1: ; %atomicrmw.start
4821 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4822 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4823 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
4824 ; GFX10-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4825 ; GFX10-NEXT: v_max_f16_e32 v5, v5, v5
4826 ; GFX10-NEXT: v_max_f16_e32 v5, v5, v2
4827 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
4828 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
4829 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4830 ; GFX10-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
4831 ; GFX10-NEXT: s_waitcnt vmcnt(0)
4832 ; GFX10-NEXT: buffer_gl1_inv
4833 ; GFX10-NEXT: buffer_gl0_inv
4834 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
4835 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4836 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4837 ; GFX10-NEXT: s_cbranch_execnz .LBB24_1
4838 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4839 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4840 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4841 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4843 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_neg:
4845 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4846 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
4847 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
4848 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
4849 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
4850 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
4851 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4852 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
4853 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
4854 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
4855 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
4856 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v2
4857 ; GFX90A-NEXT: .LBB24_1: ; %atomicrmw.start
4858 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
4859 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4860 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
4861 ; GFX90A-NEXT: v_lshrrev_b32_e32 v5, v3, v7
4862 ; GFX90A-NEXT: v_max_f16_e32 v5, v5, v5
4863 ; GFX90A-NEXT: v_max_f16_e32 v5, v5, v2
4864 ; GFX90A-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4865 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
4866 ; GFX90A-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off glc
4867 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4868 ; GFX90A-NEXT: buffer_wbinvl1
4869 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
4870 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4871 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
4872 ; GFX90A-NEXT: s_cbranch_execnz .LBB24_1
4873 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
4874 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4875 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4876 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4878 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_neg:
4880 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4881 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
4882 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
4883 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
4884 ; GFX908-NEXT: global_load_dword v5, v[0:1], off
4885 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
4886 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4887 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
4888 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
4889 ; GFX908-NEXT: v_not_b32_e32 v4, v4
4890 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4891 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v2
4892 ; GFX908-NEXT: .LBB24_1: ; %atomicrmw.start
4893 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4894 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4895 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
4896 ; GFX908-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4897 ; GFX908-NEXT: v_max_f16_e32 v5, v5, v5
4898 ; GFX908-NEXT: v_max_f16_e32 v5, v5, v2
4899 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4900 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
4901 ; GFX908-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
4902 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4903 ; GFX908-NEXT: buffer_wbinvl1
4904 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
4905 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4906 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4907 ; GFX908-NEXT: s_cbranch_execnz .LBB24_1
4908 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4909 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4910 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4911 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4913 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_neg:
4915 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4916 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
4917 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
4918 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
4919 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
4920 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
4921 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
4922 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
4923 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
4924 ; GFX8-NEXT: v_not_b32_e32 v4, v4
4925 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4926 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
4927 ; GFX8-NEXT: .LBB24_1: ; %atomicrmw.start
4928 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4929 ; GFX8-NEXT: s_waitcnt vmcnt(0)
4930 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
4931 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, v3, v6
4932 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v5
4933 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v2
4934 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
4935 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, v3, v5
4936 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
4937 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
4938 ; GFX8-NEXT: s_waitcnt vmcnt(0)
4939 ; GFX8-NEXT: buffer_wbinvl1
4940 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
4941 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4942 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4943 ; GFX8-NEXT: s_cbranch_execnz .LBB24_1
4944 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4945 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4946 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
4947 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4949 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_neg:
4951 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4952 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
4953 ; GFX7-NEXT: s_mov_b32 s6, 0
4954 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
4955 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
4956 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
4957 ; GFX7-NEXT: s_mov_b32 s4, s6
4958 ; GFX7-NEXT: s_mov_b32 s5, s6
4959 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
4960 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
4961 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
4962 ; GFX7-NEXT: v_lshlrev_b32_e32 v6, 3, v4
4963 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
4964 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v2
4965 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v6
4966 ; GFX7-NEXT: v_not_b32_e32 v8, v2
4967 ; GFX7-NEXT: .LBB24_1: ; %atomicrmw.start
4968 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4969 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4970 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v6, v3
4971 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
4972 ; GFX7-NEXT: v_and_b32_e32 v4, v3, v8
4973 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v7
4974 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
4975 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v6, v2
4976 ; GFX7-NEXT: v_or_b32_e32 v2, v4, v2
4977 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
4978 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
4979 ; GFX7-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
4980 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4981 ; GFX7-NEXT: buffer_wbinvl1
4982 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
4983 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
4984 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
4985 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
4986 ; GFX7-NEXT: s_cbranch_execnz .LBB24_1
4987 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4988 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
4989 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v6, v4
4990 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
4991 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4993 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_neg:
4995 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4996 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
4997 ; GFX6-NEXT: s_mov_b32 s6, 0
4998 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
4999 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
5000 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
5001 ; GFX6-NEXT: s_mov_b32 s4, s6
5002 ; GFX6-NEXT: s_mov_b32 s5, s6
5003 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
5004 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
5005 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
5006 ; GFX6-NEXT: v_lshlrev_b32_e32 v6, 3, v4
5007 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
5008 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v2
5009 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v6
5010 ; GFX6-NEXT: v_not_b32_e32 v8, v2
5011 ; GFX6-NEXT: .LBB24_1: ; %atomicrmw.start
5012 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
5013 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5014 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v6, v3
5015 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v2
5016 ; GFX6-NEXT: s_waitcnt expcnt(0)
5017 ; GFX6-NEXT: v_and_b32_e32 v4, v3, v8
5018 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v7
5019 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
5020 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v6, v2
5021 ; GFX6-NEXT: v_or_b32_e32 v2, v4, v2
5022 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
5023 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
5024 ; GFX6-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
5025 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5026 ; GFX6-NEXT: buffer_wbinvl1
5027 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
5028 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
5029 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
5030 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
5031 ; GFX6-NEXT: s_cbranch_execnz .LBB24_1
5032 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
5033 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
5034 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v6, v4
5035 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v0
5036 ; GFX6-NEXT: s_waitcnt expcnt(0)
5037 ; GFX6-NEXT: s_setpc_b64 s[30:31]
5038 %gep = getelementptr half, ptr addrspace(1) %ptr, i64 -1024
5039 %result = atomicrmw fmax ptr addrspace(1) %gep, half %val syncscope("agent") seq_cst
5043 define void @global_agent_atomic_fmax_noret_f16(ptr addrspace(1) %ptr, half %val) #0 {
5044 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f16:
5046 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5047 ; GFX12-NEXT: s_wait_expcnt 0x0
5048 ; GFX12-NEXT: s_wait_samplecnt 0x0
5049 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5050 ; GFX12-NEXT: s_wait_kmcnt 0x0
5051 ; GFX12-NEXT: v_mov_b32_e32 v3, v0
5052 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v2
5053 ; GFX12-NEXT: s_mov_b32 s0, 0
5054 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
5055 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
5056 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
5057 ; GFX12-NEXT: global_load_b32 v4, v[0:1], off
5058 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 3, v3
5059 ; GFX12-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
5060 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
5061 ; GFX12-NEXT: v_not_b32_e32 v6, v3
5062 ; GFX12-NEXT: .LBB25_1: ; %atomicrmw.start
5063 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
5064 ; GFX12-NEXT: s_wait_loadcnt 0x0
5065 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v5, v4
5066 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5067 ; GFX12-NEXT: v_max_num_f16_e32 v3, v3, v3
5068 ; GFX12-NEXT: v_max_num_f16_e32 v3, v3, v2
5069 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5070 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
5071 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v5, v3
5072 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
5073 ; GFX12-NEXT: v_and_or_b32 v3, v4, v6, v3
5074 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
5075 ; GFX12-NEXT: s_wait_storecnt 0x0
5076 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
5077 ; GFX12-NEXT: s_wait_loadcnt 0x0
5078 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
5079 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
5080 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
5081 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
5082 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5083 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5084 ; GFX12-NEXT: s_cbranch_execnz .LBB25_1
5085 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
5086 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
5087 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5089 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f16:
5091 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5092 ; GFX940-NEXT: v_mov_b32_e32 v3, v0
5093 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v3
5094 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
5095 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v3
5096 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
5097 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
5098 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
5099 ; GFX940-NEXT: v_not_b32_e32 v6, v4
5100 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
5101 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v2
5102 ; GFX940-NEXT: .LBB25_1: ; %atomicrmw.start
5103 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
5104 ; GFX940-NEXT: s_waitcnt vmcnt(0)
5105 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v3, v5
5106 ; GFX940-NEXT: v_max_f16_e32 v4, v4, v4
5107 ; GFX940-NEXT: v_max_f16_e32 v4, v4, v2
5108 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v3, v4
5109 ; GFX940-NEXT: v_and_or_b32 v4, v5, v6, v4
5110 ; GFX940-NEXT: buffer_wbl2 sc1
5111 ; GFX940-NEXT: global_atomic_cmpswap v4, v[0:1], v[4:5], off sc0
5112 ; GFX940-NEXT: s_waitcnt vmcnt(0)
5113 ; GFX940-NEXT: buffer_inv sc1
5114 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
5115 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
5116 ; GFX940-NEXT: v_mov_b32_e32 v5, v4
5117 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
5118 ; GFX940-NEXT: s_cbranch_execnz .LBB25_1
5119 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
5120 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
5121 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5123 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f16:
5125 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5126 ; GFX11-NEXT: v_mov_b32_e32 v3, v0
5127 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v2
5128 ; GFX11-NEXT: s_mov_b32 s0, 0
5129 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
5130 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
5131 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
5132 ; GFX11-NEXT: global_load_b32 v4, v[0:1], off
5133 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 3, v3
5134 ; GFX11-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
5135 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
5136 ; GFX11-NEXT: v_not_b32_e32 v6, v3
5137 ; GFX11-NEXT: .LBB25_1: ; %atomicrmw.start
5138 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
5139 ; GFX11-NEXT: s_waitcnt vmcnt(0)
5140 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v5, v4
5141 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5142 ; GFX11-NEXT: v_max_f16_e32 v3, v3, v3
5143 ; GFX11-NEXT: v_max_f16_e32 v3, v3, v2
5144 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5145 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
5146 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v5, v3
5147 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
5148 ; GFX11-NEXT: v_and_or_b32 v3, v4, v6, v3
5149 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5150 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off glc
5151 ; GFX11-NEXT: s_waitcnt vmcnt(0)
5152 ; GFX11-NEXT: buffer_gl1_inv
5153 ; GFX11-NEXT: buffer_gl0_inv
5154 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
5155 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
5156 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
5157 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5158 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5159 ; GFX11-NEXT: s_cbranch_execnz .LBB25_1
5160 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
5161 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
5162 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5164 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f16:
5166 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5167 ; GFX10-NEXT: v_mov_b32_e32 v3, v0
5168 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
5169 ; GFX10-NEXT: s_mov_b32 s4, 0
5170 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
5171 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
5172 ; GFX10-NEXT: global_load_dword v4, v[0:1], off
5173 ; GFX10-NEXT: v_lshlrev_b32_e32 v5, 3, v3
5174 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
5175 ; GFX10-NEXT: v_not_b32_e32 v6, v3
5176 ; GFX10-NEXT: .LBB25_1: ; %atomicrmw.start
5177 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5178 ; GFX10-NEXT: s_waitcnt vmcnt(0)
5179 ; GFX10-NEXT: v_lshrrev_b32_e32 v3, v5, v4
5180 ; GFX10-NEXT: v_max_f16_e32 v3, v3, v3
5181 ; GFX10-NEXT: v_max_f16_e32 v3, v3, v2
5182 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
5183 ; GFX10-NEXT: v_and_or_b32 v3, v4, v6, v3
5184 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5185 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off glc
5186 ; GFX10-NEXT: s_waitcnt vmcnt(0)
5187 ; GFX10-NEXT: buffer_gl1_inv
5188 ; GFX10-NEXT: buffer_gl0_inv
5189 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
5190 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
5191 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5192 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5193 ; GFX10-NEXT: s_cbranch_execnz .LBB25_1
5194 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5195 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5196 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5198 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f16:
5200 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5201 ; GFX90A-NEXT: v_mov_b32_e32 v3, v0
5202 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
5203 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
5204 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
5205 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
5206 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
5207 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
5208 ; GFX90A-NEXT: v_not_b32_e32 v6, v4
5209 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
5210 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v2
5211 ; GFX90A-NEXT: .LBB25_1: ; %atomicrmw.start
5212 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
5213 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5214 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v3, v5
5215 ; GFX90A-NEXT: v_max_f16_e32 v4, v4, v4
5216 ; GFX90A-NEXT: v_max_f16_e32 v4, v4, v2
5217 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v3, v4
5218 ; GFX90A-NEXT: v_and_or_b32 v4, v5, v6, v4
5219 ; GFX90A-NEXT: global_atomic_cmpswap v4, v[0:1], v[4:5], off glc
5220 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5221 ; GFX90A-NEXT: buffer_wbinvl1
5222 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
5223 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5224 ; GFX90A-NEXT: v_mov_b32_e32 v5, v4
5225 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
5226 ; GFX90A-NEXT: s_cbranch_execnz .LBB25_1
5227 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
5228 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5229 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5231 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f16:
5233 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5234 ; GFX908-NEXT: v_mov_b32_e32 v3, v0
5235 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
5236 ; GFX908-NEXT: global_load_dword v4, v[0:1], off
5237 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
5238 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, 3, v3
5239 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
5240 ; GFX908-NEXT: v_lshlrev_b32_e64 v3, v5, s4
5241 ; GFX908-NEXT: v_not_b32_e32 v6, v3
5242 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
5243 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v2
5244 ; GFX908-NEXT: .LBB25_1: ; %atomicrmw.start
5245 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
5246 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5247 ; GFX908-NEXT: v_lshrrev_b32_e32 v3, v5, v4
5248 ; GFX908-NEXT: v_max_f16_e32 v3, v3, v3
5249 ; GFX908-NEXT: v_max_f16_e32 v3, v3, v2
5250 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, v5, v3
5251 ; GFX908-NEXT: v_and_or_b32 v3, v4, v6, v3
5252 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off glc
5253 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5254 ; GFX908-NEXT: buffer_wbinvl1
5255 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5256 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5257 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
5258 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
5259 ; GFX908-NEXT: s_cbranch_execnz .LBB25_1
5260 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
5261 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5262 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5264 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f16:
5266 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5267 ; GFX8-NEXT: v_mov_b32_e32 v3, v0
5268 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
5269 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
5270 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
5271 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, 3, v3
5272 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
5273 ; GFX8-NEXT: v_lshlrev_b32_e64 v3, v5, s4
5274 ; GFX8-NEXT: v_not_b32_e32 v6, v3
5275 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5276 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
5277 ; GFX8-NEXT: .LBB25_1: ; %atomicrmw.start
5278 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5279 ; GFX8-NEXT: s_waitcnt vmcnt(0)
5280 ; GFX8-NEXT: v_lshrrev_b32_e32 v3, v5, v4
5281 ; GFX8-NEXT: v_max_f16_e32 v3, v3, v3
5282 ; GFX8-NEXT: v_max_f16_e32 v3, v3, v2
5283 ; GFX8-NEXT: v_and_b32_e32 v7, v4, v6
5284 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, v5, v3
5285 ; GFX8-NEXT: v_or_b32_e32 v3, v7, v3
5286 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5287 ; GFX8-NEXT: s_waitcnt vmcnt(0)
5288 ; GFX8-NEXT: buffer_wbinvl1
5289 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5290 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5291 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
5292 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5293 ; GFX8-NEXT: s_cbranch_execnz .LBB25_1
5294 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5295 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
5296 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5298 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f16:
5300 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5301 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
5302 ; GFX7-NEXT: s_mov_b32 s6, 0
5303 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
5304 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
5305 ; GFX7-NEXT: s_mov_b32 s4, s6
5306 ; GFX7-NEXT: s_mov_b32 s5, s6
5307 ; GFX7-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
5308 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v2
5309 ; GFX7-NEXT: v_and_b32_e32 v2, 3, v3
5310 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v2
5311 ; GFX7-NEXT: v_lshl_b32_e32 v3, 0xffff, v2
5312 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
5313 ; GFX7-NEXT: v_not_b32_e32 v6, v3
5314 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
5315 ; GFX7-NEXT: .LBB25_1: ; %atomicrmw.start
5316 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5317 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5318 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, v2, v4
5319 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
5320 ; GFX7-NEXT: v_and_b32_e32 v7, v4, v6
5321 ; GFX7-NEXT: v_max_f32_e32 v3, v3, v5
5322 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
5323 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, v2, v3
5324 ; GFX7-NEXT: v_or_b32_e32 v3, v7, v3
5325 ; GFX7-NEXT: v_mov_b32_e32 v8, v4
5326 ; GFX7-NEXT: v_mov_b32_e32 v7, v3
5327 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
5328 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5329 ; GFX7-NEXT: buffer_wbinvl1
5330 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v4
5331 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
5332 ; GFX7-NEXT: v_mov_b32_e32 v4, v7
5333 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
5334 ; GFX7-NEXT: s_cbranch_execnz .LBB25_1
5335 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5336 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
5337 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5339 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f16:
5341 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5342 ; GFX6-NEXT: v_mov_b32_e32 v3, v0
5343 ; GFX6-NEXT: s_mov_b32 s6, 0
5344 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v3
5345 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
5346 ; GFX6-NEXT: s_mov_b32 s4, s6
5347 ; GFX6-NEXT: s_mov_b32 s5, s6
5348 ; GFX6-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
5349 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v2
5350 ; GFX6-NEXT: v_and_b32_e32 v2, 3, v3
5351 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 3, v2
5352 ; GFX6-NEXT: v_lshl_b32_e32 v3, 0xffff, v2
5353 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v5
5354 ; GFX6-NEXT: v_not_b32_e32 v6, v3
5355 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
5356 ; GFX6-NEXT: .LBB25_1: ; %atomicrmw.start
5357 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
5358 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5359 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, v2, v4
5360 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
5361 ; GFX6-NEXT: s_waitcnt expcnt(0)
5362 ; GFX6-NEXT: v_and_b32_e32 v7, v4, v6
5363 ; GFX6-NEXT: v_max_f32_e32 v3, v3, v5
5364 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
5365 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, v2, v3
5366 ; GFX6-NEXT: v_or_b32_e32 v3, v7, v3
5367 ; GFX6-NEXT: v_mov_b32_e32 v8, v4
5368 ; GFX6-NEXT: v_mov_b32_e32 v7, v3
5369 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
5370 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5371 ; GFX6-NEXT: buffer_wbinvl1
5372 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v4
5373 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
5374 ; GFX6-NEXT: v_mov_b32_e32 v4, v7
5375 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
5376 ; GFX6-NEXT: s_cbranch_execnz .LBB25_1
5377 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
5378 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
5379 ; GFX6-NEXT: s_waitcnt expcnt(0)
5380 ; GFX6-NEXT: s_setpc_b64 s[30:31]
5381 %unused = atomicrmw fmax ptr addrspace(1) %ptr, half %val syncscope("agent") seq_cst
5385 define void @global_agent_atomic_fmax_noret_f16__offset12b_pos(ptr addrspace(1) %ptr, half %val) #0 {
5386 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_pos:
5388 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5389 ; GFX12-NEXT: s_wait_expcnt 0x0
5390 ; GFX12-NEXT: s_wait_samplecnt 0x0
5391 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5392 ; GFX12-NEXT: s_wait_kmcnt 0x0
5393 ; GFX12-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
5394 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
5395 ; GFX12-NEXT: v_max_num_f16_e32 v6, v2, v2
5396 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
5397 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v4
5398 ; GFX12-NEXT: v_and_b32_e32 v4, 3, v4
5399 ; GFX12-NEXT: s_mov_b32 s0, 0
5400 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
5401 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5402 ; GFX12-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
5403 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
5404 ; GFX12-NEXT: v_not_b32_e32 v5, v5
5405 ; GFX12-NEXT: .LBB26_1: ; %atomicrmw.start
5406 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
5407 ; GFX12-NEXT: s_wait_loadcnt 0x0
5408 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5409 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5410 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v2
5411 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v6
5412 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5413 ; GFX12-NEXT: v_and_b32_e32 v2, 0xffff, v2
5414 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5415 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
5416 ; GFX12-NEXT: v_and_or_b32 v2, v3, v5, v2
5417 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
5418 ; GFX12-NEXT: s_wait_storecnt 0x0
5419 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
5420 ; GFX12-NEXT: s_wait_loadcnt 0x0
5421 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
5422 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
5423 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
5424 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
5425 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5426 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5427 ; GFX12-NEXT: s_cbranch_execnz .LBB26_1
5428 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
5429 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
5430 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5432 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_pos:
5434 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5435 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
5436 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
5437 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
5438 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
5439 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
5440 ; GFX940-NEXT: v_and_b32_e32 v4, 3, v4
5441 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5442 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
5443 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v4, s0
5444 ; GFX940-NEXT: v_not_b32_e32 v5, v5
5445 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
5446 ; GFX940-NEXT: v_max_f16_e32 v6, v2, v2
5447 ; GFX940-NEXT: .LBB26_1: ; %atomicrmw.start
5448 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
5449 ; GFX940-NEXT: s_waitcnt vmcnt(0)
5450 ; GFX940-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5451 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v2
5452 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v6
5453 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5454 ; GFX940-NEXT: v_and_or_b32 v2, v3, v5, v2
5455 ; GFX940-NEXT: buffer_wbl2 sc1
5456 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0
5457 ; GFX940-NEXT: s_waitcnt vmcnt(0)
5458 ; GFX940-NEXT: buffer_inv sc1
5459 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
5460 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
5461 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
5462 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
5463 ; GFX940-NEXT: s_cbranch_execnz .LBB26_1
5464 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
5465 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
5466 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5468 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_pos:
5470 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5471 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
5472 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
5473 ; GFX11-NEXT: v_max_f16_e32 v6, v2, v2
5474 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
5475 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v4
5476 ; GFX11-NEXT: v_and_b32_e32 v4, 3, v4
5477 ; GFX11-NEXT: s_mov_b32 s0, 0
5478 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
5479 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5480 ; GFX11-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
5481 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
5482 ; GFX11-NEXT: v_not_b32_e32 v5, v5
5483 ; GFX11-NEXT: .LBB26_1: ; %atomicrmw.start
5484 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
5485 ; GFX11-NEXT: s_waitcnt vmcnt(0)
5486 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5487 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5488 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v2
5489 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v6
5490 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5491 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff, v2
5492 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5493 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
5494 ; GFX11-NEXT: v_and_or_b32 v2, v3, v5, v2
5495 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5496 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
5497 ; GFX11-NEXT: s_waitcnt vmcnt(0)
5498 ; GFX11-NEXT: buffer_gl1_inv
5499 ; GFX11-NEXT: buffer_gl0_inv
5500 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
5501 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
5502 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
5503 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5504 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5505 ; GFX11-NEXT: s_cbranch_execnz .LBB26_1
5506 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
5507 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
5508 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5510 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_pos:
5512 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5513 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
5514 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
5515 ; GFX10-NEXT: v_max_f16_e32 v6, v2, v2
5516 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v4
5517 ; GFX10-NEXT: v_and_b32_e32 v4, 3, v4
5518 ; GFX10-NEXT: s_mov_b32 s4, 0
5519 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
5520 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5521 ; GFX10-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
5522 ; GFX10-NEXT: v_not_b32_e32 v5, v5
5523 ; GFX10-NEXT: .LBB26_1: ; %atomicrmw.start
5524 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5525 ; GFX10-NEXT: s_waitcnt vmcnt(0)
5526 ; GFX10-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5527 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
5528 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v6
5529 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
5530 ; GFX10-NEXT: v_and_or_b32 v2, v3, v5, v2
5531 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5532 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
5533 ; GFX10-NEXT: s_waitcnt vmcnt(0)
5534 ; GFX10-NEXT: buffer_gl1_inv
5535 ; GFX10-NEXT: buffer_gl0_inv
5536 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
5537 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
5538 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5539 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5540 ; GFX10-NEXT: s_cbranch_execnz .LBB26_1
5541 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5542 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5543 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5545 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_pos:
5547 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5548 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
5549 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
5550 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v4
5551 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
5552 ; GFX90A-NEXT: v_and_b32_e32 v4, 3, v4
5553 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5554 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
5555 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v4, s4
5556 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
5557 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
5558 ; GFX90A-NEXT: v_max_f16_e32 v6, v2, v2
5559 ; GFX90A-NEXT: .LBB26_1: ; %atomicrmw.start
5560 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
5561 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5562 ; GFX90A-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5563 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v2
5564 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v6
5565 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5566 ; GFX90A-NEXT: v_and_or_b32 v2, v3, v5, v2
5567 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
5568 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5569 ; GFX90A-NEXT: buffer_wbinvl1
5570 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
5571 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5572 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
5573 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
5574 ; GFX90A-NEXT: s_cbranch_execnz .LBB26_1
5575 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
5576 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5577 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5579 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_pos:
5581 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5582 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
5583 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
5584 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v4
5585 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
5586 ; GFX908-NEXT: v_and_b32_e32 v4, 3, v4
5587 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5588 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
5589 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v4, s4
5590 ; GFX908-NEXT: v_not_b32_e32 v5, v5
5591 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
5592 ; GFX908-NEXT: v_max_f16_e32 v6, v2, v2
5593 ; GFX908-NEXT: .LBB26_1: ; %atomicrmw.start
5594 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
5595 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5596 ; GFX908-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5597 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v2
5598 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v6
5599 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5600 ; GFX908-NEXT: v_and_or_b32 v2, v3, v5, v2
5601 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
5602 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5603 ; GFX908-NEXT: buffer_wbinvl1
5604 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
5605 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5606 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
5607 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
5608 ; GFX908-NEXT: s_cbranch_execnz .LBB26_1
5609 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
5610 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5611 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5613 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_pos:
5615 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5616 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7fe, v0
5617 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
5618 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v4
5619 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
5620 ; GFX8-NEXT: v_and_b32_e32 v4, 3, v4
5621 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5622 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
5623 ; GFX8-NEXT: v_lshlrev_b32_e64 v5, v4, s4
5624 ; GFX8-NEXT: v_not_b32_e32 v5, v5
5625 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5626 ; GFX8-NEXT: v_max_f16_e32 v6, v2, v2
5627 ; GFX8-NEXT: .LBB26_1: ; %atomicrmw.start
5628 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5629 ; GFX8-NEXT: s_waitcnt vmcnt(0)
5630 ; GFX8-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5631 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
5632 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v6
5633 ; GFX8-NEXT: v_and_b32_e32 v7, v3, v5
5634 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5635 ; GFX8-NEXT: v_or_b32_e32 v2, v7, v2
5636 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5637 ; GFX8-NEXT: s_waitcnt vmcnt(0)
5638 ; GFX8-NEXT: buffer_wbinvl1
5639 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
5640 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5641 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
5642 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5643 ; GFX8-NEXT: s_cbranch_execnz .LBB26_1
5644 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5645 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
5646 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5648 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_pos:
5650 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5651 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
5652 ; GFX7-NEXT: s_mov_b32 s6, 0
5653 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
5654 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
5655 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
5656 ; GFX7-NEXT: s_mov_b32 s4, s6
5657 ; GFX7-NEXT: s_mov_b32 s5, s6
5658 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
5659 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
5660 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
5661 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5662 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
5663 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v2
5664 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v4
5665 ; GFX7-NEXT: v_not_b32_e32 v6, v2
5666 ; GFX7-NEXT: .LBB26_1: ; %atomicrmw.start
5667 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5668 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5669 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5670 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
5671 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v6
5672 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v5
5673 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
5674 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5675 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
5676 ; GFX7-NEXT: v_mov_b32_e32 v8, v3
5677 ; GFX7-NEXT: v_mov_b32_e32 v7, v2
5678 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
5679 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5680 ; GFX7-NEXT: buffer_wbinvl1
5681 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
5682 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
5683 ; GFX7-NEXT: v_mov_b32_e32 v3, v7
5684 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
5685 ; GFX7-NEXT: s_cbranch_execnz .LBB26_1
5686 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5687 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
5688 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5690 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_pos:
5692 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5693 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
5694 ; GFX6-NEXT: s_mov_b32 s6, 0
5695 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
5696 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
5697 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
5698 ; GFX6-NEXT: s_mov_b32 s4, s6
5699 ; GFX6-NEXT: s_mov_b32 s5, s6
5700 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
5701 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
5702 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
5703 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5704 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
5705 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v2
5706 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v4
5707 ; GFX6-NEXT: v_not_b32_e32 v6, v2
5708 ; GFX6-NEXT: .LBB26_1: ; %atomicrmw.start
5709 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
5710 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5711 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5712 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v2
5713 ; GFX6-NEXT: s_waitcnt expcnt(0)
5714 ; GFX6-NEXT: v_and_b32_e32 v7, v3, v6
5715 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v5
5716 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
5717 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5718 ; GFX6-NEXT: v_or_b32_e32 v2, v7, v2
5719 ; GFX6-NEXT: v_mov_b32_e32 v8, v3
5720 ; GFX6-NEXT: v_mov_b32_e32 v7, v2
5721 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
5722 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5723 ; GFX6-NEXT: buffer_wbinvl1
5724 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
5725 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
5726 ; GFX6-NEXT: v_mov_b32_e32 v3, v7
5727 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
5728 ; GFX6-NEXT: s_cbranch_execnz .LBB26_1
5729 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
5730 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
5731 ; GFX6-NEXT: s_waitcnt expcnt(0)
5732 ; GFX6-NEXT: s_setpc_b64 s[30:31]
5733 %gep = getelementptr half, ptr addrspace(1) %ptr, i64 1023
5734 %unused = atomicrmw fmax ptr addrspace(1) %gep, half %val syncscope("agent") seq_cst
5738 define void @global_agent_atomic_fmax_noret_f16__offset12b_neg(ptr addrspace(1) %ptr, half %val) #0 {
5739 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_neg:
5741 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5742 ; GFX12-NEXT: s_wait_expcnt 0x0
5743 ; GFX12-NEXT: s_wait_samplecnt 0x0
5744 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5745 ; GFX12-NEXT: s_wait_kmcnt 0x0
5746 ; GFX12-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
5747 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
5748 ; GFX12-NEXT: v_max_num_f16_e32 v6, v2, v2
5749 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
5750 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v4
5751 ; GFX12-NEXT: v_and_b32_e32 v4, 3, v4
5752 ; GFX12-NEXT: s_mov_b32 s0, 0
5753 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
5754 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5755 ; GFX12-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
5756 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
5757 ; GFX12-NEXT: v_not_b32_e32 v5, v5
5758 ; GFX12-NEXT: .LBB27_1: ; %atomicrmw.start
5759 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
5760 ; GFX12-NEXT: s_wait_loadcnt 0x0
5761 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5762 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5763 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v2
5764 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v6
5765 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5766 ; GFX12-NEXT: v_and_b32_e32 v2, 0xffff, v2
5767 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5768 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
5769 ; GFX12-NEXT: v_and_or_b32 v2, v3, v5, v2
5770 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
5771 ; GFX12-NEXT: s_wait_storecnt 0x0
5772 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
5773 ; GFX12-NEXT: s_wait_loadcnt 0x0
5774 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
5775 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
5776 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
5777 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
5778 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5779 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5780 ; GFX12-NEXT: s_cbranch_execnz .LBB27_1
5781 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
5782 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
5783 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5785 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_neg:
5787 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5788 ; GFX940-NEXT: s_movk_i32 s0, 0xf800
5789 ; GFX940-NEXT: s_mov_b32 s1, -1
5790 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
5791 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
5792 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
5793 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
5794 ; GFX940-NEXT: v_and_b32_e32 v4, 3, v4
5795 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5796 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
5797 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v4, s0
5798 ; GFX940-NEXT: v_not_b32_e32 v5, v5
5799 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
5800 ; GFX940-NEXT: v_max_f16_e32 v6, v2, v2
5801 ; GFX940-NEXT: .LBB27_1: ; %atomicrmw.start
5802 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
5803 ; GFX940-NEXT: s_waitcnt vmcnt(0)
5804 ; GFX940-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5805 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v2
5806 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v6
5807 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5808 ; GFX940-NEXT: v_and_or_b32 v2, v3, v5, v2
5809 ; GFX940-NEXT: buffer_wbl2 sc1
5810 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0
5811 ; GFX940-NEXT: s_waitcnt vmcnt(0)
5812 ; GFX940-NEXT: buffer_inv sc1
5813 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
5814 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
5815 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
5816 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
5817 ; GFX940-NEXT: s_cbranch_execnz .LBB27_1
5818 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
5819 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
5820 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5822 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_neg:
5824 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5825 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
5826 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
5827 ; GFX11-NEXT: v_max_f16_e32 v6, v2, v2
5828 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
5829 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v4
5830 ; GFX11-NEXT: v_and_b32_e32 v4, 3, v4
5831 ; GFX11-NEXT: s_mov_b32 s0, 0
5832 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
5833 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5834 ; GFX11-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
5835 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
5836 ; GFX11-NEXT: v_not_b32_e32 v5, v5
5837 ; GFX11-NEXT: .LBB27_1: ; %atomicrmw.start
5838 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
5839 ; GFX11-NEXT: s_waitcnt vmcnt(0)
5840 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5841 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5842 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v2
5843 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v6
5844 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
5845 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff, v2
5846 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5847 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
5848 ; GFX11-NEXT: v_and_or_b32 v2, v3, v5, v2
5849 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5850 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
5851 ; GFX11-NEXT: s_waitcnt vmcnt(0)
5852 ; GFX11-NEXT: buffer_gl1_inv
5853 ; GFX11-NEXT: buffer_gl0_inv
5854 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
5855 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
5856 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
5857 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5858 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5859 ; GFX11-NEXT: s_cbranch_execnz .LBB27_1
5860 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
5861 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
5862 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5864 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_neg:
5866 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5867 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
5868 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
5869 ; GFX10-NEXT: v_max_f16_e32 v6, v2, v2
5870 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v4
5871 ; GFX10-NEXT: v_and_b32_e32 v4, 3, v4
5872 ; GFX10-NEXT: s_mov_b32 s4, 0
5873 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
5874 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5875 ; GFX10-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
5876 ; GFX10-NEXT: v_not_b32_e32 v5, v5
5877 ; GFX10-NEXT: .LBB27_1: ; %atomicrmw.start
5878 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5879 ; GFX10-NEXT: s_waitcnt vmcnt(0)
5880 ; GFX10-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5881 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
5882 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v6
5883 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
5884 ; GFX10-NEXT: v_and_or_b32 v2, v3, v5, v2
5885 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5886 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
5887 ; GFX10-NEXT: s_waitcnt vmcnt(0)
5888 ; GFX10-NEXT: buffer_gl1_inv
5889 ; GFX10-NEXT: buffer_gl0_inv
5890 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
5891 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
5892 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5893 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5894 ; GFX10-NEXT: s_cbranch_execnz .LBB27_1
5895 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5896 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5897 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5899 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_neg:
5901 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5902 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
5903 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
5904 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v4
5905 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
5906 ; GFX90A-NEXT: v_and_b32_e32 v4, 3, v4
5907 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5908 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
5909 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v4, s4
5910 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
5911 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
5912 ; GFX90A-NEXT: v_max_f16_e32 v6, v2, v2
5913 ; GFX90A-NEXT: .LBB27_1: ; %atomicrmw.start
5914 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
5915 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5916 ; GFX90A-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5917 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v2
5918 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v6
5919 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5920 ; GFX90A-NEXT: v_and_or_b32 v2, v3, v5, v2
5921 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
5922 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5923 ; GFX90A-NEXT: buffer_wbinvl1
5924 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
5925 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5926 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
5927 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
5928 ; GFX90A-NEXT: s_cbranch_execnz .LBB27_1
5929 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
5930 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5931 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5933 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_neg:
5935 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5936 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
5937 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
5938 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v4
5939 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
5940 ; GFX908-NEXT: v_and_b32_e32 v4, 3, v4
5941 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5942 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
5943 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v4, s4
5944 ; GFX908-NEXT: v_not_b32_e32 v5, v5
5945 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
5946 ; GFX908-NEXT: v_max_f16_e32 v6, v2, v2
5947 ; GFX908-NEXT: .LBB27_1: ; %atomicrmw.start
5948 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
5949 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5950 ; GFX908-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5951 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v2
5952 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v6
5953 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5954 ; GFX908-NEXT: v_and_or_b32 v2, v3, v5, v2
5955 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
5956 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5957 ; GFX908-NEXT: buffer_wbinvl1
5958 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
5959 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5960 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
5961 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
5962 ; GFX908-NEXT: s_cbranch_execnz .LBB27_1
5963 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
5964 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5965 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5967 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_neg:
5969 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5970 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0xfffff800, v0
5971 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
5972 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v4
5973 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
5974 ; GFX8-NEXT: v_and_b32_e32 v4, 3, v4
5975 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 3, v4
5976 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
5977 ; GFX8-NEXT: v_lshlrev_b32_e64 v5, v4, s4
5978 ; GFX8-NEXT: v_not_b32_e32 v5, v5
5979 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5980 ; GFX8-NEXT: v_max_f16_e32 v6, v2, v2
5981 ; GFX8-NEXT: .LBB27_1: ; %atomicrmw.start
5982 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5983 ; GFX8-NEXT: s_waitcnt vmcnt(0)
5984 ; GFX8-NEXT: v_lshrrev_b32_e32 v2, v4, v3
5985 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
5986 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v6
5987 ; GFX8-NEXT: v_and_b32_e32 v7, v3, v5
5988 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, v4, v2
5989 ; GFX8-NEXT: v_or_b32_e32 v2, v7, v2
5990 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5991 ; GFX8-NEXT: s_waitcnt vmcnt(0)
5992 ; GFX8-NEXT: buffer_wbinvl1
5993 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
5994 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5995 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
5996 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5997 ; GFX8-NEXT: s_cbranch_execnz .LBB27_1
5998 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5999 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6000 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6002 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_neg:
6004 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6005 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
6006 ; GFX7-NEXT: s_mov_b32 s6, 0
6007 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
6008 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
6009 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
6010 ; GFX7-NEXT: s_mov_b32 s4, s6
6011 ; GFX7-NEXT: s_mov_b32 s5, s6
6012 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
6013 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
6014 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
6015 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
6016 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
6017 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v2
6018 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v4
6019 ; GFX7-NEXT: v_not_b32_e32 v6, v2
6020 ; GFX7-NEXT: .LBB27_1: ; %atomicrmw.start
6021 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6022 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6023 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
6024 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
6025 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v6
6026 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v5
6027 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
6028 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
6029 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
6030 ; GFX7-NEXT: v_mov_b32_e32 v8, v3
6031 ; GFX7-NEXT: v_mov_b32_e32 v7, v2
6032 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
6033 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6034 ; GFX7-NEXT: buffer_wbinvl1
6035 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
6036 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
6037 ; GFX7-NEXT: v_mov_b32_e32 v3, v7
6038 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
6039 ; GFX7-NEXT: s_cbranch_execnz .LBB27_1
6040 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6041 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
6042 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6044 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f16__offset12b_neg:
6046 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6047 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
6048 ; GFX6-NEXT: s_mov_b32 s6, 0
6049 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
6050 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
6051 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
6052 ; GFX6-NEXT: s_mov_b32 s4, s6
6053 ; GFX6-NEXT: s_mov_b32 s5, s6
6054 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
6055 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
6056 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
6057 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 3, v4
6058 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
6059 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v2
6060 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v4
6061 ; GFX6-NEXT: v_not_b32_e32 v6, v2
6062 ; GFX6-NEXT: .LBB27_1: ; %atomicrmw.start
6063 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
6064 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6065 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v4, v3
6066 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v2
6067 ; GFX6-NEXT: s_waitcnt expcnt(0)
6068 ; GFX6-NEXT: v_and_b32_e32 v7, v3, v6
6069 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v5
6070 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
6071 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v4, v2
6072 ; GFX6-NEXT: v_or_b32_e32 v2, v7, v2
6073 ; GFX6-NEXT: v_mov_b32_e32 v8, v3
6074 ; GFX6-NEXT: v_mov_b32_e32 v7, v2
6075 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
6076 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6077 ; GFX6-NEXT: buffer_wbinvl1
6078 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
6079 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
6080 ; GFX6-NEXT: v_mov_b32_e32 v3, v7
6081 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
6082 ; GFX6-NEXT: s_cbranch_execnz .LBB27_1
6083 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
6084 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
6085 ; GFX6-NEXT: s_waitcnt expcnt(0)
6086 ; GFX6-NEXT: s_setpc_b64 s[30:31]
6087 %gep = getelementptr half, ptr addrspace(1) %ptr, i64 -1024
6088 %unused = atomicrmw fmax ptr addrspace(1) %gep, half %val syncscope("agent") seq_cst
6092 define half @global_agent_atomic_fmax_ret_f16__offset12b_pos__align4(ptr addrspace(1) %ptr, half %val) #0 {
6093 ; GFX12-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos__align4:
6095 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6096 ; GFX12-NEXT: s_wait_expcnt 0x0
6097 ; GFX12-NEXT: s_wait_samplecnt 0x0
6098 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6099 ; GFX12-NEXT: s_wait_kmcnt 0x0
6100 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2046
6101 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v2
6102 ; GFX12-NEXT: s_mov_b32 s0, 0
6103 ; GFX12-NEXT: .LBB28_1: ; %atomicrmw.start
6104 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6105 ; GFX12-NEXT: s_wait_loadcnt 0x0
6106 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
6107 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6108 ; GFX12-NEXT: v_max_num_f16_e32 v3, v4, v4
6109 ; GFX12-NEXT: v_max_num_f16_e32 v3, v3, v2
6110 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6111 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
6112 ; GFX12-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
6113 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
6114 ; GFX12-NEXT: s_wait_storecnt 0x0
6115 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2046 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
6116 ; GFX12-NEXT: s_wait_loadcnt 0x0
6117 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
6118 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
6119 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
6120 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6121 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6122 ; GFX12-NEXT: s_cbranch_execnz .LBB28_1
6123 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6124 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
6125 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
6126 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6128 ; GFX940-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos__align4:
6130 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6131 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2046
6132 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
6133 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v2
6134 ; GFX940-NEXT: s_mov_b32 s2, 0xffff0000
6135 ; GFX940-NEXT: .LBB28_1: ; %atomicrmw.start
6136 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
6137 ; GFX940-NEXT: s_waitcnt vmcnt(0)
6138 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
6139 ; GFX940-NEXT: v_max_f16_e32 v3, v5, v5
6140 ; GFX940-NEXT: v_max_f16_e32 v3, v3, v2
6141 ; GFX940-NEXT: v_and_or_b32 v4, v5, s2, v3
6142 ; GFX940-NEXT: buffer_wbl2 sc1
6143 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2046 sc0
6144 ; GFX940-NEXT: s_waitcnt vmcnt(0)
6145 ; GFX940-NEXT: buffer_inv sc1
6146 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
6147 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
6148 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
6149 ; GFX940-NEXT: s_cbranch_execnz .LBB28_1
6150 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
6151 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
6152 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
6153 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6155 ; GFX11-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos__align4:
6157 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6158 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2046
6159 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v2
6160 ; GFX11-NEXT: s_mov_b32 s0, 0
6161 ; GFX11-NEXT: .LBB28_1: ; %atomicrmw.start
6162 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6163 ; GFX11-NEXT: s_waitcnt vmcnt(0)
6164 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
6165 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6166 ; GFX11-NEXT: v_max_f16_e32 v3, v4, v4
6167 ; GFX11-NEXT: v_max_f16_e32 v3, v3, v2
6168 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6169 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
6170 ; GFX11-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
6171 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6172 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2046 glc
6173 ; GFX11-NEXT: s_waitcnt vmcnt(0)
6174 ; GFX11-NEXT: buffer_gl1_inv
6175 ; GFX11-NEXT: buffer_gl0_inv
6176 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
6177 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
6178 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6179 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6180 ; GFX11-NEXT: s_cbranch_execnz .LBB28_1
6181 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6182 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
6183 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
6184 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6186 ; GFX10-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos__align4:
6188 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6189 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2046
6190 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
6191 ; GFX10-NEXT: s_mov_b32 s4, 0
6192 ; GFX10-NEXT: .LBB28_1: ; %atomicrmw.start
6193 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6194 ; GFX10-NEXT: s_waitcnt vmcnt(0)
6195 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
6196 ; GFX10-NEXT: v_max_f16_e32 v3, v4, v4
6197 ; GFX10-NEXT: v_max_f16_e32 v3, v3, v2
6198 ; GFX10-NEXT: v_and_b32_e32 v3, 0xffff, v3
6199 ; GFX10-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
6200 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6201 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2046 glc
6202 ; GFX10-NEXT: s_waitcnt vmcnt(0)
6203 ; GFX10-NEXT: buffer_gl1_inv
6204 ; GFX10-NEXT: buffer_gl0_inv
6205 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
6206 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
6207 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
6208 ; GFX10-NEXT: s_cbranch_execnz .LBB28_1
6209 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6210 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
6211 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
6212 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6214 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos__align4:
6216 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6217 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2046
6218 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
6219 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v2
6220 ; GFX90A-NEXT: s_mov_b32 s6, 0xffff0000
6221 ; GFX90A-NEXT: .LBB28_1: ; %atomicrmw.start
6222 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
6223 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
6224 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
6225 ; GFX90A-NEXT: v_max_f16_e32 v3, v5, v5
6226 ; GFX90A-NEXT: v_max_f16_e32 v3, v3, v2
6227 ; GFX90A-NEXT: v_and_or_b32 v4, v5, s6, v3
6228 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2046 glc
6229 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
6230 ; GFX90A-NEXT: buffer_wbinvl1
6231 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
6232 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6233 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
6234 ; GFX90A-NEXT: s_cbranch_execnz .LBB28_1
6235 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
6236 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
6237 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
6238 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6240 ; GFX908-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos__align4:
6242 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6243 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2046
6244 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
6245 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v2
6246 ; GFX908-NEXT: s_mov_b32 s6, 0xffff0000
6247 ; GFX908-NEXT: .LBB28_1: ; %atomicrmw.start
6248 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6249 ; GFX908-NEXT: s_waitcnt vmcnt(0)
6250 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
6251 ; GFX908-NEXT: v_max_f16_e32 v3, v4, v4
6252 ; GFX908-NEXT: v_max_f16_e32 v3, v3, v2
6253 ; GFX908-NEXT: v_and_or_b32 v3, v4, s6, v3
6254 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2046 glc
6255 ; GFX908-NEXT: s_waitcnt vmcnt(0)
6256 ; GFX908-NEXT: buffer_wbinvl1
6257 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
6258 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6259 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
6260 ; GFX908-NEXT: s_cbranch_execnz .LBB28_1
6261 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6262 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
6263 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
6264 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6266 ; GFX8-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos__align4:
6268 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6269 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
6270 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
6271 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
6272 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
6273 ; GFX8-NEXT: v_max_f16_e32 v1, v2, v2
6274 ; GFX8-NEXT: .LBB28_1: ; %atomicrmw.start
6275 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6276 ; GFX8-NEXT: s_waitcnt vmcnt(0)
6277 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
6278 ; GFX8-NEXT: v_max_f16_e32 v0, v6, v6
6279 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
6280 ; GFX8-NEXT: v_max_f16_e32 v0, v0, v1
6281 ; GFX8-NEXT: v_or_b32_e32 v5, v2, v0
6282 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
6283 ; GFX8-NEXT: s_waitcnt vmcnt(0)
6284 ; GFX8-NEXT: buffer_wbinvl1
6285 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
6286 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6287 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
6288 ; GFX8-NEXT: s_cbranch_execnz .LBB28_1
6289 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6290 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6291 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6293 ; GFX7-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos__align4:
6295 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6296 ; GFX7-NEXT: s_mov_b32 s6, 0
6297 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
6298 ; GFX7-NEXT: s_mov_b32 s4, s6
6299 ; GFX7-NEXT: s_mov_b32 s5, s6
6300 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2046
6301 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
6302 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
6303 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v2
6304 ; GFX7-NEXT: .LBB28_1: ; %atomicrmw.start
6305 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6306 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6307 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
6308 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
6309 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v6
6310 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
6311 ; GFX7-NEXT: v_or_b32_e32 v2, v4, v2
6312 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
6313 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
6314 ; GFX7-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 offset:2046 glc
6315 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6316 ; GFX7-NEXT: buffer_wbinvl1
6317 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6318 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
6319 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
6320 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
6321 ; GFX7-NEXT: s_cbranch_execnz .LBB28_1
6322 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6323 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
6324 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v4
6325 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6327 ; GFX6-LABEL: global_agent_atomic_fmax_ret_f16__offset12b_pos__align4:
6329 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6330 ; GFX6-NEXT: s_mov_b32 s6, 0
6331 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
6332 ; GFX6-NEXT: s_mov_b32 s4, s6
6333 ; GFX6-NEXT: s_mov_b32 s5, s6
6334 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2046
6335 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
6336 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
6337 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v2
6338 ; GFX6-NEXT: .LBB28_1: ; %atomicrmw.start
6339 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
6340 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6341 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v3
6342 ; GFX6-NEXT: s_waitcnt expcnt(0)
6343 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
6344 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v6
6345 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
6346 ; GFX6-NEXT: v_or_b32_e32 v2, v4, v2
6347 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
6348 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
6349 ; GFX6-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 offset:2046 glc
6350 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6351 ; GFX6-NEXT: buffer_wbinvl1
6352 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6353 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
6354 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
6355 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
6356 ; GFX6-NEXT: s_cbranch_execnz .LBB28_1
6357 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
6358 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
6359 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v4
6360 ; GFX6-NEXT: s_waitcnt expcnt(0)
6361 ; GFX6-NEXT: s_setpc_b64 s[30:31]
6362 %gep = getelementptr half, ptr addrspace(1) %ptr, i64 1023
6363 %result = atomicrmw fmax ptr addrspace(1) %gep, half %val syncscope("agent") seq_cst, align 4
6367 define void @global_agent_atomic_fmax_noret_f16__offset12b__align4_pos(ptr addrspace(1) %ptr, half %val) #0 {
6368 ; GFX12-LABEL: global_agent_atomic_fmax_noret_f16__offset12b__align4_pos:
6370 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6371 ; GFX12-NEXT: s_wait_expcnt 0x0
6372 ; GFX12-NEXT: s_wait_samplecnt 0x0
6373 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6374 ; GFX12-NEXT: s_wait_kmcnt 0x0
6375 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2046
6376 ; GFX12-NEXT: v_max_num_f16_e32 v4, v2, v2
6377 ; GFX12-NEXT: s_mov_b32 s0, 0
6378 ; GFX12-NEXT: .LBB29_1: ; %atomicrmw.start
6379 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6380 ; GFX12-NEXT: s_wait_loadcnt 0x0
6381 ; GFX12-NEXT: v_max_num_f16_e32 v2, v3, v3
6382 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6383 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v4
6384 ; GFX12-NEXT: v_and_b32_e32 v2, 0xffff, v2
6385 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
6386 ; GFX12-NEXT: v_and_or_b32 v2, 0xffff0000, v3, v2
6387 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
6388 ; GFX12-NEXT: s_wait_storecnt 0x0
6389 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2046 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
6390 ; GFX12-NEXT: s_wait_loadcnt 0x0
6391 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
6392 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
6393 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
6394 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
6395 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6396 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6397 ; GFX12-NEXT: s_cbranch_execnz .LBB29_1
6398 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6399 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
6400 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6402 ; GFX940-LABEL: global_agent_atomic_fmax_noret_f16__offset12b__align4_pos:
6404 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6405 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2046
6406 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
6407 ; GFX940-NEXT: v_max_f16_e32 v4, v2, v2
6408 ; GFX940-NEXT: s_mov_b32 s2, 0xffff0000
6409 ; GFX940-NEXT: .LBB29_1: ; %atomicrmw.start
6410 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
6411 ; GFX940-NEXT: s_waitcnt vmcnt(0)
6412 ; GFX940-NEXT: v_max_f16_e32 v2, v3, v3
6413 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v4
6414 ; GFX940-NEXT: v_and_or_b32 v2, v3, s2, v2
6415 ; GFX940-NEXT: buffer_wbl2 sc1
6416 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2046 sc0
6417 ; GFX940-NEXT: s_waitcnt vmcnt(0)
6418 ; GFX940-NEXT: buffer_inv sc1
6419 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
6420 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
6421 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
6422 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
6423 ; GFX940-NEXT: s_cbranch_execnz .LBB29_1
6424 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
6425 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
6426 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6428 ; GFX11-LABEL: global_agent_atomic_fmax_noret_f16__offset12b__align4_pos:
6430 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6431 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2046
6432 ; GFX11-NEXT: v_max_f16_e32 v4, v2, v2
6433 ; GFX11-NEXT: s_mov_b32 s0, 0
6434 ; GFX11-NEXT: .LBB29_1: ; %atomicrmw.start
6435 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6436 ; GFX11-NEXT: s_waitcnt vmcnt(0)
6437 ; GFX11-NEXT: v_max_f16_e32 v2, v3, v3
6438 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6439 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v4
6440 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff, v2
6441 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
6442 ; GFX11-NEXT: v_and_or_b32 v2, 0xffff0000, v3, v2
6443 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6444 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2046 glc
6445 ; GFX11-NEXT: s_waitcnt vmcnt(0)
6446 ; GFX11-NEXT: buffer_gl1_inv
6447 ; GFX11-NEXT: buffer_gl0_inv
6448 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
6449 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
6450 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
6451 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6452 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6453 ; GFX11-NEXT: s_cbranch_execnz .LBB29_1
6454 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6455 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
6456 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6458 ; GFX10-LABEL: global_agent_atomic_fmax_noret_f16__offset12b__align4_pos:
6460 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6461 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2046
6462 ; GFX10-NEXT: v_max_f16_e32 v4, v2, v2
6463 ; GFX10-NEXT: s_mov_b32 s4, 0
6464 ; GFX10-NEXT: .LBB29_1: ; %atomicrmw.start
6465 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6466 ; GFX10-NEXT: s_waitcnt vmcnt(0)
6467 ; GFX10-NEXT: v_max_f16_e32 v2, v3, v3
6468 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v4
6469 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff, v2
6470 ; GFX10-NEXT: v_and_or_b32 v2, 0xffff0000, v3, v2
6471 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6472 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2046 glc
6473 ; GFX10-NEXT: s_waitcnt vmcnt(0)
6474 ; GFX10-NEXT: buffer_gl1_inv
6475 ; GFX10-NEXT: buffer_gl0_inv
6476 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
6477 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
6478 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
6479 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
6480 ; GFX10-NEXT: s_cbranch_execnz .LBB29_1
6481 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6482 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
6483 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6485 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_f16__offset12b__align4_pos:
6487 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6488 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2046
6489 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
6490 ; GFX90A-NEXT: v_max_f16_e32 v4, v2, v2
6491 ; GFX90A-NEXT: s_mov_b32 s6, 0xffff0000
6492 ; GFX90A-NEXT: .LBB29_1: ; %atomicrmw.start
6493 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
6494 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
6495 ; GFX90A-NEXT: v_max_f16_e32 v2, v3, v3
6496 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v4
6497 ; GFX90A-NEXT: v_and_or_b32 v2, v3, s6, v2
6498 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2046 glc
6499 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
6500 ; GFX90A-NEXT: buffer_wbinvl1
6501 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
6502 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6503 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
6504 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
6505 ; GFX90A-NEXT: s_cbranch_execnz .LBB29_1
6506 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
6507 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
6508 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6510 ; GFX908-LABEL: global_agent_atomic_fmax_noret_f16__offset12b__align4_pos:
6512 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6513 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2046
6514 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
6515 ; GFX908-NEXT: v_max_f16_e32 v4, v2, v2
6516 ; GFX908-NEXT: s_mov_b32 s6, 0xffff0000
6517 ; GFX908-NEXT: .LBB29_1: ; %atomicrmw.start
6518 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6519 ; GFX908-NEXT: s_waitcnt vmcnt(0)
6520 ; GFX908-NEXT: v_max_f16_e32 v2, v3, v3
6521 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v4
6522 ; GFX908-NEXT: v_and_or_b32 v2, v3, s6, v2
6523 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2046 glc
6524 ; GFX908-NEXT: s_waitcnt vmcnt(0)
6525 ; GFX908-NEXT: buffer_wbinvl1
6526 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
6527 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6528 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
6529 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
6530 ; GFX908-NEXT: s_cbranch_execnz .LBB29_1
6531 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6532 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
6533 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6535 ; GFX8-LABEL: global_agent_atomic_fmax_noret_f16__offset12b__align4_pos:
6537 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6538 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fe, v0
6539 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
6540 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
6541 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
6542 ; GFX8-NEXT: v_max_f16_e32 v4, v2, v2
6543 ; GFX8-NEXT: .LBB29_1: ; %atomicrmw.start
6544 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6545 ; GFX8-NEXT: s_waitcnt vmcnt(0)
6546 ; GFX8-NEXT: v_max_f16_e32 v2, v3, v3
6547 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6548 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v4
6549 ; GFX8-NEXT: v_or_b32_e32 v2, v5, v2
6550 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6551 ; GFX8-NEXT: s_waitcnt vmcnt(0)
6552 ; GFX8-NEXT: buffer_wbinvl1
6553 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
6554 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6555 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
6556 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
6557 ; GFX8-NEXT: s_cbranch_execnz .LBB29_1
6558 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6559 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6560 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6562 ; GFX7-LABEL: global_agent_atomic_fmax_noret_f16__offset12b__align4_pos:
6564 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6565 ; GFX7-NEXT: s_mov_b32 s6, 0
6566 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
6567 ; GFX7-NEXT: s_mov_b32 s4, s6
6568 ; GFX7-NEXT: s_mov_b32 s5, s6
6569 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2046
6570 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
6571 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
6572 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v2
6573 ; GFX7-NEXT: .LBB29_1: ; %atomicrmw.start
6574 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6575 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6576 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
6577 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6578 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v4
6579 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
6580 ; GFX7-NEXT: v_or_b32_e32 v2, v5, v2
6581 ; GFX7-NEXT: v_mov_b32_e32 v6, v3
6582 ; GFX7-NEXT: v_mov_b32_e32 v5, v2
6583 ; GFX7-NEXT: buffer_atomic_cmpswap v[5:6], v[0:1], s[4:7], 0 addr64 offset:2046 glc
6584 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6585 ; GFX7-NEXT: buffer_wbinvl1
6586 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
6587 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
6588 ; GFX7-NEXT: v_mov_b32_e32 v3, v5
6589 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
6590 ; GFX7-NEXT: s_cbranch_execnz .LBB29_1
6591 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6592 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
6593 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6595 ; GFX6-LABEL: global_agent_atomic_fmax_noret_f16__offset12b__align4_pos:
6597 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6598 ; GFX6-NEXT: s_mov_b32 s6, 0
6599 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
6600 ; GFX6-NEXT: s_mov_b32 s4, s6
6601 ; GFX6-NEXT: s_mov_b32 s5, s6
6602 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2046
6603 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
6604 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
6605 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v2
6606 ; GFX6-NEXT: .LBB29_1: ; %atomicrmw.start
6607 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
6608 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6609 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v3
6610 ; GFX6-NEXT: s_waitcnt expcnt(0)
6611 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
6612 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v4
6613 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
6614 ; GFX6-NEXT: v_or_b32_e32 v2, v5, v2
6615 ; GFX6-NEXT: v_mov_b32_e32 v6, v3
6616 ; GFX6-NEXT: v_mov_b32_e32 v5, v2
6617 ; GFX6-NEXT: buffer_atomic_cmpswap v[5:6], v[0:1], s[4:7], 0 addr64 offset:2046 glc
6618 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6619 ; GFX6-NEXT: buffer_wbinvl1
6620 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
6621 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
6622 ; GFX6-NEXT: v_mov_b32_e32 v3, v5
6623 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
6624 ; GFX6-NEXT: s_cbranch_execnz .LBB29_1
6625 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
6626 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
6627 ; GFX6-NEXT: s_waitcnt expcnt(0)
6628 ; GFX6-NEXT: s_setpc_b64 s[30:31]
6629 %gep = getelementptr half, ptr addrspace(1) %ptr, i64 1023
6630 %unused = atomicrmw fmax ptr addrspace(1) %gep, half %val syncscope("agent") seq_cst, align 4
6634 define half @global_system_atomic_fmax_ret_f16__offset12b_pos(ptr addrspace(1) %ptr, half %val) #0 {
6635 ; GFX12-LABEL: global_system_atomic_fmax_ret_f16__offset12b_pos:
6637 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6638 ; GFX12-NEXT: s_wait_expcnt 0x0
6639 ; GFX12-NEXT: s_wait_samplecnt 0x0
6640 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6641 ; GFX12-NEXT: s_wait_kmcnt 0x0
6642 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
6643 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
6644 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v2
6645 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
6646 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
6647 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
6648 ; GFX12-NEXT: s_mov_b32 s0, 0
6649 ; GFX12-NEXT: global_load_b32 v5, v[0:1], off
6650 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
6651 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
6652 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
6653 ; GFX12-NEXT: v_not_b32_e32 v4, v4
6654 ; GFX12-NEXT: .LBB30_1: ; %atomicrmw.start
6655 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6656 ; GFX12-NEXT: s_wait_loadcnt 0x0
6657 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
6658 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6659 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
6660 ; GFX12-NEXT: v_max_num_f16_e32 v5, v5, v5
6661 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6662 ; GFX12-NEXT: v_max_num_f16_e32 v5, v5, v2
6663 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff, v5
6664 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6665 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
6666 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
6667 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
6668 ; GFX12-NEXT: s_wait_storecnt 0x0
6669 ; GFX12-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off th:TH_ATOMIC_RETURN scope:SCOPE_SYS
6670 ; GFX12-NEXT: s_wait_loadcnt 0x0
6671 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
6672 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
6673 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
6674 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6675 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6676 ; GFX12-NEXT: s_cbranch_execnz .LBB30_1
6677 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6678 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
6679 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
6680 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6682 ; GFX940-LABEL: global_system_atomic_fmax_ret_f16__offset12b_pos:
6684 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6685 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
6686 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
6687 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
6688 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
6689 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
6690 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
6691 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
6692 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
6693 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
6694 ; GFX940-NEXT: v_not_b32_e32 v4, v4
6695 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
6696 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v2
6697 ; GFX940-NEXT: .LBB30_1: ; %atomicrmw.start
6698 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
6699 ; GFX940-NEXT: s_waitcnt vmcnt(0)
6700 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
6701 ; GFX940-NEXT: v_lshrrev_b32_e32 v5, v3, v7
6702 ; GFX940-NEXT: v_max_f16_e32 v5, v5, v5
6703 ; GFX940-NEXT: v_max_f16_e32 v5, v5, v2
6704 ; GFX940-NEXT: v_lshlrev_b32_e32 v5, v3, v5
6705 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
6706 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
6707 ; GFX940-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off sc0 sc1
6708 ; GFX940-NEXT: s_waitcnt vmcnt(0)
6709 ; GFX940-NEXT: buffer_inv sc0 sc1
6710 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
6711 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
6712 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
6713 ; GFX940-NEXT: s_cbranch_execnz .LBB30_1
6714 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
6715 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
6716 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
6717 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6719 ; GFX11-LABEL: global_system_atomic_fmax_ret_f16__offset12b_pos:
6721 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6722 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
6723 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
6724 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v2
6725 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
6726 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
6727 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
6728 ; GFX11-NEXT: s_mov_b32 s0, 0
6729 ; GFX11-NEXT: global_load_b32 v5, v[0:1], off
6730 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
6731 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
6732 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
6733 ; GFX11-NEXT: v_not_b32_e32 v4, v4
6734 ; GFX11-NEXT: .LBB30_1: ; %atomicrmw.start
6735 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6736 ; GFX11-NEXT: s_waitcnt vmcnt(0)
6737 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
6738 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6739 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
6740 ; GFX11-NEXT: v_max_f16_e32 v5, v5, v5
6741 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6742 ; GFX11-NEXT: v_max_f16_e32 v5, v5, v2
6743 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff, v5
6744 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
6745 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
6746 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
6747 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6748 ; GFX11-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off glc
6749 ; GFX11-NEXT: s_waitcnt vmcnt(0)
6750 ; GFX11-NEXT: buffer_gl1_inv
6751 ; GFX11-NEXT: buffer_gl0_inv
6752 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
6753 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
6754 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6755 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6756 ; GFX11-NEXT: s_cbranch_execnz .LBB30_1
6757 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6758 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
6759 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
6760 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6762 ; GFX10-LABEL: global_system_atomic_fmax_ret_f16__offset12b_pos:
6764 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6765 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
6766 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
6767 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
6768 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
6769 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
6770 ; GFX10-NEXT: s_mov_b32 s4, 0
6771 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
6772 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
6773 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
6774 ; GFX10-NEXT: v_not_b32_e32 v4, v4
6775 ; GFX10-NEXT: .LBB30_1: ; %atomicrmw.start
6776 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6777 ; GFX10-NEXT: s_waitcnt vmcnt(0)
6778 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
6779 ; GFX10-NEXT: v_lshrrev_b32_e32 v5, v3, v6
6780 ; GFX10-NEXT: v_max_f16_e32 v5, v5, v5
6781 ; GFX10-NEXT: v_max_f16_e32 v5, v5, v2
6782 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
6783 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
6784 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6785 ; GFX10-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
6786 ; GFX10-NEXT: s_waitcnt vmcnt(0)
6787 ; GFX10-NEXT: buffer_gl1_inv
6788 ; GFX10-NEXT: buffer_gl0_inv
6789 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
6790 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
6791 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
6792 ; GFX10-NEXT: s_cbranch_execnz .LBB30_1
6793 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6794 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
6795 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
6796 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6798 ; GFX90A-LABEL: global_system_atomic_fmax_ret_f16__offset12b_pos:
6800 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6801 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
6802 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
6803 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
6804 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
6805 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
6806 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
6807 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
6808 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
6809 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
6810 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
6811 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v2
6812 ; GFX90A-NEXT: .LBB30_1: ; %atomicrmw.start
6813 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
6814 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
6815 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
6816 ; GFX90A-NEXT: v_lshrrev_b32_e32 v5, v3, v7
6817 ; GFX90A-NEXT: v_max_f16_e32 v5, v5, v5
6818 ; GFX90A-NEXT: v_max_f16_e32 v5, v5, v2
6819 ; GFX90A-NEXT: v_lshlrev_b32_e32 v5, v3, v5
6820 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
6821 ; GFX90A-NEXT: buffer_wbl2
6822 ; GFX90A-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off glc
6823 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
6824 ; GFX90A-NEXT: buffer_invl2
6825 ; GFX90A-NEXT: buffer_wbinvl1
6826 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
6827 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6828 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
6829 ; GFX90A-NEXT: s_cbranch_execnz .LBB30_1
6830 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
6831 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
6832 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
6833 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6835 ; GFX908-LABEL: global_system_atomic_fmax_ret_f16__offset12b_pos:
6837 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6838 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
6839 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
6840 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
6841 ; GFX908-NEXT: global_load_dword v5, v[0:1], off
6842 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
6843 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
6844 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
6845 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
6846 ; GFX908-NEXT: v_not_b32_e32 v4, v4
6847 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
6848 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v2
6849 ; GFX908-NEXT: .LBB30_1: ; %atomicrmw.start
6850 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6851 ; GFX908-NEXT: s_waitcnt vmcnt(0)
6852 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
6853 ; GFX908-NEXT: v_lshrrev_b32_e32 v5, v3, v6
6854 ; GFX908-NEXT: v_max_f16_e32 v5, v5, v5
6855 ; GFX908-NEXT: v_max_f16_e32 v5, v5, v2
6856 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, v3, v5
6857 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
6858 ; GFX908-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
6859 ; GFX908-NEXT: s_waitcnt vmcnt(0)
6860 ; GFX908-NEXT: buffer_wbinvl1
6861 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
6862 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6863 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
6864 ; GFX908-NEXT: s_cbranch_execnz .LBB30_1
6865 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6866 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
6867 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
6868 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6870 ; GFX8-LABEL: global_system_atomic_fmax_ret_f16__offset12b_pos:
6872 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6873 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
6874 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
6875 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
6876 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
6877 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
6878 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
6879 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
6880 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
6881 ; GFX8-NEXT: v_not_b32_e32 v4, v4
6882 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
6883 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
6884 ; GFX8-NEXT: .LBB30_1: ; %atomicrmw.start
6885 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6886 ; GFX8-NEXT: s_waitcnt vmcnt(0)
6887 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
6888 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, v3, v6
6889 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v5
6890 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v2
6891 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
6892 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, v3, v5
6893 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
6894 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
6895 ; GFX8-NEXT: s_waitcnt vmcnt(0)
6896 ; GFX8-NEXT: buffer_wbinvl1
6897 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
6898 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6899 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
6900 ; GFX8-NEXT: s_cbranch_execnz .LBB30_1
6901 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6902 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6903 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
6904 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6906 ; GFX7-LABEL: global_system_atomic_fmax_ret_f16__offset12b_pos:
6908 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6909 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
6910 ; GFX7-NEXT: s_mov_b32 s6, 0
6911 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
6912 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
6913 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
6914 ; GFX7-NEXT: s_mov_b32 s4, s6
6915 ; GFX7-NEXT: s_mov_b32 s5, s6
6916 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
6917 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
6918 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
6919 ; GFX7-NEXT: v_lshlrev_b32_e32 v6, 3, v4
6920 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
6921 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v2
6922 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v6
6923 ; GFX7-NEXT: v_not_b32_e32 v8, v2
6924 ; GFX7-NEXT: .LBB30_1: ; %atomicrmw.start
6925 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6926 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6927 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v6, v3
6928 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
6929 ; GFX7-NEXT: v_and_b32_e32 v4, v3, v8
6930 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v7
6931 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
6932 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v6, v2
6933 ; GFX7-NEXT: v_or_b32_e32 v2, v4, v2
6934 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
6935 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
6936 ; GFX7-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
6937 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6938 ; GFX7-NEXT: buffer_wbinvl1
6939 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6940 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
6941 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
6942 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
6943 ; GFX7-NEXT: s_cbranch_execnz .LBB30_1
6944 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6945 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
6946 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v6, v4
6947 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
6948 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6950 ; GFX6-LABEL: global_system_atomic_fmax_ret_f16__offset12b_pos:
6952 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6953 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
6954 ; GFX6-NEXT: s_mov_b32 s6, 0
6955 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
6956 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
6957 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
6958 ; GFX6-NEXT: s_mov_b32 s4, s6
6959 ; GFX6-NEXT: s_mov_b32 s5, s6
6960 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
6961 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
6962 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
6963 ; GFX6-NEXT: v_lshlrev_b32_e32 v6, 3, v4
6964 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
6965 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v2
6966 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v6
6967 ; GFX6-NEXT: v_not_b32_e32 v8, v2
6968 ; GFX6-NEXT: .LBB30_1: ; %atomicrmw.start
6969 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
6970 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6971 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v6, v3
6972 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v2
6973 ; GFX6-NEXT: s_waitcnt expcnt(0)
6974 ; GFX6-NEXT: v_and_b32_e32 v4, v3, v8
6975 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v7
6976 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
6977 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v6, v2
6978 ; GFX6-NEXT: v_or_b32_e32 v2, v4, v2
6979 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
6980 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
6981 ; GFX6-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
6982 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6983 ; GFX6-NEXT: buffer_wbinvl1
6984 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
6985 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
6986 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
6987 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
6988 ; GFX6-NEXT: s_cbranch_execnz .LBB30_1
6989 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
6990 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
6991 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v6, v4
6992 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v0
6993 ; GFX6-NEXT: s_waitcnt expcnt(0)
6994 ; GFX6-NEXT: s_setpc_b64 s[30:31]
6995 %gep = getelementptr half, ptr addrspace(1) %ptr, i64 1023
6996 %result = atomicrmw fmax ptr addrspace(1) %gep, half %val seq_cst
7000 define void @global_system_atomic_fmax_noret_f16__offset12b_pos(ptr addrspace(1) %ptr, half %val) #0 {
7001 ; GFX12-LABEL: global_system_atomic_fmax_noret_f16__offset12b_pos:
7003 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7004 ; GFX12-NEXT: s_wait_expcnt 0x0
7005 ; GFX12-NEXT: s_wait_samplecnt 0x0
7006 ; GFX12-NEXT: s_wait_bvhcnt 0x0
7007 ; GFX12-NEXT: s_wait_kmcnt 0x0
7008 ; GFX12-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
7009 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
7010 ; GFX12-NEXT: v_max_num_f16_e32 v6, v2, v2
7011 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
7012 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v4
7013 ; GFX12-NEXT: v_and_b32_e32 v4, 3, v4
7014 ; GFX12-NEXT: s_mov_b32 s0, 0
7015 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
7016 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 3, v4
7017 ; GFX12-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
7018 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7019 ; GFX12-NEXT: v_not_b32_e32 v5, v5
7020 ; GFX12-NEXT: .LBB31_1: ; %atomicrmw.start
7021 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
7022 ; GFX12-NEXT: s_wait_loadcnt 0x0
7023 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, v4, v3
7024 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7025 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v2
7026 ; GFX12-NEXT: v_max_num_f16_e32 v2, v2, v6
7027 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7028 ; GFX12-NEXT: v_and_b32_e32 v2, 0xffff, v2
7029 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, v4, v2
7030 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7031 ; GFX12-NEXT: v_and_or_b32 v2, v3, v5, v2
7032 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
7033 ; GFX12-NEXT: s_wait_storecnt 0x0
7034 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off th:TH_ATOMIC_RETURN scope:SCOPE_SYS
7035 ; GFX12-NEXT: s_wait_loadcnt 0x0
7036 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
7037 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
7038 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
7039 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
7040 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7041 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7042 ; GFX12-NEXT: s_cbranch_execnz .LBB31_1
7043 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
7044 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
7045 ; GFX12-NEXT: s_setpc_b64 s[30:31]
7047 ; GFX940-LABEL: global_system_atomic_fmax_noret_f16__offset12b_pos:
7049 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7050 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
7051 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
7052 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
7053 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
7054 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
7055 ; GFX940-NEXT: v_and_b32_e32 v4, 3, v4
7056 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 3, v4
7057 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
7058 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v4, s0
7059 ; GFX940-NEXT: v_not_b32_e32 v5, v5
7060 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
7061 ; GFX940-NEXT: v_max_f16_e32 v6, v2, v2
7062 ; GFX940-NEXT: .LBB31_1: ; %atomicrmw.start
7063 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
7064 ; GFX940-NEXT: s_waitcnt vmcnt(0)
7065 ; GFX940-NEXT: v_lshrrev_b32_e32 v2, v4, v3
7066 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v2
7067 ; GFX940-NEXT: v_max_f16_e32 v2, v2, v6
7068 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, v4, v2
7069 ; GFX940-NEXT: v_and_or_b32 v2, v3, v5, v2
7070 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
7071 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0 sc1
7072 ; GFX940-NEXT: s_waitcnt vmcnt(0)
7073 ; GFX940-NEXT: buffer_inv sc0 sc1
7074 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
7075 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
7076 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
7077 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
7078 ; GFX940-NEXT: s_cbranch_execnz .LBB31_1
7079 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
7080 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
7081 ; GFX940-NEXT: s_setpc_b64 s[30:31]
7083 ; GFX11-LABEL: global_system_atomic_fmax_noret_f16__offset12b_pos:
7085 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7086 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
7087 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
7088 ; GFX11-NEXT: v_max_f16_e32 v6, v2, v2
7089 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
7090 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v4
7091 ; GFX11-NEXT: v_and_b32_e32 v4, 3, v4
7092 ; GFX11-NEXT: s_mov_b32 s0, 0
7093 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
7094 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 3, v4
7095 ; GFX11-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
7096 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7097 ; GFX11-NEXT: v_not_b32_e32 v5, v5
7098 ; GFX11-NEXT: .LBB31_1: ; %atomicrmw.start
7099 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
7100 ; GFX11-NEXT: s_waitcnt vmcnt(0)
7101 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, v4, v3
7102 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7103 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v2
7104 ; GFX11-NEXT: v_max_f16_e32 v2, v2, v6
7105 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7106 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff, v2
7107 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, v4, v2
7108 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7109 ; GFX11-NEXT: v_and_or_b32 v2, v3, v5, v2
7110 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
7111 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
7112 ; GFX11-NEXT: s_waitcnt vmcnt(0)
7113 ; GFX11-NEXT: buffer_gl1_inv
7114 ; GFX11-NEXT: buffer_gl0_inv
7115 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
7116 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
7117 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
7118 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7119 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7120 ; GFX11-NEXT: s_cbranch_execnz .LBB31_1
7121 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
7122 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
7123 ; GFX11-NEXT: s_setpc_b64 s[30:31]
7125 ; GFX10-LABEL: global_system_atomic_fmax_noret_f16__offset12b_pos:
7127 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7128 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
7129 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
7130 ; GFX10-NEXT: v_max_f16_e32 v6, v2, v2
7131 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v4
7132 ; GFX10-NEXT: v_and_b32_e32 v4, 3, v4
7133 ; GFX10-NEXT: s_mov_b32 s4, 0
7134 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
7135 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 3, v4
7136 ; GFX10-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
7137 ; GFX10-NEXT: v_not_b32_e32 v5, v5
7138 ; GFX10-NEXT: .LBB31_1: ; %atomicrmw.start
7139 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
7140 ; GFX10-NEXT: s_waitcnt vmcnt(0)
7141 ; GFX10-NEXT: v_lshrrev_b32_e32 v2, v4, v3
7142 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v2
7143 ; GFX10-NEXT: v_max_f16_e32 v2, v2, v6
7144 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
7145 ; GFX10-NEXT: v_and_or_b32 v2, v3, v5, v2
7146 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
7147 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
7148 ; GFX10-NEXT: s_waitcnt vmcnt(0)
7149 ; GFX10-NEXT: buffer_gl1_inv
7150 ; GFX10-NEXT: buffer_gl0_inv
7151 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
7152 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
7153 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
7154 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
7155 ; GFX10-NEXT: s_cbranch_execnz .LBB31_1
7156 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
7157 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
7158 ; GFX10-NEXT: s_setpc_b64 s[30:31]
7160 ; GFX90A-LABEL: global_system_atomic_fmax_noret_f16__offset12b_pos:
7162 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7163 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
7164 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
7165 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v4
7166 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
7167 ; GFX90A-NEXT: v_and_b32_e32 v4, 3, v4
7168 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 3, v4
7169 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
7170 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v4, s4
7171 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
7172 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
7173 ; GFX90A-NEXT: v_max_f16_e32 v6, v2, v2
7174 ; GFX90A-NEXT: .LBB31_1: ; %atomicrmw.start
7175 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
7176 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
7177 ; GFX90A-NEXT: v_lshrrev_b32_e32 v2, v4, v3
7178 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v2
7179 ; GFX90A-NEXT: v_max_f16_e32 v2, v2, v6
7180 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, v4, v2
7181 ; GFX90A-NEXT: v_and_or_b32 v2, v3, v5, v2
7182 ; GFX90A-NEXT: buffer_wbl2
7183 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
7184 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
7185 ; GFX90A-NEXT: buffer_invl2
7186 ; GFX90A-NEXT: buffer_wbinvl1
7187 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
7188 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7189 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
7190 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
7191 ; GFX90A-NEXT: s_cbranch_execnz .LBB31_1
7192 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
7193 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
7194 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
7196 ; GFX908-LABEL: global_system_atomic_fmax_noret_f16__offset12b_pos:
7198 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7199 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
7200 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
7201 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v4
7202 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
7203 ; GFX908-NEXT: v_and_b32_e32 v4, 3, v4
7204 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 3, v4
7205 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
7206 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v4, s4
7207 ; GFX908-NEXT: v_not_b32_e32 v5, v5
7208 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
7209 ; GFX908-NEXT: v_max_f16_e32 v6, v2, v2
7210 ; GFX908-NEXT: .LBB31_1: ; %atomicrmw.start
7211 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
7212 ; GFX908-NEXT: s_waitcnt vmcnt(0)
7213 ; GFX908-NEXT: v_lshrrev_b32_e32 v2, v4, v3
7214 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v2
7215 ; GFX908-NEXT: v_max_f16_e32 v2, v2, v6
7216 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, v4, v2
7217 ; GFX908-NEXT: v_and_or_b32 v2, v3, v5, v2
7218 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
7219 ; GFX908-NEXT: s_waitcnt vmcnt(0)
7220 ; GFX908-NEXT: buffer_wbinvl1
7221 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
7222 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7223 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
7224 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
7225 ; GFX908-NEXT: s_cbranch_execnz .LBB31_1
7226 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
7227 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
7228 ; GFX908-NEXT: s_setpc_b64 s[30:31]
7230 ; GFX8-LABEL: global_system_atomic_fmax_noret_f16__offset12b_pos:
7232 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7233 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7fe, v0
7234 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
7235 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v4
7236 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
7237 ; GFX8-NEXT: v_and_b32_e32 v4, 3, v4
7238 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 3, v4
7239 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
7240 ; GFX8-NEXT: v_lshlrev_b32_e64 v5, v4, s4
7241 ; GFX8-NEXT: v_not_b32_e32 v5, v5
7242 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
7243 ; GFX8-NEXT: v_max_f16_e32 v6, v2, v2
7244 ; GFX8-NEXT: .LBB31_1: ; %atomicrmw.start
7245 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
7246 ; GFX8-NEXT: s_waitcnt vmcnt(0)
7247 ; GFX8-NEXT: v_lshrrev_b32_e32 v2, v4, v3
7248 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
7249 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v6
7250 ; GFX8-NEXT: v_and_b32_e32 v7, v3, v5
7251 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, v4, v2
7252 ; GFX8-NEXT: v_or_b32_e32 v2, v7, v2
7253 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
7254 ; GFX8-NEXT: s_waitcnt vmcnt(0)
7255 ; GFX8-NEXT: buffer_wbinvl1
7256 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
7257 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7258 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
7259 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
7260 ; GFX8-NEXT: s_cbranch_execnz .LBB31_1
7261 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
7262 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
7263 ; GFX8-NEXT: s_setpc_b64 s[30:31]
7265 ; GFX7-LABEL: global_system_atomic_fmax_noret_f16__offset12b_pos:
7267 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7268 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
7269 ; GFX7-NEXT: s_mov_b32 s6, 0
7270 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
7271 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
7272 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
7273 ; GFX7-NEXT: s_mov_b32 s4, s6
7274 ; GFX7-NEXT: s_mov_b32 s5, s6
7275 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
7276 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
7277 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
7278 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
7279 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
7280 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v2
7281 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v4
7282 ; GFX7-NEXT: v_not_b32_e32 v6, v2
7283 ; GFX7-NEXT: .LBB31_1: ; %atomicrmw.start
7284 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
7285 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7286 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
7287 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
7288 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v6
7289 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v5
7290 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
7291 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
7292 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
7293 ; GFX7-NEXT: v_mov_b32_e32 v8, v3
7294 ; GFX7-NEXT: v_mov_b32_e32 v7, v2
7295 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
7296 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7297 ; GFX7-NEXT: buffer_wbinvl1
7298 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
7299 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
7300 ; GFX7-NEXT: v_mov_b32_e32 v3, v7
7301 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
7302 ; GFX7-NEXT: s_cbranch_execnz .LBB31_1
7303 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
7304 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
7305 ; GFX7-NEXT: s_setpc_b64 s[30:31]
7307 ; GFX6-LABEL: global_system_atomic_fmax_noret_f16__offset12b_pos:
7309 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7310 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
7311 ; GFX6-NEXT: s_mov_b32 s6, 0
7312 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
7313 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
7314 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
7315 ; GFX6-NEXT: s_mov_b32 s4, s6
7316 ; GFX6-NEXT: s_mov_b32 s5, s6
7317 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
7318 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
7319 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
7320 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 3, v4
7321 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
7322 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v2
7323 ; GFX6-NEXT: v_lshl_b32_e32 v2, 0xffff, v4
7324 ; GFX6-NEXT: v_not_b32_e32 v6, v2
7325 ; GFX6-NEXT: .LBB31_1: ; %atomicrmw.start
7326 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
7327 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7328 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v4, v3
7329 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v2
7330 ; GFX6-NEXT: s_waitcnt expcnt(0)
7331 ; GFX6-NEXT: v_and_b32_e32 v7, v3, v6
7332 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v5
7333 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
7334 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v4, v2
7335 ; GFX6-NEXT: v_or_b32_e32 v2, v7, v2
7336 ; GFX6-NEXT: v_mov_b32_e32 v8, v3
7337 ; GFX6-NEXT: v_mov_b32_e32 v7, v2
7338 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
7339 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7340 ; GFX6-NEXT: buffer_wbinvl1
7341 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
7342 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
7343 ; GFX6-NEXT: v_mov_b32_e32 v3, v7
7344 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
7345 ; GFX6-NEXT: s_cbranch_execnz .LBB31_1
7346 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
7347 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
7348 ; GFX6-NEXT: s_waitcnt expcnt(0)
7349 ; GFX6-NEXT: s_setpc_b64 s[30:31]
7350 %gep = getelementptr half, ptr addrspace(1) %ptr, i64 1023
7351 %unused = atomicrmw fmax ptr addrspace(1) %gep, half %val seq_cst
7355 ; --------------------------------------------------------------------
7357 ; --------------------------------------------------------------------
7359 define bfloat @global_agent_atomic_fmax_ret_bf16(ptr addrspace(1) %ptr, bfloat %val) #0 {
7360 ; GFX12-LABEL: global_agent_atomic_fmax_ret_bf16:
7362 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7363 ; GFX12-NEXT: s_wait_expcnt 0x0
7364 ; GFX12-NEXT: s_wait_samplecnt 0x0
7365 ; GFX12-NEXT: s_wait_bvhcnt 0x0
7366 ; GFX12-NEXT: s_wait_kmcnt 0x0
7367 ; GFX12-NEXT: v_dual_mov_b32 v3, v0 :: v_dual_lshlrev_b32 v2, 16, v2
7368 ; GFX12-NEXT: s_mov_b32 s0, 0
7369 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7370 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
7371 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
7372 ; GFX12-NEXT: global_load_b32 v5, v[0:1], off
7373 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7374 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7375 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7376 ; GFX12-NEXT: v_not_b32_e32 v4, v4
7377 ; GFX12-NEXT: .LBB32_1: ; %atomicrmw.start
7378 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
7379 ; GFX12-NEXT: s_wait_loadcnt 0x0
7380 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
7381 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7382 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7383 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 16, v5
7384 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7385 ; GFX12-NEXT: v_max_num_f32_e32 v5, v5, v2
7386 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
7387 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v5
7388 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
7389 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
7390 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
7391 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
7392 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7393 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, 16, v5
7394 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7395 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7396 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
7397 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
7398 ; GFX12-NEXT: s_wait_storecnt 0x0
7399 ; GFX12-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
7400 ; GFX12-NEXT: s_wait_loadcnt 0x0
7401 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
7402 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7403 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
7404 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7405 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7406 ; GFX12-NEXT: s_cbranch_execnz .LBB32_1
7407 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
7408 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
7409 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7410 ; GFX12-NEXT: s_setpc_b64 s[30:31]
7412 ; GFX940-LABEL: global_agent_atomic_fmax_ret_bf16:
7414 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7415 ; GFX940-NEXT: v_mov_b32_e32 v3, v0
7416 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v3
7417 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
7418 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v3
7419 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7420 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
7421 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
7422 ; GFX940-NEXT: v_not_b32_e32 v4, v4
7423 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
7424 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7425 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
7426 ; GFX940-NEXT: .LBB32_1: ; %atomicrmw.start
7427 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
7428 ; GFX940-NEXT: s_waitcnt vmcnt(0)
7429 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
7430 ; GFX940-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
7431 ; GFX940-NEXT: s_nop 0
7432 ; GFX940-NEXT: v_max_f32_e32 v5, v5, v2
7433 ; GFX940-NEXT: v_bfe_u32 v6, v5, 16, 1
7434 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v5
7435 ; GFX940-NEXT: v_add3_u32 v6, v6, v5, s2
7436 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
7437 ; GFX940-NEXT: s_nop 1
7438 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
7439 ; GFX940-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
7440 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
7441 ; GFX940-NEXT: buffer_wbl2 sc1
7442 ; GFX940-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off sc0
7443 ; GFX940-NEXT: s_waitcnt vmcnt(0)
7444 ; GFX940-NEXT: buffer_inv sc1
7445 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
7446 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
7447 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
7448 ; GFX940-NEXT: s_cbranch_execnz .LBB32_1
7449 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
7450 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
7451 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7452 ; GFX940-NEXT: s_setpc_b64 s[30:31]
7454 ; GFX11-LABEL: global_agent_atomic_fmax_ret_bf16:
7456 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7457 ; GFX11-NEXT: v_dual_mov_b32 v3, v0 :: v_dual_lshlrev_b32 v2, 16, v2
7458 ; GFX11-NEXT: s_mov_b32 s0, 0
7459 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7460 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
7461 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
7462 ; GFX11-NEXT: global_load_b32 v5, v[0:1], off
7463 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7464 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7465 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7466 ; GFX11-NEXT: v_not_b32_e32 v4, v4
7467 ; GFX11-NEXT: .p2align 6
7468 ; GFX11-NEXT: .LBB32_1: ; %atomicrmw.start
7469 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
7470 ; GFX11-NEXT: s_waitcnt vmcnt(0)
7471 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
7472 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7473 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7474 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 16, v5
7475 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7476 ; GFX11-NEXT: v_max_f32_e32 v5, v5, v2
7477 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
7478 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v5
7479 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
7480 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
7481 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
7482 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
7483 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7484 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, 16, v5
7485 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7486 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7487 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
7488 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
7489 ; GFX11-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off glc
7490 ; GFX11-NEXT: s_waitcnt vmcnt(0)
7491 ; GFX11-NEXT: buffer_gl1_inv
7492 ; GFX11-NEXT: buffer_gl0_inv
7493 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7494 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
7495 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7496 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7497 ; GFX11-NEXT: s_cbranch_execnz .LBB32_1
7498 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
7499 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
7500 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7501 ; GFX11-NEXT: s_setpc_b64 s[30:31]
7503 ; GFX10-LABEL: global_agent_atomic_fmax_ret_bf16:
7505 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7506 ; GFX10-NEXT: v_mov_b32_e32 v3, v0
7507 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7508 ; GFX10-NEXT: s_mov_b32 s4, 0
7509 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
7510 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
7511 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
7512 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7513 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7514 ; GFX10-NEXT: v_not_b32_e32 v4, v4
7515 ; GFX10-NEXT: .LBB32_1: ; %atomicrmw.start
7516 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
7517 ; GFX10-NEXT: s_waitcnt vmcnt(0)
7518 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
7519 ; GFX10-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
7520 ; GFX10-NEXT: v_max_f32_e32 v5, v5, v2
7521 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
7522 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v5
7523 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
7524 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
7525 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
7526 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
7527 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
7528 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
7529 ; GFX10-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
7530 ; GFX10-NEXT: s_waitcnt vmcnt(0)
7531 ; GFX10-NEXT: buffer_gl1_inv
7532 ; GFX10-NEXT: buffer_gl0_inv
7533 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7534 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
7535 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
7536 ; GFX10-NEXT: s_cbranch_execnz .LBB32_1
7537 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
7538 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
7539 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7540 ; GFX10-NEXT: s_setpc_b64 s[30:31]
7542 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_bf16:
7544 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7545 ; GFX90A-NEXT: v_mov_b32_e32 v3, v0
7546 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
7547 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
7548 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
7549 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7550 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
7551 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
7552 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
7553 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
7554 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7555 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
7556 ; GFX90A-NEXT: .LBB32_1: ; %atomicrmw.start
7557 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
7558 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
7559 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
7560 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
7561 ; GFX90A-NEXT: v_max_f32_e32 v5, v5, v2
7562 ; GFX90A-NEXT: v_bfe_u32 v6, v5, 16, 1
7563 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v5
7564 ; GFX90A-NEXT: v_add3_u32 v6, v6, v5, s6
7565 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
7566 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
7567 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
7568 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
7569 ; GFX90A-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off glc
7570 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
7571 ; GFX90A-NEXT: buffer_wbinvl1
7572 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
7573 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7574 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
7575 ; GFX90A-NEXT: s_cbranch_execnz .LBB32_1
7576 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
7577 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
7578 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7579 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
7581 ; GFX908-LABEL: global_agent_atomic_fmax_ret_bf16:
7583 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7584 ; GFX908-NEXT: v_mov_b32_e32 v3, v0
7585 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
7586 ; GFX908-NEXT: global_load_dword v5, v[0:1], off
7587 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
7588 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7589 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
7590 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
7591 ; GFX908-NEXT: v_not_b32_e32 v4, v4
7592 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
7593 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7594 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
7595 ; GFX908-NEXT: .LBB32_1: ; %atomicrmw.start
7596 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
7597 ; GFX908-NEXT: s_waitcnt vmcnt(0)
7598 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
7599 ; GFX908-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
7600 ; GFX908-NEXT: v_max_f32_e32 v5, v5, v2
7601 ; GFX908-NEXT: v_bfe_u32 v7, v5, 16, 1
7602 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v5
7603 ; GFX908-NEXT: v_add3_u32 v7, v7, v5, s6
7604 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
7605 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc
7606 ; GFX908-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
7607 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
7608 ; GFX908-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
7609 ; GFX908-NEXT: s_waitcnt vmcnt(0)
7610 ; GFX908-NEXT: buffer_wbinvl1
7611 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
7612 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7613 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
7614 ; GFX908-NEXT: s_cbranch_execnz .LBB32_1
7615 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
7616 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
7617 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7618 ; GFX908-NEXT: s_setpc_b64 s[30:31]
7620 ; GFX8-LABEL: global_agent_atomic_fmax_ret_bf16:
7622 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7623 ; GFX8-NEXT: v_mov_b32_e32 v3, v0
7624 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
7625 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
7626 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
7627 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7628 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
7629 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
7630 ; GFX8-NEXT: v_not_b32_e32 v4, v4
7631 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
7632 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7633 ; GFX8-NEXT: .LBB32_1: ; %atomicrmw.start
7634 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
7635 ; GFX8-NEXT: s_waitcnt vmcnt(0)
7636 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
7637 ; GFX8-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
7638 ; GFX8-NEXT: v_max_f32_e32 v5, v5, v2
7639 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
7640 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
7641 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
7642 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
7643 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
7644 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
7645 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
7646 ; GFX8-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
7647 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
7648 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7649 ; GFX8-NEXT: s_waitcnt vmcnt(0)
7650 ; GFX8-NEXT: buffer_wbinvl1
7651 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
7652 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7653 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
7654 ; GFX8-NEXT: s_cbranch_execnz .LBB32_1
7655 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
7656 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
7657 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7658 ; GFX8-NEXT: s_setpc_b64 s[30:31]
7660 ; GFX7-LABEL: global_agent_atomic_fmax_ret_bf16:
7662 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7663 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
7664 ; GFX7-NEXT: s_mov_b32 s6, 0
7665 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
7666 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
7667 ; GFX7-NEXT: s_mov_b32 s4, s6
7668 ; GFX7-NEXT: s_mov_b32 s5, s6
7669 ; GFX7-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
7670 ; GFX7-NEXT: v_and_b32_e32 v3, 3, v3
7671 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 3, v3
7672 ; GFX7-NEXT: v_lshl_b32_e32 v3, 0xffff, v5
7673 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
7674 ; GFX7-NEXT: v_not_b32_e32 v6, v3
7675 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
7676 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v2
7677 ; GFX7-NEXT: .LBB32_1: ; %atomicrmw.start
7678 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
7679 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7680 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v5, v4
7681 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7682 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
7683 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v7
7684 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
7685 ; GFX7-NEXT: v_and_b32_e32 v3, v4, v6
7686 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v5, v2
7687 ; GFX7-NEXT: v_or_b32_e32 v3, v3, v2
7688 ; GFX7-NEXT: v_mov_b32_e32 v2, v3
7689 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
7690 ; GFX7-NEXT: buffer_atomic_cmpswap v[2:3], v[0:1], s[4:7], 0 addr64 glc
7691 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7692 ; GFX7-NEXT: buffer_wbinvl1
7693 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
7694 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
7695 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
7696 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
7697 ; GFX7-NEXT: s_cbranch_execnz .LBB32_1
7698 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
7699 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
7700 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v5, v2
7701 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
7702 ; GFX7-NEXT: s_setpc_b64 s[30:31]
7704 ; GFX6-LABEL: global_agent_atomic_fmax_ret_bf16:
7706 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7707 ; GFX6-NEXT: v_mov_b32_e32 v3, v0
7708 ; GFX6-NEXT: s_mov_b32 s6, 0
7709 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v3
7710 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
7711 ; GFX6-NEXT: s_mov_b32 s4, s6
7712 ; GFX6-NEXT: s_mov_b32 s5, s6
7713 ; GFX6-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
7714 ; GFX6-NEXT: v_and_b32_e32 v3, 3, v3
7715 ; GFX6-NEXT: v_lshlrev_b32_e32 v5, 3, v3
7716 ; GFX6-NEXT: v_lshl_b32_e32 v3, 0xffff, v5
7717 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
7718 ; GFX6-NEXT: v_not_b32_e32 v6, v3
7719 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
7720 ; GFX6-NEXT: v_and_b32_e32 v7, 0xffff0000, v2
7721 ; GFX6-NEXT: .LBB32_1: ; %atomicrmw.start
7722 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
7723 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0)
7724 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v5, v4
7725 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7726 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
7727 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v7
7728 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
7729 ; GFX6-NEXT: v_and_b32_e32 v3, v4, v6
7730 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v5, v2
7731 ; GFX6-NEXT: v_or_b32_e32 v3, v3, v2
7732 ; GFX6-NEXT: v_mov_b32_e32 v2, v3
7733 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
7734 ; GFX6-NEXT: buffer_atomic_cmpswap v[2:3], v[0:1], s[4:7], 0 addr64 glc
7735 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7736 ; GFX6-NEXT: buffer_wbinvl1
7737 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v2, v4
7738 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
7739 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
7740 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
7741 ; GFX6-NEXT: s_cbranch_execnz .LBB32_1
7742 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
7743 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
7744 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v5, v2
7745 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v0
7746 ; GFX6-NEXT: s_waitcnt expcnt(0)
7747 ; GFX6-NEXT: s_setpc_b64 s[30:31]
7748 %result = atomicrmw fmax ptr addrspace(1) %ptr, bfloat %val syncscope("agent") seq_cst
7752 define bfloat @global_agent_atomic_fmax_ret_bf16__offset12b_pos(ptr addrspace(1) %ptr, bfloat %val) #0 {
7753 ; GFX12-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos:
7755 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7756 ; GFX12-NEXT: s_wait_expcnt 0x0
7757 ; GFX12-NEXT: s_wait_samplecnt 0x0
7758 ; GFX12-NEXT: s_wait_bvhcnt 0x0
7759 ; GFX12-NEXT: s_wait_kmcnt 0x0
7760 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
7761 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
7762 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7763 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
7764 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
7765 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
7766 ; GFX12-NEXT: s_mov_b32 s0, 0
7767 ; GFX12-NEXT: global_load_b32 v5, v[0:1], off
7768 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7769 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7770 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7771 ; GFX12-NEXT: v_not_b32_e32 v4, v4
7772 ; GFX12-NEXT: .LBB33_1: ; %atomicrmw.start
7773 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
7774 ; GFX12-NEXT: s_wait_loadcnt 0x0
7775 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
7776 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7777 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7778 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 16, v5
7779 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7780 ; GFX12-NEXT: v_max_num_f32_e32 v5, v5, v2
7781 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
7782 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v5
7783 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
7784 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
7785 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
7786 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
7787 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7788 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, 16, v5
7789 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7790 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7791 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
7792 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
7793 ; GFX12-NEXT: s_wait_storecnt 0x0
7794 ; GFX12-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
7795 ; GFX12-NEXT: s_wait_loadcnt 0x0
7796 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
7797 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7798 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
7799 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7800 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7801 ; GFX12-NEXT: s_cbranch_execnz .LBB33_1
7802 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
7803 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
7804 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7805 ; GFX12-NEXT: s_setpc_b64 s[30:31]
7807 ; GFX940-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos:
7809 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7810 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
7811 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
7812 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
7813 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
7814 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
7815 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
7816 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7817 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
7818 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
7819 ; GFX940-NEXT: v_not_b32_e32 v4, v4
7820 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
7821 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7822 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
7823 ; GFX940-NEXT: .LBB33_1: ; %atomicrmw.start
7824 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
7825 ; GFX940-NEXT: s_waitcnt vmcnt(0)
7826 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
7827 ; GFX940-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
7828 ; GFX940-NEXT: s_nop 0
7829 ; GFX940-NEXT: v_max_f32_e32 v5, v5, v2
7830 ; GFX940-NEXT: v_bfe_u32 v6, v5, 16, 1
7831 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v5
7832 ; GFX940-NEXT: v_add3_u32 v6, v6, v5, s2
7833 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
7834 ; GFX940-NEXT: s_nop 1
7835 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
7836 ; GFX940-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
7837 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
7838 ; GFX940-NEXT: buffer_wbl2 sc1
7839 ; GFX940-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off sc0
7840 ; GFX940-NEXT: s_waitcnt vmcnt(0)
7841 ; GFX940-NEXT: buffer_inv sc1
7842 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
7843 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
7844 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
7845 ; GFX940-NEXT: s_cbranch_execnz .LBB33_1
7846 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
7847 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
7848 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7849 ; GFX940-NEXT: s_setpc_b64 s[30:31]
7851 ; GFX11-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos:
7853 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7854 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
7855 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
7856 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7857 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
7858 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
7859 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
7860 ; GFX11-NEXT: s_mov_b32 s0, 0
7861 ; GFX11-NEXT: global_load_b32 v5, v[0:1], off
7862 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7863 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7864 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7865 ; GFX11-NEXT: v_not_b32_e32 v4, v4
7866 ; GFX11-NEXT: .p2align 6
7867 ; GFX11-NEXT: .LBB33_1: ; %atomicrmw.start
7868 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
7869 ; GFX11-NEXT: s_waitcnt vmcnt(0)
7870 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
7871 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7872 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7873 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 16, v5
7874 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7875 ; GFX11-NEXT: v_max_f32_e32 v5, v5, v2
7876 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
7877 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v5
7878 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
7879 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
7880 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
7881 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
7882 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7883 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, 16, v5
7884 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7885 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7886 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
7887 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
7888 ; GFX11-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off glc
7889 ; GFX11-NEXT: s_waitcnt vmcnt(0)
7890 ; GFX11-NEXT: buffer_gl1_inv
7891 ; GFX11-NEXT: buffer_gl0_inv
7892 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7893 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
7894 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7895 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7896 ; GFX11-NEXT: s_cbranch_execnz .LBB33_1
7897 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
7898 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
7899 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7900 ; GFX11-NEXT: s_setpc_b64 s[30:31]
7902 ; GFX10-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos:
7904 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7905 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
7906 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
7907 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7908 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
7909 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
7910 ; GFX10-NEXT: s_mov_b32 s4, 0
7911 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
7912 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7913 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7914 ; GFX10-NEXT: v_not_b32_e32 v4, v4
7915 ; GFX10-NEXT: .LBB33_1: ; %atomicrmw.start
7916 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
7917 ; GFX10-NEXT: s_waitcnt vmcnt(0)
7918 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
7919 ; GFX10-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
7920 ; GFX10-NEXT: v_max_f32_e32 v5, v5, v2
7921 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
7922 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v5
7923 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
7924 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
7925 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
7926 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
7927 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
7928 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
7929 ; GFX10-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
7930 ; GFX10-NEXT: s_waitcnt vmcnt(0)
7931 ; GFX10-NEXT: buffer_gl1_inv
7932 ; GFX10-NEXT: buffer_gl0_inv
7933 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7934 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
7935 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
7936 ; GFX10-NEXT: s_cbranch_execnz .LBB33_1
7937 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
7938 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
7939 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7940 ; GFX10-NEXT: s_setpc_b64 s[30:31]
7942 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos:
7944 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7945 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
7946 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
7947 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
7948 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
7949 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
7950 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7951 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
7952 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
7953 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
7954 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
7955 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7956 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
7957 ; GFX90A-NEXT: .LBB33_1: ; %atomicrmw.start
7958 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
7959 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
7960 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
7961 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
7962 ; GFX90A-NEXT: v_max_f32_e32 v5, v5, v2
7963 ; GFX90A-NEXT: v_bfe_u32 v6, v5, 16, 1
7964 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v5
7965 ; GFX90A-NEXT: v_add3_u32 v6, v6, v5, s6
7966 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
7967 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
7968 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
7969 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
7970 ; GFX90A-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off glc
7971 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
7972 ; GFX90A-NEXT: buffer_wbinvl1
7973 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
7974 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7975 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
7976 ; GFX90A-NEXT: s_cbranch_execnz .LBB33_1
7977 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
7978 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
7979 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7980 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
7982 ; GFX908-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos:
7984 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7985 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
7986 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
7987 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
7988 ; GFX908-NEXT: global_load_dword v5, v[0:1], off
7989 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
7990 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7991 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
7992 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
7993 ; GFX908-NEXT: v_not_b32_e32 v4, v4
7994 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
7995 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
7996 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
7997 ; GFX908-NEXT: .LBB33_1: ; %atomicrmw.start
7998 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
7999 ; GFX908-NEXT: s_waitcnt vmcnt(0)
8000 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
8001 ; GFX908-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8002 ; GFX908-NEXT: v_max_f32_e32 v5, v5, v2
8003 ; GFX908-NEXT: v_bfe_u32 v7, v5, 16, 1
8004 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v5
8005 ; GFX908-NEXT: v_add3_u32 v7, v7, v5, s6
8006 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
8007 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc
8008 ; GFX908-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8009 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
8010 ; GFX908-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
8011 ; GFX908-NEXT: s_waitcnt vmcnt(0)
8012 ; GFX908-NEXT: buffer_wbinvl1
8013 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
8014 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8015 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
8016 ; GFX908-NEXT: s_cbranch_execnz .LBB33_1
8017 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
8018 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
8019 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
8020 ; GFX908-NEXT: s_setpc_b64 s[30:31]
8022 ; GFX8-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos:
8024 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8025 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
8026 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
8027 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
8028 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
8029 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
8030 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8031 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
8032 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
8033 ; GFX8-NEXT: v_not_b32_e32 v4, v4
8034 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
8035 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8036 ; GFX8-NEXT: .LBB33_1: ; %atomicrmw.start
8037 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
8038 ; GFX8-NEXT: s_waitcnt vmcnt(0)
8039 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
8040 ; GFX8-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8041 ; GFX8-NEXT: v_max_f32_e32 v5, v5, v2
8042 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
8043 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
8044 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
8045 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
8046 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
8047 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
8048 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
8049 ; GFX8-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8050 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
8051 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
8052 ; GFX8-NEXT: s_waitcnt vmcnt(0)
8053 ; GFX8-NEXT: buffer_wbinvl1
8054 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
8055 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8056 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
8057 ; GFX8-NEXT: s_cbranch_execnz .LBB33_1
8058 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
8059 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
8060 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
8061 ; GFX8-NEXT: s_setpc_b64 s[30:31]
8063 ; GFX7-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos:
8065 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8066 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
8067 ; GFX7-NEXT: s_mov_b32 s6, 0
8068 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
8069 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
8070 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
8071 ; GFX7-NEXT: s_mov_b32 s4, s6
8072 ; GFX7-NEXT: s_mov_b32 s5, s6
8073 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
8074 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
8075 ; GFX7-NEXT: v_lshlrev_b32_e32 v6, 3, v4
8076 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v6
8077 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
8078 ; GFX7-NEXT: v_not_b32_e32 v7, v4
8079 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
8080 ; GFX7-NEXT: v_and_b32_e32 v8, 0xffff0000, v2
8081 ; GFX7-NEXT: .LBB33_1: ; %atomicrmw.start
8082 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
8083 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8084 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v6, v3
8085 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8086 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
8087 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v8
8088 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
8089 ; GFX7-NEXT: v_and_b32_e32 v4, v3, v7
8090 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v6, v2
8091 ; GFX7-NEXT: v_or_b32_e32 v2, v4, v2
8092 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
8093 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
8094 ; GFX7-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
8095 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8096 ; GFX7-NEXT: buffer_wbinvl1
8097 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
8098 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
8099 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
8100 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
8101 ; GFX7-NEXT: s_cbranch_execnz .LBB33_1
8102 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
8103 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
8104 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v6, v4
8105 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
8106 ; GFX7-NEXT: s_setpc_b64 s[30:31]
8108 ; GFX6-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos:
8110 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8111 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
8112 ; GFX6-NEXT: s_mov_b32 s6, 0
8113 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
8114 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
8115 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
8116 ; GFX6-NEXT: s_mov_b32 s4, s6
8117 ; GFX6-NEXT: s_mov_b32 s5, s6
8118 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
8119 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
8120 ; GFX6-NEXT: v_lshlrev_b32_e32 v6, 3, v4
8121 ; GFX6-NEXT: v_lshl_b32_e32 v4, 0xffff, v6
8122 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
8123 ; GFX6-NEXT: v_not_b32_e32 v7, v4
8124 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
8125 ; GFX6-NEXT: v_and_b32_e32 v8, 0xffff0000, v2
8126 ; GFX6-NEXT: .LBB33_1: ; %atomicrmw.start
8127 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
8128 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8129 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v6, v3
8130 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8131 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
8132 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v8
8133 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
8134 ; GFX6-NEXT: s_waitcnt expcnt(0)
8135 ; GFX6-NEXT: v_and_b32_e32 v4, v3, v7
8136 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v6, v2
8137 ; GFX6-NEXT: v_or_b32_e32 v2, v4, v2
8138 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
8139 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
8140 ; GFX6-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
8141 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8142 ; GFX6-NEXT: buffer_wbinvl1
8143 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
8144 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
8145 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
8146 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
8147 ; GFX6-NEXT: s_cbranch_execnz .LBB33_1
8148 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
8149 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
8150 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v6, v4
8151 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v0
8152 ; GFX6-NEXT: s_waitcnt expcnt(0)
8153 ; GFX6-NEXT: s_setpc_b64 s[30:31]
8154 %gep = getelementptr bfloat, ptr addrspace(1) %ptr, i64 1023
8155 %result = atomicrmw fmax ptr addrspace(1) %gep, bfloat %val syncscope("agent") seq_cst
8159 define bfloat @global_agent_atomic_fmax_ret_bf16__offset12b_neg(ptr addrspace(1) %ptr, bfloat %val) #0 {
8160 ; GFX12-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_neg:
8162 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8163 ; GFX12-NEXT: s_wait_expcnt 0x0
8164 ; GFX12-NEXT: s_wait_samplecnt 0x0
8165 ; GFX12-NEXT: s_wait_bvhcnt 0x0
8166 ; GFX12-NEXT: s_wait_kmcnt 0x0
8167 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
8168 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
8169 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8170 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
8171 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
8172 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
8173 ; GFX12-NEXT: s_mov_b32 s0, 0
8174 ; GFX12-NEXT: global_load_b32 v5, v[0:1], off
8175 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8176 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
8177 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
8178 ; GFX12-NEXT: v_not_b32_e32 v4, v4
8179 ; GFX12-NEXT: .LBB34_1: ; %atomicrmw.start
8180 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
8181 ; GFX12-NEXT: s_wait_loadcnt 0x0
8182 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
8183 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8184 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
8185 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 16, v5
8186 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8187 ; GFX12-NEXT: v_max_num_f32_e32 v5, v5, v2
8188 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
8189 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v5
8190 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
8191 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
8192 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
8193 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
8194 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8195 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, 16, v5
8196 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
8197 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
8198 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
8199 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
8200 ; GFX12-NEXT: s_wait_storecnt 0x0
8201 ; GFX12-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
8202 ; GFX12-NEXT: s_wait_loadcnt 0x0
8203 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
8204 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
8205 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
8206 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8207 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8208 ; GFX12-NEXT: s_cbranch_execnz .LBB34_1
8209 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
8210 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
8211 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
8212 ; GFX12-NEXT: s_setpc_b64 s[30:31]
8214 ; GFX940-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_neg:
8216 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8217 ; GFX940-NEXT: s_movk_i32 s0, 0xf800
8218 ; GFX940-NEXT: s_mov_b32 s1, -1
8219 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
8220 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
8221 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
8222 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
8223 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
8224 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8225 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
8226 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
8227 ; GFX940-NEXT: v_not_b32_e32 v4, v4
8228 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
8229 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8230 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
8231 ; GFX940-NEXT: .LBB34_1: ; %atomicrmw.start
8232 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
8233 ; GFX940-NEXT: s_waitcnt vmcnt(0)
8234 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
8235 ; GFX940-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8236 ; GFX940-NEXT: s_nop 0
8237 ; GFX940-NEXT: v_max_f32_e32 v5, v5, v2
8238 ; GFX940-NEXT: v_bfe_u32 v6, v5, 16, 1
8239 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v5
8240 ; GFX940-NEXT: v_add3_u32 v6, v6, v5, s2
8241 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
8242 ; GFX940-NEXT: s_nop 1
8243 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
8244 ; GFX940-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8245 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
8246 ; GFX940-NEXT: buffer_wbl2 sc1
8247 ; GFX940-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off sc0
8248 ; GFX940-NEXT: s_waitcnt vmcnt(0)
8249 ; GFX940-NEXT: buffer_inv sc1
8250 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
8251 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
8252 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
8253 ; GFX940-NEXT: s_cbranch_execnz .LBB34_1
8254 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
8255 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
8256 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
8257 ; GFX940-NEXT: s_setpc_b64 s[30:31]
8259 ; GFX11-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_neg:
8261 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8262 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
8263 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
8264 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8265 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
8266 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
8267 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
8268 ; GFX11-NEXT: s_mov_b32 s0, 0
8269 ; GFX11-NEXT: global_load_b32 v5, v[0:1], off
8270 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8271 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
8272 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
8273 ; GFX11-NEXT: v_not_b32_e32 v4, v4
8274 ; GFX11-NEXT: .p2align 6
8275 ; GFX11-NEXT: .LBB34_1: ; %atomicrmw.start
8276 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
8277 ; GFX11-NEXT: s_waitcnt vmcnt(0)
8278 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
8279 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8280 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
8281 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 16, v5
8282 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8283 ; GFX11-NEXT: v_max_f32_e32 v5, v5, v2
8284 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
8285 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v5
8286 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
8287 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
8288 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
8289 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
8290 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8291 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, 16, v5
8292 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
8293 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
8294 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
8295 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
8296 ; GFX11-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off glc
8297 ; GFX11-NEXT: s_waitcnt vmcnt(0)
8298 ; GFX11-NEXT: buffer_gl1_inv
8299 ; GFX11-NEXT: buffer_gl0_inv
8300 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
8301 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
8302 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8303 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8304 ; GFX11-NEXT: s_cbranch_execnz .LBB34_1
8305 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
8306 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
8307 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
8308 ; GFX11-NEXT: s_setpc_b64 s[30:31]
8310 ; GFX10-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_neg:
8312 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8313 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
8314 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
8315 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8316 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
8317 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
8318 ; GFX10-NEXT: s_mov_b32 s4, 0
8319 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
8320 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8321 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
8322 ; GFX10-NEXT: v_not_b32_e32 v4, v4
8323 ; GFX10-NEXT: .LBB34_1: ; %atomicrmw.start
8324 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
8325 ; GFX10-NEXT: s_waitcnt vmcnt(0)
8326 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
8327 ; GFX10-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8328 ; GFX10-NEXT: v_max_f32_e32 v5, v5, v2
8329 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
8330 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v5
8331 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
8332 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
8333 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
8334 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8335 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
8336 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
8337 ; GFX10-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
8338 ; GFX10-NEXT: s_waitcnt vmcnt(0)
8339 ; GFX10-NEXT: buffer_gl1_inv
8340 ; GFX10-NEXT: buffer_gl0_inv
8341 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
8342 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
8343 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
8344 ; GFX10-NEXT: s_cbranch_execnz .LBB34_1
8345 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
8346 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
8347 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
8348 ; GFX10-NEXT: s_setpc_b64 s[30:31]
8350 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_neg:
8352 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8353 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
8354 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
8355 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
8356 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
8357 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
8358 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8359 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
8360 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
8361 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
8362 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
8363 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8364 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
8365 ; GFX90A-NEXT: .LBB34_1: ; %atomicrmw.start
8366 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
8367 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
8368 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
8369 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8370 ; GFX90A-NEXT: v_max_f32_e32 v5, v5, v2
8371 ; GFX90A-NEXT: v_bfe_u32 v6, v5, 16, 1
8372 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v5
8373 ; GFX90A-NEXT: v_add3_u32 v6, v6, v5, s6
8374 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
8375 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
8376 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8377 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
8378 ; GFX90A-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off glc
8379 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
8380 ; GFX90A-NEXT: buffer_wbinvl1
8381 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
8382 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8383 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
8384 ; GFX90A-NEXT: s_cbranch_execnz .LBB34_1
8385 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
8386 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
8387 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
8388 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
8390 ; GFX908-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_neg:
8392 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8393 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
8394 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
8395 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
8396 ; GFX908-NEXT: global_load_dword v5, v[0:1], off
8397 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
8398 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8399 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
8400 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
8401 ; GFX908-NEXT: v_not_b32_e32 v4, v4
8402 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
8403 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8404 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
8405 ; GFX908-NEXT: .LBB34_1: ; %atomicrmw.start
8406 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
8407 ; GFX908-NEXT: s_waitcnt vmcnt(0)
8408 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
8409 ; GFX908-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8410 ; GFX908-NEXT: v_max_f32_e32 v5, v5, v2
8411 ; GFX908-NEXT: v_bfe_u32 v7, v5, 16, 1
8412 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v5
8413 ; GFX908-NEXT: v_add3_u32 v7, v7, v5, s6
8414 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
8415 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc
8416 ; GFX908-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8417 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
8418 ; GFX908-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
8419 ; GFX908-NEXT: s_waitcnt vmcnt(0)
8420 ; GFX908-NEXT: buffer_wbinvl1
8421 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
8422 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8423 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
8424 ; GFX908-NEXT: s_cbranch_execnz .LBB34_1
8425 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
8426 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
8427 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
8428 ; GFX908-NEXT: s_setpc_b64 s[30:31]
8430 ; GFX8-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_neg:
8432 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8433 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
8434 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
8435 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
8436 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
8437 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
8438 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8439 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
8440 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
8441 ; GFX8-NEXT: v_not_b32_e32 v4, v4
8442 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
8443 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8444 ; GFX8-NEXT: .LBB34_1: ; %atomicrmw.start
8445 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
8446 ; GFX8-NEXT: s_waitcnt vmcnt(0)
8447 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
8448 ; GFX8-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8449 ; GFX8-NEXT: v_max_f32_e32 v5, v5, v2
8450 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
8451 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
8452 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
8453 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
8454 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
8455 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
8456 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
8457 ; GFX8-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8458 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
8459 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
8460 ; GFX8-NEXT: s_waitcnt vmcnt(0)
8461 ; GFX8-NEXT: buffer_wbinvl1
8462 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
8463 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8464 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
8465 ; GFX8-NEXT: s_cbranch_execnz .LBB34_1
8466 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
8467 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
8468 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
8469 ; GFX8-NEXT: s_setpc_b64 s[30:31]
8471 ; GFX7-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_neg:
8473 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8474 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
8475 ; GFX7-NEXT: s_mov_b32 s6, 0
8476 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
8477 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
8478 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
8479 ; GFX7-NEXT: s_mov_b32 s4, s6
8480 ; GFX7-NEXT: s_mov_b32 s5, s6
8481 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
8482 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
8483 ; GFX7-NEXT: v_lshlrev_b32_e32 v6, 3, v4
8484 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v6
8485 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
8486 ; GFX7-NEXT: v_not_b32_e32 v7, v4
8487 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
8488 ; GFX7-NEXT: v_and_b32_e32 v8, 0xffff0000, v2
8489 ; GFX7-NEXT: .LBB34_1: ; %atomicrmw.start
8490 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
8491 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8492 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v6, v3
8493 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8494 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
8495 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v8
8496 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
8497 ; GFX7-NEXT: v_and_b32_e32 v4, v3, v7
8498 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v6, v2
8499 ; GFX7-NEXT: v_or_b32_e32 v2, v4, v2
8500 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
8501 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
8502 ; GFX7-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
8503 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8504 ; GFX7-NEXT: buffer_wbinvl1
8505 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
8506 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
8507 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
8508 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
8509 ; GFX7-NEXT: s_cbranch_execnz .LBB34_1
8510 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
8511 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
8512 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v6, v4
8513 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
8514 ; GFX7-NEXT: s_setpc_b64 s[30:31]
8516 ; GFX6-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_neg:
8518 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8519 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
8520 ; GFX6-NEXT: s_mov_b32 s6, 0
8521 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
8522 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
8523 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
8524 ; GFX6-NEXT: s_mov_b32 s4, s6
8525 ; GFX6-NEXT: s_mov_b32 s5, s6
8526 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
8527 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
8528 ; GFX6-NEXT: v_lshlrev_b32_e32 v6, 3, v4
8529 ; GFX6-NEXT: v_lshl_b32_e32 v4, 0xffff, v6
8530 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
8531 ; GFX6-NEXT: v_not_b32_e32 v7, v4
8532 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
8533 ; GFX6-NEXT: v_and_b32_e32 v8, 0xffff0000, v2
8534 ; GFX6-NEXT: .LBB34_1: ; %atomicrmw.start
8535 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
8536 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8537 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v6, v3
8538 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8539 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
8540 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v8
8541 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
8542 ; GFX6-NEXT: s_waitcnt expcnt(0)
8543 ; GFX6-NEXT: v_and_b32_e32 v4, v3, v7
8544 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v6, v2
8545 ; GFX6-NEXT: v_or_b32_e32 v2, v4, v2
8546 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
8547 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
8548 ; GFX6-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
8549 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8550 ; GFX6-NEXT: buffer_wbinvl1
8551 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
8552 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
8553 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
8554 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
8555 ; GFX6-NEXT: s_cbranch_execnz .LBB34_1
8556 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
8557 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
8558 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v6, v4
8559 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v0
8560 ; GFX6-NEXT: s_waitcnt expcnt(0)
8561 ; GFX6-NEXT: s_setpc_b64 s[30:31]
8562 %gep = getelementptr bfloat, ptr addrspace(1) %ptr, i64 -1024
8563 %result = atomicrmw fmax ptr addrspace(1) %gep, bfloat %val syncscope("agent") seq_cst
8567 define void @global_agent_atomic_fmax_noret_bf16(ptr addrspace(1) %ptr, bfloat %val) #0 {
8568 ; GFX12-LABEL: global_agent_atomic_fmax_noret_bf16:
8570 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8571 ; GFX12-NEXT: s_wait_expcnt 0x0
8572 ; GFX12-NEXT: s_wait_samplecnt 0x0
8573 ; GFX12-NEXT: s_wait_bvhcnt 0x0
8574 ; GFX12-NEXT: s_wait_kmcnt 0x0
8575 ; GFX12-NEXT: v_dual_mov_b32 v3, v0 :: v_dual_lshlrev_b32 v2, 16, v2
8576 ; GFX12-NEXT: s_mov_b32 s0, 0
8577 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
8578 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
8579 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
8580 ; GFX12-NEXT: global_load_b32 v4, v[0:1], off
8581 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8582 ; GFX12-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8583 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
8584 ; GFX12-NEXT: v_not_b32_e32 v6, v3
8585 ; GFX12-NEXT: .LBB35_1: ; %atomicrmw.start
8586 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
8587 ; GFX12-NEXT: s_wait_loadcnt 0x0
8588 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8589 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8590 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v3
8591 ; GFX12-NEXT: v_max_num_f32_e32 v3, v3, v2
8592 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
8593 ; GFX12-NEXT: v_bfe_u32 v7, v3, 16, 1
8594 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v3
8595 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
8596 ; GFX12-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
8597 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8598 ; GFX12-NEXT: v_cndmask_b32_e32 v3, v7, v8, vcc_lo
8599 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, 16, v3
8600 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8601 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8602 ; GFX12-NEXT: v_and_or_b32 v3, v4, v6, v3
8603 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
8604 ; GFX12-NEXT: s_wait_storecnt 0x0
8605 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
8606 ; GFX12-NEXT: s_wait_loadcnt 0x0
8607 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
8608 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8609 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
8610 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
8611 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8612 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8613 ; GFX12-NEXT: s_cbranch_execnz .LBB35_1
8614 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
8615 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
8616 ; GFX12-NEXT: s_setpc_b64 s[30:31]
8618 ; GFX940-LABEL: global_agent_atomic_fmax_noret_bf16:
8620 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8621 ; GFX940-NEXT: v_mov_b32_e32 v3, v0
8622 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v3
8623 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
8624 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v3
8625 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8626 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
8627 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
8628 ; GFX940-NEXT: v_not_b32_e32 v6, v4
8629 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
8630 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8631 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
8632 ; GFX940-NEXT: .LBB35_1: ; %atomicrmw.start
8633 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
8634 ; GFX940-NEXT: s_waitcnt vmcnt(0)
8635 ; GFX940-NEXT: v_lshrrev_b32_sdwa v4, v3, v5 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8636 ; GFX940-NEXT: s_nop 0
8637 ; GFX940-NEXT: v_max_f32_e32 v4, v4, v2
8638 ; GFX940-NEXT: v_bfe_u32 v7, v4, 16, 1
8639 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v4
8640 ; GFX940-NEXT: v_add3_u32 v7, v7, v4, s2
8641 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
8642 ; GFX940-NEXT: s_nop 1
8643 ; GFX940-NEXT: v_cndmask_b32_e32 v4, v7, v8, vcc
8644 ; GFX940-NEXT: v_lshlrev_b32_sdwa v4, v3, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8645 ; GFX940-NEXT: v_and_or_b32 v4, v5, v6, v4
8646 ; GFX940-NEXT: buffer_wbl2 sc1
8647 ; GFX940-NEXT: global_atomic_cmpswap v4, v[0:1], v[4:5], off sc0
8648 ; GFX940-NEXT: s_waitcnt vmcnt(0)
8649 ; GFX940-NEXT: buffer_inv sc1
8650 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
8651 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
8652 ; GFX940-NEXT: v_mov_b32_e32 v5, v4
8653 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
8654 ; GFX940-NEXT: s_cbranch_execnz .LBB35_1
8655 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
8656 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
8657 ; GFX940-NEXT: s_setpc_b64 s[30:31]
8659 ; GFX11-LABEL: global_agent_atomic_fmax_noret_bf16:
8661 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8662 ; GFX11-NEXT: v_dual_mov_b32 v3, v0 :: v_dual_lshlrev_b32 v2, 16, v2
8663 ; GFX11-NEXT: s_mov_b32 s0, 0
8664 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
8665 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
8666 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
8667 ; GFX11-NEXT: global_load_b32 v4, v[0:1], off
8668 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8669 ; GFX11-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8670 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
8671 ; GFX11-NEXT: v_not_b32_e32 v6, v3
8672 ; GFX11-NEXT: .p2align 6
8673 ; GFX11-NEXT: .LBB35_1: ; %atomicrmw.start
8674 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
8675 ; GFX11-NEXT: s_waitcnt vmcnt(0)
8676 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8677 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8678 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v3
8679 ; GFX11-NEXT: v_max_f32_e32 v3, v3, v2
8680 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
8681 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
8682 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v3
8683 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
8684 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
8685 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8686 ; GFX11-NEXT: v_cndmask_b32_e32 v3, v7, v8, vcc_lo
8687 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v3
8688 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8689 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8690 ; GFX11-NEXT: v_and_or_b32 v3, v4, v6, v3
8691 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
8692 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off glc
8693 ; GFX11-NEXT: s_waitcnt vmcnt(0)
8694 ; GFX11-NEXT: buffer_gl1_inv
8695 ; GFX11-NEXT: buffer_gl0_inv
8696 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8697 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
8698 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
8699 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8700 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8701 ; GFX11-NEXT: s_cbranch_execnz .LBB35_1
8702 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
8703 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
8704 ; GFX11-NEXT: s_setpc_b64 s[30:31]
8706 ; GFX10-LABEL: global_agent_atomic_fmax_noret_bf16:
8708 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8709 ; GFX10-NEXT: v_mov_b32_e32 v3, v0
8710 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8711 ; GFX10-NEXT: s_mov_b32 s4, 0
8712 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
8713 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
8714 ; GFX10-NEXT: global_load_dword v4, v[0:1], off
8715 ; GFX10-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8716 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8717 ; GFX10-NEXT: v_not_b32_e32 v6, v3
8718 ; GFX10-NEXT: .LBB35_1: ; %atomicrmw.start
8719 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
8720 ; GFX10-NEXT: s_waitcnt vmcnt(0)
8721 ; GFX10-NEXT: v_lshrrev_b32_sdwa v3, v5, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8722 ; GFX10-NEXT: v_max_f32_e32 v3, v3, v2
8723 ; GFX10-NEXT: v_bfe_u32 v7, v3, 16, 1
8724 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v3
8725 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
8726 ; GFX10-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
8727 ; GFX10-NEXT: v_cndmask_b32_e32 v3, v7, v8, vcc_lo
8728 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8729 ; GFX10-NEXT: v_and_or_b32 v3, v4, v6, v3
8730 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
8731 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off glc
8732 ; GFX10-NEXT: s_waitcnt vmcnt(0)
8733 ; GFX10-NEXT: buffer_gl1_inv
8734 ; GFX10-NEXT: buffer_gl0_inv
8735 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8736 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
8737 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
8738 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
8739 ; GFX10-NEXT: s_cbranch_execnz .LBB35_1
8740 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
8741 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
8742 ; GFX10-NEXT: s_setpc_b64 s[30:31]
8744 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_bf16:
8746 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8747 ; GFX90A-NEXT: v_mov_b32_e32 v3, v0
8748 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
8749 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
8750 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
8751 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8752 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
8753 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
8754 ; GFX90A-NEXT: v_not_b32_e32 v6, v4
8755 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
8756 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8757 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
8758 ; GFX90A-NEXT: .LBB35_1: ; %atomicrmw.start
8759 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
8760 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
8761 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v4, v3, v5 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8762 ; GFX90A-NEXT: v_max_f32_e32 v4, v4, v2
8763 ; GFX90A-NEXT: v_bfe_u32 v7, v4, 16, 1
8764 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v4
8765 ; GFX90A-NEXT: v_add3_u32 v7, v7, v4, s6
8766 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
8767 ; GFX90A-NEXT: v_cndmask_b32_e32 v4, v7, v8, vcc
8768 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v4, v3, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8769 ; GFX90A-NEXT: v_and_or_b32 v4, v5, v6, v4
8770 ; GFX90A-NEXT: global_atomic_cmpswap v4, v[0:1], v[4:5], off glc
8771 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
8772 ; GFX90A-NEXT: buffer_wbinvl1
8773 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
8774 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8775 ; GFX90A-NEXT: v_mov_b32_e32 v5, v4
8776 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
8777 ; GFX90A-NEXT: s_cbranch_execnz .LBB35_1
8778 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
8779 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
8780 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
8782 ; GFX908-LABEL: global_agent_atomic_fmax_noret_bf16:
8784 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8785 ; GFX908-NEXT: v_mov_b32_e32 v3, v0
8786 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
8787 ; GFX908-NEXT: global_load_dword v4, v[0:1], off
8788 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
8789 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8790 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
8791 ; GFX908-NEXT: v_lshlrev_b32_e64 v3, v5, s4
8792 ; GFX908-NEXT: v_not_b32_e32 v6, v3
8793 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
8794 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8795 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
8796 ; GFX908-NEXT: .LBB35_1: ; %atomicrmw.start
8797 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
8798 ; GFX908-NEXT: s_waitcnt vmcnt(0)
8799 ; GFX908-NEXT: v_lshrrev_b32_sdwa v3, v5, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8800 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
8801 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
8802 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
8803 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s6
8804 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
8805 ; GFX908-NEXT: v_cndmask_b32_e32 v3, v7, v8, vcc
8806 ; GFX908-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8807 ; GFX908-NEXT: v_and_or_b32 v3, v4, v6, v3
8808 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off glc
8809 ; GFX908-NEXT: s_waitcnt vmcnt(0)
8810 ; GFX908-NEXT: buffer_wbinvl1
8811 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8812 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8813 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
8814 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
8815 ; GFX908-NEXT: s_cbranch_execnz .LBB35_1
8816 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
8817 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
8818 ; GFX908-NEXT: s_setpc_b64 s[30:31]
8820 ; GFX8-LABEL: global_agent_atomic_fmax_noret_bf16:
8822 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8823 ; GFX8-NEXT: v_mov_b32_e32 v3, v0
8824 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
8825 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
8826 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
8827 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8828 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
8829 ; GFX8-NEXT: v_lshlrev_b32_e64 v3, v5, s4
8830 ; GFX8-NEXT: v_not_b32_e32 v6, v3
8831 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
8832 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8833 ; GFX8-NEXT: .LBB35_1: ; %atomicrmw.start
8834 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
8835 ; GFX8-NEXT: s_waitcnt vmcnt(0)
8836 ; GFX8-NEXT: v_lshrrev_b32_sdwa v3, v5, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
8837 ; GFX8-NEXT: v_max_f32_e32 v3, v3, v2
8838 ; GFX8-NEXT: v_bfe_u32 v8, v3, 16, 1
8839 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v3
8840 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
8841 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v3
8842 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
8843 ; GFX8-NEXT: v_cndmask_b32_e32 v3, v8, v9, vcc
8844 ; GFX8-NEXT: v_and_b32_e32 v7, v4, v6
8845 ; GFX8-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
8846 ; GFX8-NEXT: v_or_b32_e32 v3, v7, v3
8847 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8848 ; GFX8-NEXT: s_waitcnt vmcnt(0)
8849 ; GFX8-NEXT: buffer_wbinvl1
8850 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8851 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8852 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
8853 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
8854 ; GFX8-NEXT: s_cbranch_execnz .LBB35_1
8855 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
8856 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
8857 ; GFX8-NEXT: s_setpc_b64 s[30:31]
8859 ; GFX7-LABEL: global_agent_atomic_fmax_noret_bf16:
8861 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8862 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
8863 ; GFX7-NEXT: s_mov_b32 s6, 0
8864 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
8865 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
8866 ; GFX7-NEXT: s_mov_b32 s4, s6
8867 ; GFX7-NEXT: s_mov_b32 s5, s6
8868 ; GFX7-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
8869 ; GFX7-NEXT: v_and_b32_e32 v3, 3, v3
8870 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8871 ; GFX7-NEXT: v_lshl_b32_e32 v3, 0xffff, v5
8872 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
8873 ; GFX7-NEXT: v_not_b32_e32 v6, v3
8874 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
8875 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
8876 ; GFX7-NEXT: .LBB35_1: ; %atomicrmw.start
8877 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
8878 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8879 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8880 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
8881 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
8882 ; GFX7-NEXT: v_max_f32_e32 v3, v3, v2
8883 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v3
8884 ; GFX7-NEXT: v_and_b32_e32 v7, v4, v6
8885 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8886 ; GFX7-NEXT: v_or_b32_e32 v3, v7, v3
8887 ; GFX7-NEXT: v_mov_b32_e32 v8, v4
8888 ; GFX7-NEXT: v_mov_b32_e32 v7, v3
8889 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
8890 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8891 ; GFX7-NEXT: buffer_wbinvl1
8892 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v4
8893 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
8894 ; GFX7-NEXT: v_mov_b32_e32 v4, v7
8895 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
8896 ; GFX7-NEXT: s_cbranch_execnz .LBB35_1
8897 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
8898 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
8899 ; GFX7-NEXT: s_setpc_b64 s[30:31]
8901 ; GFX6-LABEL: global_agent_atomic_fmax_noret_bf16:
8903 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8904 ; GFX6-NEXT: v_mov_b32_e32 v3, v0
8905 ; GFX6-NEXT: s_mov_b32 s6, 0
8906 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v3
8907 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
8908 ; GFX6-NEXT: s_mov_b32 s4, s6
8909 ; GFX6-NEXT: s_mov_b32 s5, s6
8910 ; GFX6-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
8911 ; GFX6-NEXT: v_and_b32_e32 v3, 3, v3
8912 ; GFX6-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8913 ; GFX6-NEXT: v_lshl_b32_e32 v3, 0xffff, v5
8914 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
8915 ; GFX6-NEXT: v_not_b32_e32 v6, v3
8916 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
8917 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
8918 ; GFX6-NEXT: .LBB35_1: ; %atomicrmw.start
8919 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
8920 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8921 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8922 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
8923 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
8924 ; GFX6-NEXT: v_max_f32_e32 v3, v3, v2
8925 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v3
8926 ; GFX6-NEXT: s_waitcnt expcnt(0)
8927 ; GFX6-NEXT: v_and_b32_e32 v7, v4, v6
8928 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8929 ; GFX6-NEXT: v_or_b32_e32 v3, v7, v3
8930 ; GFX6-NEXT: v_mov_b32_e32 v8, v4
8931 ; GFX6-NEXT: v_mov_b32_e32 v7, v3
8932 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
8933 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8934 ; GFX6-NEXT: buffer_wbinvl1
8935 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v4
8936 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
8937 ; GFX6-NEXT: v_mov_b32_e32 v4, v7
8938 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
8939 ; GFX6-NEXT: s_cbranch_execnz .LBB35_1
8940 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
8941 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
8942 ; GFX6-NEXT: s_waitcnt expcnt(0)
8943 ; GFX6-NEXT: s_setpc_b64 s[30:31]
8944 %unused = atomicrmw fmax ptr addrspace(1) %ptr, bfloat %val syncscope("agent") seq_cst
8948 define void @global_agent_atomic_fmax_noret_bf16__offset12b_pos(ptr addrspace(1) %ptr, bfloat %val) #0 {
8949 ; GFX12-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_pos:
8951 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8952 ; GFX12-NEXT: s_wait_expcnt 0x0
8953 ; GFX12-NEXT: s_wait_samplecnt 0x0
8954 ; GFX12-NEXT: s_wait_bvhcnt 0x0
8955 ; GFX12-NEXT: s_wait_kmcnt 0x0
8956 ; GFX12-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
8957 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
8958 ; GFX12-NEXT: v_lshlrev_b32_e32 v6, 16, v2
8959 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
8960 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v4
8961 ; GFX12-NEXT: v_and_b32_e32 v4, 3, v4
8962 ; GFX12-NEXT: s_mov_b32 s0, 0
8963 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
8964 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 3, v4
8965 ; GFX12-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
8966 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
8967 ; GFX12-NEXT: v_not_b32_e32 v5, v5
8968 ; GFX12-NEXT: .LBB36_1: ; %atomicrmw.start
8969 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
8970 ; GFX12-NEXT: s_wait_loadcnt 0x0
8971 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, v4, v3
8972 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8973 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
8974 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v6
8975 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
8976 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
8977 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v2
8978 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
8979 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
8980 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8981 ; GFX12-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
8982 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, 16, v2
8983 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8984 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, v4, v2
8985 ; GFX12-NEXT: v_and_or_b32 v2, v3, v5, v2
8986 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
8987 ; GFX12-NEXT: s_wait_storecnt 0x0
8988 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
8989 ; GFX12-NEXT: s_wait_loadcnt 0x0
8990 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
8991 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
8992 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
8993 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
8994 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8995 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8996 ; GFX12-NEXT: s_cbranch_execnz .LBB36_1
8997 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
8998 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
8999 ; GFX12-NEXT: s_setpc_b64 s[30:31]
9001 ; GFX940-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_pos:
9003 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9004 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
9005 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
9006 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
9007 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
9008 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
9009 ; GFX940-NEXT: v_and_b32_e32 v4, 3, v4
9010 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9011 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
9012 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v4, s0
9013 ; GFX940-NEXT: v_not_b32_e32 v5, v5
9014 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
9015 ; GFX940-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9016 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
9017 ; GFX940-NEXT: .LBB36_1: ; %atomicrmw.start
9018 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
9019 ; GFX940-NEXT: s_waitcnt vmcnt(0)
9020 ; GFX940-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9021 ; GFX940-NEXT: s_nop 0
9022 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v6
9023 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
9024 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
9025 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s2
9026 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
9027 ; GFX940-NEXT: s_nop 1
9028 ; GFX940-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
9029 ; GFX940-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9030 ; GFX940-NEXT: v_and_or_b32 v2, v3, v5, v2
9031 ; GFX940-NEXT: buffer_wbl2 sc1
9032 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0
9033 ; GFX940-NEXT: s_waitcnt vmcnt(0)
9034 ; GFX940-NEXT: buffer_inv sc1
9035 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
9036 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
9037 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
9038 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
9039 ; GFX940-NEXT: s_cbranch_execnz .LBB36_1
9040 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
9041 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
9042 ; GFX940-NEXT: s_setpc_b64 s[30:31]
9044 ; GFX11-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_pos:
9046 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9047 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
9048 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
9049 ; GFX11-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9050 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
9051 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v4
9052 ; GFX11-NEXT: v_and_b32_e32 v4, 3, v4
9053 ; GFX11-NEXT: s_mov_b32 s0, 0
9054 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
9055 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9056 ; GFX11-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
9057 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
9058 ; GFX11-NEXT: v_not_b32_e32 v5, v5
9059 ; GFX11-NEXT: .p2align 6
9060 ; GFX11-NEXT: .LBB36_1: ; %atomicrmw.start
9061 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
9062 ; GFX11-NEXT: s_waitcnt vmcnt(0)
9063 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, v4, v3
9064 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9065 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9066 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v6
9067 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
9068 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
9069 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v2
9070 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
9071 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
9072 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9073 ; GFX11-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
9074 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, 16, v2
9075 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9076 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, v4, v2
9077 ; GFX11-NEXT: v_and_or_b32 v2, v3, v5, v2
9078 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
9079 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
9080 ; GFX11-NEXT: s_waitcnt vmcnt(0)
9081 ; GFX11-NEXT: buffer_gl1_inv
9082 ; GFX11-NEXT: buffer_gl0_inv
9083 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
9084 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
9085 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
9086 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9087 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9088 ; GFX11-NEXT: s_cbranch_execnz .LBB36_1
9089 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
9090 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
9091 ; GFX11-NEXT: s_setpc_b64 s[30:31]
9093 ; GFX10-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_pos:
9095 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9096 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
9097 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
9098 ; GFX10-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9099 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v4
9100 ; GFX10-NEXT: v_and_b32_e32 v4, 3, v4
9101 ; GFX10-NEXT: s_mov_b32 s4, 0
9102 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
9103 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9104 ; GFX10-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
9105 ; GFX10-NEXT: v_not_b32_e32 v5, v5
9106 ; GFX10-NEXT: .LBB36_1: ; %atomicrmw.start
9107 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
9108 ; GFX10-NEXT: s_waitcnt vmcnt(0)
9109 ; GFX10-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9110 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v6
9111 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
9112 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v2
9113 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
9114 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
9115 ; GFX10-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
9116 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9117 ; GFX10-NEXT: v_and_or_b32 v2, v3, v5, v2
9118 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
9119 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
9120 ; GFX10-NEXT: s_waitcnt vmcnt(0)
9121 ; GFX10-NEXT: buffer_gl1_inv
9122 ; GFX10-NEXT: buffer_gl0_inv
9123 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
9124 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
9125 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
9126 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
9127 ; GFX10-NEXT: s_cbranch_execnz .LBB36_1
9128 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
9129 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
9130 ; GFX10-NEXT: s_setpc_b64 s[30:31]
9132 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_pos:
9134 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9135 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
9136 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
9137 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v4
9138 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
9139 ; GFX90A-NEXT: v_and_b32_e32 v4, 3, v4
9140 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9141 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
9142 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v4, s4
9143 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
9144 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
9145 ; GFX90A-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9146 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
9147 ; GFX90A-NEXT: .LBB36_1: ; %atomicrmw.start
9148 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
9149 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
9150 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9151 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v6
9152 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
9153 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
9154 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s6
9155 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
9156 ; GFX90A-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
9157 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9158 ; GFX90A-NEXT: v_and_or_b32 v2, v3, v5, v2
9159 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
9160 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
9161 ; GFX90A-NEXT: buffer_wbinvl1
9162 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
9163 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9164 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
9165 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
9166 ; GFX90A-NEXT: s_cbranch_execnz .LBB36_1
9167 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
9168 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
9169 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
9171 ; GFX908-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_pos:
9173 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9174 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
9175 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
9176 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v4
9177 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
9178 ; GFX908-NEXT: v_and_b32_e32 v4, 3, v4
9179 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9180 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
9181 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v4, s4
9182 ; GFX908-NEXT: v_not_b32_e32 v5, v5
9183 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
9184 ; GFX908-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9185 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
9186 ; GFX908-NEXT: .LBB36_1: ; %atomicrmw.start
9187 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
9188 ; GFX908-NEXT: s_waitcnt vmcnt(0)
9189 ; GFX908-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9190 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v6
9191 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
9192 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
9193 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s6
9194 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
9195 ; GFX908-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
9196 ; GFX908-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9197 ; GFX908-NEXT: v_and_or_b32 v2, v3, v5, v2
9198 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
9199 ; GFX908-NEXT: s_waitcnt vmcnt(0)
9200 ; GFX908-NEXT: buffer_wbinvl1
9201 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
9202 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9203 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
9204 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
9205 ; GFX908-NEXT: s_cbranch_execnz .LBB36_1
9206 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
9207 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
9208 ; GFX908-NEXT: s_setpc_b64 s[30:31]
9210 ; GFX8-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_pos:
9212 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9213 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7fe, v0
9214 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
9215 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v4
9216 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
9217 ; GFX8-NEXT: v_and_b32_e32 v4, 3, v4
9218 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9219 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
9220 ; GFX8-NEXT: v_lshlrev_b32_e64 v5, v4, s4
9221 ; GFX8-NEXT: v_not_b32_e32 v5, v5
9222 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
9223 ; GFX8-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9224 ; GFX8-NEXT: .LBB36_1: ; %atomicrmw.start
9225 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
9226 ; GFX8-NEXT: s_waitcnt vmcnt(0)
9227 ; GFX8-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9228 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v6
9229 ; GFX8-NEXT: v_bfe_u32 v8, v2, 16, 1
9230 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v2
9231 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
9232 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v2
9233 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
9234 ; GFX8-NEXT: v_cndmask_b32_e32 v2, v8, v9, vcc
9235 ; GFX8-NEXT: v_and_b32_e32 v7, v3, v5
9236 ; GFX8-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9237 ; GFX8-NEXT: v_or_b32_e32 v2, v7, v2
9238 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
9239 ; GFX8-NEXT: s_waitcnt vmcnt(0)
9240 ; GFX8-NEXT: buffer_wbinvl1
9241 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
9242 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9243 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
9244 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
9245 ; GFX8-NEXT: s_cbranch_execnz .LBB36_1
9246 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
9247 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
9248 ; GFX8-NEXT: s_setpc_b64 s[30:31]
9250 ; GFX7-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_pos:
9252 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9253 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
9254 ; GFX7-NEXT: s_mov_b32 s6, 0
9255 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
9256 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
9257 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
9258 ; GFX7-NEXT: s_mov_b32 s4, s6
9259 ; GFX7-NEXT: s_mov_b32 s5, s6
9260 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
9261 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
9262 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9263 ; GFX7-NEXT: v_lshl_b32_e32 v5, 0xffff, v4
9264 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
9265 ; GFX7-NEXT: v_not_b32_e32 v5, v5
9266 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
9267 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
9268 ; GFX7-NEXT: .LBB36_1: ; %atomicrmw.start
9269 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
9270 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9271 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
9272 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9273 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
9274 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v6
9275 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
9276 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v5
9277 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
9278 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
9279 ; GFX7-NEXT: v_mov_b32_e32 v8, v3
9280 ; GFX7-NEXT: v_mov_b32_e32 v7, v2
9281 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
9282 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9283 ; GFX7-NEXT: buffer_wbinvl1
9284 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
9285 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
9286 ; GFX7-NEXT: v_mov_b32_e32 v3, v7
9287 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
9288 ; GFX7-NEXT: s_cbranch_execnz .LBB36_1
9289 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
9290 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
9291 ; GFX7-NEXT: s_setpc_b64 s[30:31]
9293 ; GFX6-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_pos:
9295 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9296 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
9297 ; GFX6-NEXT: s_mov_b32 s6, 0
9298 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
9299 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
9300 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
9301 ; GFX6-NEXT: s_mov_b32 s4, s6
9302 ; GFX6-NEXT: s_mov_b32 s5, s6
9303 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
9304 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
9305 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9306 ; GFX6-NEXT: v_lshl_b32_e32 v5, 0xffff, v4
9307 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
9308 ; GFX6-NEXT: v_not_b32_e32 v5, v5
9309 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
9310 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
9311 ; GFX6-NEXT: .LBB36_1: ; %atomicrmw.start
9312 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
9313 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9314 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v4, v3
9315 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9316 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
9317 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v6
9318 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
9319 ; GFX6-NEXT: s_waitcnt expcnt(0)
9320 ; GFX6-NEXT: v_and_b32_e32 v7, v3, v5
9321 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v4, v2
9322 ; GFX6-NEXT: v_or_b32_e32 v2, v7, v2
9323 ; GFX6-NEXT: v_mov_b32_e32 v8, v3
9324 ; GFX6-NEXT: v_mov_b32_e32 v7, v2
9325 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
9326 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9327 ; GFX6-NEXT: buffer_wbinvl1
9328 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
9329 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
9330 ; GFX6-NEXT: v_mov_b32_e32 v3, v7
9331 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
9332 ; GFX6-NEXT: s_cbranch_execnz .LBB36_1
9333 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
9334 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
9335 ; GFX6-NEXT: s_waitcnt expcnt(0)
9336 ; GFX6-NEXT: s_setpc_b64 s[30:31]
9337 %gep = getelementptr bfloat, ptr addrspace(1) %ptr, i64 1023
9338 %unused = atomicrmw fmax ptr addrspace(1) %gep, bfloat %val syncscope("agent") seq_cst
9342 define void @global_agent_atomic_fmax_noret_bf16__offset12b_neg(ptr addrspace(1) %ptr, bfloat %val) #0 {
9343 ; GFX12-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_neg:
9345 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9346 ; GFX12-NEXT: s_wait_expcnt 0x0
9347 ; GFX12-NEXT: s_wait_samplecnt 0x0
9348 ; GFX12-NEXT: s_wait_bvhcnt 0x0
9349 ; GFX12-NEXT: s_wait_kmcnt 0x0
9350 ; GFX12-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
9351 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
9352 ; GFX12-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9353 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
9354 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v4
9355 ; GFX12-NEXT: v_and_b32_e32 v4, 3, v4
9356 ; GFX12-NEXT: s_mov_b32 s0, 0
9357 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
9358 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9359 ; GFX12-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
9360 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
9361 ; GFX12-NEXT: v_not_b32_e32 v5, v5
9362 ; GFX12-NEXT: .LBB37_1: ; %atomicrmw.start
9363 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
9364 ; GFX12-NEXT: s_wait_loadcnt 0x0
9365 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, v4, v3
9366 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9367 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9368 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v6
9369 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
9370 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
9371 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v2
9372 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
9373 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
9374 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9375 ; GFX12-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
9376 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, 16, v2
9377 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9378 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, v4, v2
9379 ; GFX12-NEXT: v_and_or_b32 v2, v3, v5, v2
9380 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
9381 ; GFX12-NEXT: s_wait_storecnt 0x0
9382 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
9383 ; GFX12-NEXT: s_wait_loadcnt 0x0
9384 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
9385 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
9386 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
9387 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
9388 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9389 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9390 ; GFX12-NEXT: s_cbranch_execnz .LBB37_1
9391 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
9392 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
9393 ; GFX12-NEXT: s_setpc_b64 s[30:31]
9395 ; GFX940-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_neg:
9397 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9398 ; GFX940-NEXT: s_movk_i32 s0, 0xf800
9399 ; GFX940-NEXT: s_mov_b32 s1, -1
9400 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
9401 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
9402 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
9403 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
9404 ; GFX940-NEXT: v_and_b32_e32 v4, 3, v4
9405 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9406 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
9407 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v4, s0
9408 ; GFX940-NEXT: v_not_b32_e32 v5, v5
9409 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
9410 ; GFX940-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9411 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
9412 ; GFX940-NEXT: .LBB37_1: ; %atomicrmw.start
9413 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
9414 ; GFX940-NEXT: s_waitcnt vmcnt(0)
9415 ; GFX940-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9416 ; GFX940-NEXT: s_nop 0
9417 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v6
9418 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
9419 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
9420 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s2
9421 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
9422 ; GFX940-NEXT: s_nop 1
9423 ; GFX940-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
9424 ; GFX940-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9425 ; GFX940-NEXT: v_and_or_b32 v2, v3, v5, v2
9426 ; GFX940-NEXT: buffer_wbl2 sc1
9427 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0
9428 ; GFX940-NEXT: s_waitcnt vmcnt(0)
9429 ; GFX940-NEXT: buffer_inv sc1
9430 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
9431 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
9432 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
9433 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
9434 ; GFX940-NEXT: s_cbranch_execnz .LBB37_1
9435 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
9436 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
9437 ; GFX940-NEXT: s_setpc_b64 s[30:31]
9439 ; GFX11-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_neg:
9441 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9442 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
9443 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
9444 ; GFX11-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9445 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
9446 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v4
9447 ; GFX11-NEXT: v_and_b32_e32 v4, 3, v4
9448 ; GFX11-NEXT: s_mov_b32 s0, 0
9449 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
9450 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9451 ; GFX11-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
9452 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
9453 ; GFX11-NEXT: v_not_b32_e32 v5, v5
9454 ; GFX11-NEXT: .p2align 6
9455 ; GFX11-NEXT: .LBB37_1: ; %atomicrmw.start
9456 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
9457 ; GFX11-NEXT: s_waitcnt vmcnt(0)
9458 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, v4, v3
9459 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9460 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9461 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v6
9462 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
9463 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
9464 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v2
9465 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
9466 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
9467 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9468 ; GFX11-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
9469 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, 16, v2
9470 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9471 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, v4, v2
9472 ; GFX11-NEXT: v_and_or_b32 v2, v3, v5, v2
9473 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
9474 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
9475 ; GFX11-NEXT: s_waitcnt vmcnt(0)
9476 ; GFX11-NEXT: buffer_gl1_inv
9477 ; GFX11-NEXT: buffer_gl0_inv
9478 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
9479 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
9480 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
9481 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9482 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9483 ; GFX11-NEXT: s_cbranch_execnz .LBB37_1
9484 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
9485 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
9486 ; GFX11-NEXT: s_setpc_b64 s[30:31]
9488 ; GFX10-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_neg:
9490 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9491 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
9492 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
9493 ; GFX10-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9494 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v4
9495 ; GFX10-NEXT: v_and_b32_e32 v4, 3, v4
9496 ; GFX10-NEXT: s_mov_b32 s4, 0
9497 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
9498 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9499 ; GFX10-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
9500 ; GFX10-NEXT: v_not_b32_e32 v5, v5
9501 ; GFX10-NEXT: .LBB37_1: ; %atomicrmw.start
9502 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
9503 ; GFX10-NEXT: s_waitcnt vmcnt(0)
9504 ; GFX10-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9505 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v6
9506 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
9507 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v2
9508 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
9509 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
9510 ; GFX10-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
9511 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9512 ; GFX10-NEXT: v_and_or_b32 v2, v3, v5, v2
9513 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
9514 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
9515 ; GFX10-NEXT: s_waitcnt vmcnt(0)
9516 ; GFX10-NEXT: buffer_gl1_inv
9517 ; GFX10-NEXT: buffer_gl0_inv
9518 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
9519 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
9520 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
9521 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
9522 ; GFX10-NEXT: s_cbranch_execnz .LBB37_1
9523 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
9524 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
9525 ; GFX10-NEXT: s_setpc_b64 s[30:31]
9527 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_neg:
9529 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9530 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
9531 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
9532 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v4
9533 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
9534 ; GFX90A-NEXT: v_and_b32_e32 v4, 3, v4
9535 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9536 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
9537 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v4, s4
9538 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
9539 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
9540 ; GFX90A-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9541 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
9542 ; GFX90A-NEXT: .LBB37_1: ; %atomicrmw.start
9543 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
9544 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
9545 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9546 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v6
9547 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
9548 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
9549 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s6
9550 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
9551 ; GFX90A-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
9552 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9553 ; GFX90A-NEXT: v_and_or_b32 v2, v3, v5, v2
9554 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
9555 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
9556 ; GFX90A-NEXT: buffer_wbinvl1
9557 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
9558 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9559 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
9560 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
9561 ; GFX90A-NEXT: s_cbranch_execnz .LBB37_1
9562 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
9563 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
9564 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
9566 ; GFX908-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_neg:
9568 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9569 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
9570 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
9571 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v4
9572 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
9573 ; GFX908-NEXT: v_and_b32_e32 v4, 3, v4
9574 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9575 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
9576 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v4, s4
9577 ; GFX908-NEXT: v_not_b32_e32 v5, v5
9578 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
9579 ; GFX908-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9580 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
9581 ; GFX908-NEXT: .LBB37_1: ; %atomicrmw.start
9582 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
9583 ; GFX908-NEXT: s_waitcnt vmcnt(0)
9584 ; GFX908-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9585 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v6
9586 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
9587 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
9588 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s6
9589 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
9590 ; GFX908-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
9591 ; GFX908-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9592 ; GFX908-NEXT: v_and_or_b32 v2, v3, v5, v2
9593 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
9594 ; GFX908-NEXT: s_waitcnt vmcnt(0)
9595 ; GFX908-NEXT: buffer_wbinvl1
9596 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
9597 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9598 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
9599 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
9600 ; GFX908-NEXT: s_cbranch_execnz .LBB37_1
9601 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
9602 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
9603 ; GFX908-NEXT: s_setpc_b64 s[30:31]
9605 ; GFX8-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_neg:
9607 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9608 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0xfffff800, v0
9609 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
9610 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v4
9611 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
9612 ; GFX8-NEXT: v_and_b32_e32 v4, 3, v4
9613 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9614 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
9615 ; GFX8-NEXT: v_lshlrev_b32_e64 v5, v4, s4
9616 ; GFX8-NEXT: v_not_b32_e32 v5, v5
9617 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
9618 ; GFX8-NEXT: v_lshlrev_b32_e32 v6, 16, v2
9619 ; GFX8-NEXT: .LBB37_1: ; %atomicrmw.start
9620 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
9621 ; GFX8-NEXT: s_waitcnt vmcnt(0)
9622 ; GFX8-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9623 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v6
9624 ; GFX8-NEXT: v_bfe_u32 v8, v2, 16, 1
9625 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v2
9626 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
9627 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v2
9628 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
9629 ; GFX8-NEXT: v_cndmask_b32_e32 v2, v8, v9, vcc
9630 ; GFX8-NEXT: v_and_b32_e32 v7, v3, v5
9631 ; GFX8-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9632 ; GFX8-NEXT: v_or_b32_e32 v2, v7, v2
9633 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
9634 ; GFX8-NEXT: s_waitcnt vmcnt(0)
9635 ; GFX8-NEXT: buffer_wbinvl1
9636 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
9637 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9638 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
9639 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
9640 ; GFX8-NEXT: s_cbranch_execnz .LBB37_1
9641 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
9642 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
9643 ; GFX8-NEXT: s_setpc_b64 s[30:31]
9645 ; GFX7-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_neg:
9647 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9648 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
9649 ; GFX7-NEXT: s_mov_b32 s6, 0
9650 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
9651 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
9652 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
9653 ; GFX7-NEXT: s_mov_b32 s4, s6
9654 ; GFX7-NEXT: s_mov_b32 s5, s6
9655 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
9656 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
9657 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9658 ; GFX7-NEXT: v_lshl_b32_e32 v5, 0xffff, v4
9659 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
9660 ; GFX7-NEXT: v_not_b32_e32 v5, v5
9661 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
9662 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
9663 ; GFX7-NEXT: .LBB37_1: ; %atomicrmw.start
9664 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
9665 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9666 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
9667 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9668 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
9669 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v6
9670 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
9671 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v5
9672 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
9673 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
9674 ; GFX7-NEXT: v_mov_b32_e32 v8, v3
9675 ; GFX7-NEXT: v_mov_b32_e32 v7, v2
9676 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
9677 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9678 ; GFX7-NEXT: buffer_wbinvl1
9679 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
9680 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
9681 ; GFX7-NEXT: v_mov_b32_e32 v3, v7
9682 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
9683 ; GFX7-NEXT: s_cbranch_execnz .LBB37_1
9684 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
9685 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
9686 ; GFX7-NEXT: s_setpc_b64 s[30:31]
9688 ; GFX6-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b_neg:
9690 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9691 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
9692 ; GFX6-NEXT: s_mov_b32 s6, 0
9693 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
9694 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
9695 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
9696 ; GFX6-NEXT: s_mov_b32 s4, s6
9697 ; GFX6-NEXT: s_mov_b32 s5, s6
9698 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
9699 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
9700 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9701 ; GFX6-NEXT: v_lshl_b32_e32 v5, 0xffff, v4
9702 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
9703 ; GFX6-NEXT: v_not_b32_e32 v5, v5
9704 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
9705 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
9706 ; GFX6-NEXT: .LBB37_1: ; %atomicrmw.start
9707 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
9708 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9709 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v4, v3
9710 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9711 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
9712 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v6
9713 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
9714 ; GFX6-NEXT: s_waitcnt expcnt(0)
9715 ; GFX6-NEXT: v_and_b32_e32 v7, v3, v5
9716 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v4, v2
9717 ; GFX6-NEXT: v_or_b32_e32 v2, v7, v2
9718 ; GFX6-NEXT: v_mov_b32_e32 v8, v3
9719 ; GFX6-NEXT: v_mov_b32_e32 v7, v2
9720 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
9721 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9722 ; GFX6-NEXT: buffer_wbinvl1
9723 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
9724 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
9725 ; GFX6-NEXT: v_mov_b32_e32 v3, v7
9726 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
9727 ; GFX6-NEXT: s_cbranch_execnz .LBB37_1
9728 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
9729 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
9730 ; GFX6-NEXT: s_waitcnt expcnt(0)
9731 ; GFX6-NEXT: s_setpc_b64 s[30:31]
9732 %gep = getelementptr bfloat, ptr addrspace(1) %ptr, i64 -1024
9733 %unused = atomicrmw fmax ptr addrspace(1) %gep, bfloat %val syncscope("agent") seq_cst
9737 define bfloat @global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4(ptr addrspace(1) %ptr, bfloat %val) #0 {
9738 ; GFX12-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4:
9740 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9741 ; GFX12-NEXT: s_wait_expcnt 0x0
9742 ; GFX12-NEXT: s_wait_samplecnt 0x0
9743 ; GFX12-NEXT: s_wait_bvhcnt 0x0
9744 ; GFX12-NEXT: s_wait_kmcnt 0x0
9745 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2046
9746 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9747 ; GFX12-NEXT: s_mov_b32 s0, 0
9748 ; GFX12-NEXT: .LBB38_1: ; %atomicrmw.start
9749 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
9750 ; GFX12-NEXT: s_wait_loadcnt 0x0
9751 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
9752 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9753 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v4
9754 ; GFX12-NEXT: v_max_num_f32_e32 v3, v3, v2
9755 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
9756 ; GFX12-NEXT: v_bfe_u32 v5, v3, 16, 1
9757 ; GFX12-NEXT: v_or_b32_e32 v6, 0x400000, v3
9758 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
9759 ; GFX12-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
9760 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9761 ; GFX12-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
9762 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, 16, v3
9763 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
9764 ; GFX12-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
9765 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
9766 ; GFX12-NEXT: s_wait_storecnt 0x0
9767 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2046 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
9768 ; GFX12-NEXT: s_wait_loadcnt 0x0
9769 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
9770 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
9771 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
9772 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9773 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9774 ; GFX12-NEXT: s_cbranch_execnz .LBB38_1
9775 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
9776 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
9777 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
9778 ; GFX12-NEXT: s_setpc_b64 s[30:31]
9780 ; GFX940-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4:
9782 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9783 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2046
9784 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
9785 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9786 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
9787 ; GFX940-NEXT: s_mov_b32 s3, 0xffff0000
9788 ; GFX940-NEXT: .LBB38_1: ; %atomicrmw.start
9789 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
9790 ; GFX940-NEXT: s_waitcnt vmcnt(0)
9791 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
9792 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 16, v5
9793 ; GFX940-NEXT: v_max_f32_e32 v3, v3, v2
9794 ; GFX940-NEXT: v_bfe_u32 v4, v3, 16, 1
9795 ; GFX940-NEXT: v_or_b32_e32 v6, 0x400000, v3
9796 ; GFX940-NEXT: v_add3_u32 v4, v4, v3, s2
9797 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
9798 ; GFX940-NEXT: s_nop 1
9799 ; GFX940-NEXT: v_cndmask_b32_e32 v3, v4, v6, vcc
9800 ; GFX940-NEXT: v_lshrrev_b32_e32 v3, 16, v3
9801 ; GFX940-NEXT: v_and_or_b32 v4, v5, s3, v3
9802 ; GFX940-NEXT: buffer_wbl2 sc1
9803 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2046 sc0
9804 ; GFX940-NEXT: s_waitcnt vmcnt(0)
9805 ; GFX940-NEXT: buffer_inv sc1
9806 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
9807 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
9808 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
9809 ; GFX940-NEXT: s_cbranch_execnz .LBB38_1
9810 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
9811 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
9812 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
9813 ; GFX940-NEXT: s_setpc_b64 s[30:31]
9815 ; GFX11-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4:
9817 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9818 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2046
9819 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9820 ; GFX11-NEXT: s_mov_b32 s0, 0
9821 ; GFX11-NEXT: .p2align 6
9822 ; GFX11-NEXT: .LBB38_1: ; %atomicrmw.start
9823 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
9824 ; GFX11-NEXT: s_waitcnt vmcnt(0)
9825 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
9826 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9827 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v4
9828 ; GFX11-NEXT: v_max_f32_e32 v3, v3, v2
9829 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
9830 ; GFX11-NEXT: v_bfe_u32 v5, v3, 16, 1
9831 ; GFX11-NEXT: v_or_b32_e32 v6, 0x400000, v3
9832 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
9833 ; GFX11-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
9834 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9835 ; GFX11-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
9836 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v3
9837 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
9838 ; GFX11-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
9839 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
9840 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2046 glc
9841 ; GFX11-NEXT: s_waitcnt vmcnt(0)
9842 ; GFX11-NEXT: buffer_gl1_inv
9843 ; GFX11-NEXT: buffer_gl0_inv
9844 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
9845 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
9846 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9847 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9848 ; GFX11-NEXT: s_cbranch_execnz .LBB38_1
9849 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
9850 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
9851 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
9852 ; GFX11-NEXT: s_setpc_b64 s[30:31]
9854 ; GFX10-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4:
9856 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9857 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2046
9858 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9859 ; GFX10-NEXT: s_mov_b32 s4, 0
9860 ; GFX10-NEXT: .LBB38_1: ; %atomicrmw.start
9861 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
9862 ; GFX10-NEXT: s_waitcnt vmcnt(0)
9863 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
9864 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v4
9865 ; GFX10-NEXT: v_max_f32_e32 v3, v3, v2
9866 ; GFX10-NEXT: v_bfe_u32 v5, v3, 16, 1
9867 ; GFX10-NEXT: v_or_b32_e32 v6, 0x400000, v3
9868 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
9869 ; GFX10-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
9870 ; GFX10-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
9871 ; GFX10-NEXT: v_lshrrev_b32_e32 v3, 16, v3
9872 ; GFX10-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
9873 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
9874 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2046 glc
9875 ; GFX10-NEXT: s_waitcnt vmcnt(0)
9876 ; GFX10-NEXT: buffer_gl1_inv
9877 ; GFX10-NEXT: buffer_gl0_inv
9878 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
9879 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
9880 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
9881 ; GFX10-NEXT: s_cbranch_execnz .LBB38_1
9882 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
9883 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
9884 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
9885 ; GFX10-NEXT: s_setpc_b64 s[30:31]
9887 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4:
9889 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9890 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2046
9891 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
9892 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9893 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
9894 ; GFX90A-NEXT: s_mov_b32 s7, 0xffff0000
9895 ; GFX90A-NEXT: .LBB38_1: ; %atomicrmw.start
9896 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
9897 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
9898 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
9899 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v5
9900 ; GFX90A-NEXT: v_max_f32_e32 v3, v3, v2
9901 ; GFX90A-NEXT: v_bfe_u32 v4, v3, 16, 1
9902 ; GFX90A-NEXT: v_or_b32_e32 v6, 0x400000, v3
9903 ; GFX90A-NEXT: v_add3_u32 v4, v4, v3, s6
9904 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
9905 ; GFX90A-NEXT: v_cndmask_b32_e32 v3, v4, v6, vcc
9906 ; GFX90A-NEXT: v_lshrrev_b32_e32 v3, 16, v3
9907 ; GFX90A-NEXT: v_and_or_b32 v4, v5, s7, v3
9908 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2046 glc
9909 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
9910 ; GFX90A-NEXT: buffer_wbinvl1
9911 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
9912 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9913 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
9914 ; GFX90A-NEXT: s_cbranch_execnz .LBB38_1
9915 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
9916 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
9917 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
9918 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
9920 ; GFX908-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4:
9922 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9923 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2046
9924 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
9925 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9926 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
9927 ; GFX908-NEXT: s_mov_b32 s7, 0xffff0000
9928 ; GFX908-NEXT: .LBB38_1: ; %atomicrmw.start
9929 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
9930 ; GFX908-NEXT: s_waitcnt vmcnt(0)
9931 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
9932 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v4
9933 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v2
9934 ; GFX908-NEXT: v_bfe_u32 v5, v3, 16, 1
9935 ; GFX908-NEXT: v_or_b32_e32 v6, 0x400000, v3
9936 ; GFX908-NEXT: v_add3_u32 v5, v5, v3, s6
9937 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
9938 ; GFX908-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc
9939 ; GFX908-NEXT: v_lshrrev_b32_e32 v3, 16, v3
9940 ; GFX908-NEXT: v_and_or_b32 v3, v4, s7, v3
9941 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2046 glc
9942 ; GFX908-NEXT: s_waitcnt vmcnt(0)
9943 ; GFX908-NEXT: buffer_wbinvl1
9944 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
9945 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9946 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
9947 ; GFX908-NEXT: s_cbranch_execnz .LBB38_1
9948 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
9949 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
9950 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
9951 ; GFX908-NEXT: s_setpc_b64 s[30:31]
9953 ; GFX8-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4:
9955 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9956 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
9957 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
9958 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
9959 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
9960 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 16, v2
9961 ; GFX8-NEXT: .LBB38_1: ; %atomicrmw.start
9962 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
9963 ; GFX8-NEXT: s_waitcnt vmcnt(0)
9964 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
9965 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v6
9966 ; GFX8-NEXT: v_max_f32_e32 v0, v0, v1
9967 ; GFX8-NEXT: v_bfe_u32 v5, v0, 16, 1
9968 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, v5, v0
9969 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, 0x7fff, v5
9970 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v0
9971 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v0, v0
9972 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
9973 ; GFX8-NEXT: v_cndmask_b32_e32 v0, v5, v7, vcc
9974 ; GFX8-NEXT: v_or_b32_sdwa v5, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9975 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
9976 ; GFX8-NEXT: s_waitcnt vmcnt(0)
9977 ; GFX8-NEXT: buffer_wbinvl1
9978 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
9979 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9980 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
9981 ; GFX8-NEXT: s_cbranch_execnz .LBB38_1
9982 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
9983 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
9984 ; GFX8-NEXT: s_setpc_b64 s[30:31]
9986 ; GFX7-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4:
9988 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9989 ; GFX7-NEXT: s_mov_b32 s6, 0
9990 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
9991 ; GFX7-NEXT: s_mov_b32 s4, s6
9992 ; GFX7-NEXT: s_mov_b32 s5, s6
9993 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2046
9994 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
9995 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
9996 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
9997 ; GFX7-NEXT: .LBB38_1: ; %atomicrmw.start
9998 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
9999 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10000 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10001 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
10002 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v6
10003 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
10004 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10005 ; GFX7-NEXT: v_or_b32_e32 v2, v4, v2
10006 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
10007 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
10008 ; GFX7-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 offset:2046 glc
10009 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10010 ; GFX7-NEXT: buffer_wbinvl1
10011 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
10012 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
10013 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
10014 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
10015 ; GFX7-NEXT: s_cbranch_execnz .LBB38_1
10016 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
10017 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
10018 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v4
10019 ; GFX7-NEXT: s_setpc_b64 s[30:31]
10021 ; GFX6-LABEL: global_agent_atomic_fmax_ret_bf16__offset12b_pos__align4:
10023 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10024 ; GFX6-NEXT: s_mov_b32 s6, 0
10025 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
10026 ; GFX6-NEXT: s_mov_b32 s4, s6
10027 ; GFX6-NEXT: s_mov_b32 s5, s6
10028 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2046
10029 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
10030 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
10031 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
10032 ; GFX6-NEXT: .LBB38_1: ; %atomicrmw.start
10033 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
10034 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10035 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10036 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
10037 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v6
10038 ; GFX6-NEXT: s_waitcnt expcnt(0)
10039 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
10040 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10041 ; GFX6-NEXT: v_or_b32_e32 v2, v4, v2
10042 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
10043 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
10044 ; GFX6-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 offset:2046 glc
10045 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10046 ; GFX6-NEXT: buffer_wbinvl1
10047 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
10048 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
10049 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
10050 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
10051 ; GFX6-NEXT: s_cbranch_execnz .LBB38_1
10052 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
10053 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
10054 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v4
10055 ; GFX6-NEXT: s_waitcnt expcnt(0)
10056 ; GFX6-NEXT: s_setpc_b64 s[30:31]
10057 %gep = getelementptr bfloat, ptr addrspace(1) %ptr, i64 1023
10058 %result = atomicrmw fmax ptr addrspace(1) %gep, bfloat %val syncscope("agent") seq_cst, align 4
10062 define void @global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos(ptr addrspace(1) %ptr, bfloat %val) #0 {
10063 ; GFX12-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos:
10065 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10066 ; GFX12-NEXT: s_wait_expcnt 0x0
10067 ; GFX12-NEXT: s_wait_samplecnt 0x0
10068 ; GFX12-NEXT: s_wait_bvhcnt 0x0
10069 ; GFX12-NEXT: s_wait_kmcnt 0x0
10070 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2046
10071 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
10072 ; GFX12-NEXT: s_mov_b32 s0, 0
10073 ; GFX12-NEXT: .LBB39_1: ; %atomicrmw.start
10074 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
10075 ; GFX12-NEXT: s_wait_loadcnt 0x0
10076 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10077 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10078 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v4
10079 ; GFX12-NEXT: v_bfe_u32 v5, v2, 16, 1
10080 ; GFX12-NEXT: v_or_b32_e32 v6, 0x400000, v2
10081 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
10082 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
10083 ; GFX12-NEXT: v_add3_u32 v5, v5, v2, 0x7fff
10084 ; GFX12-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc_lo
10085 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10086 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10087 ; GFX12-NEXT: v_and_or_b32 v2, 0xffff0000, v3, v2
10088 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
10089 ; GFX12-NEXT: s_wait_storecnt 0x0
10090 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2046 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
10091 ; GFX12-NEXT: s_wait_loadcnt 0x0
10092 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
10093 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
10094 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
10095 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
10096 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10097 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10098 ; GFX12-NEXT: s_cbranch_execnz .LBB39_1
10099 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
10100 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
10101 ; GFX12-NEXT: s_setpc_b64 s[30:31]
10103 ; GFX940-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos:
10105 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10106 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2046
10107 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
10108 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
10109 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
10110 ; GFX940-NEXT: s_mov_b32 s3, 0xffff0000
10111 ; GFX940-NEXT: .LBB39_1: ; %atomicrmw.start
10112 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
10113 ; GFX940-NEXT: s_waitcnt vmcnt(0)
10114 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10115 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
10116 ; GFX940-NEXT: v_bfe_u32 v5, v2, 16, 1
10117 ; GFX940-NEXT: v_or_b32_e32 v6, 0x400000, v2
10118 ; GFX940-NEXT: v_add3_u32 v5, v5, v2, s2
10119 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
10120 ; GFX940-NEXT: s_nop 1
10121 ; GFX940-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc
10122 ; GFX940-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10123 ; GFX940-NEXT: v_and_or_b32 v2, v3, s3, v2
10124 ; GFX940-NEXT: buffer_wbl2 sc1
10125 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2046 sc0
10126 ; GFX940-NEXT: s_waitcnt vmcnt(0)
10127 ; GFX940-NEXT: buffer_inv sc1
10128 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
10129 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
10130 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
10131 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
10132 ; GFX940-NEXT: s_cbranch_execnz .LBB39_1
10133 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
10134 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
10135 ; GFX940-NEXT: s_setpc_b64 s[30:31]
10137 ; GFX11-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos:
10139 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10140 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2046
10141 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
10142 ; GFX11-NEXT: s_mov_b32 s0, 0
10143 ; GFX11-NEXT: .p2align 6
10144 ; GFX11-NEXT: .LBB39_1: ; %atomicrmw.start
10145 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
10146 ; GFX11-NEXT: s_waitcnt vmcnt(0)
10147 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10148 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10149 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v4
10150 ; GFX11-NEXT: v_bfe_u32 v5, v2, 16, 1
10151 ; GFX11-NEXT: v_or_b32_e32 v6, 0x400000, v2
10152 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
10153 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
10154 ; GFX11-NEXT: v_add3_u32 v5, v5, v2, 0x7fff
10155 ; GFX11-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc_lo
10156 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10157 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10158 ; GFX11-NEXT: v_and_or_b32 v2, 0xffff0000, v3, v2
10159 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
10160 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2046 glc
10161 ; GFX11-NEXT: s_waitcnt vmcnt(0)
10162 ; GFX11-NEXT: buffer_gl1_inv
10163 ; GFX11-NEXT: buffer_gl0_inv
10164 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
10165 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
10166 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
10167 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10168 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10169 ; GFX11-NEXT: s_cbranch_execnz .LBB39_1
10170 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
10171 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
10172 ; GFX11-NEXT: s_setpc_b64 s[30:31]
10174 ; GFX10-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos:
10176 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10177 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2046
10178 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
10179 ; GFX10-NEXT: s_mov_b32 s4, 0
10180 ; GFX10-NEXT: .LBB39_1: ; %atomicrmw.start
10181 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
10182 ; GFX10-NEXT: s_waitcnt vmcnt(0)
10183 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10184 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v4
10185 ; GFX10-NEXT: v_bfe_u32 v5, v2, 16, 1
10186 ; GFX10-NEXT: v_or_b32_e32 v6, 0x400000, v2
10187 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
10188 ; GFX10-NEXT: v_add3_u32 v5, v5, v2, 0x7fff
10189 ; GFX10-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc_lo
10190 ; GFX10-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10191 ; GFX10-NEXT: v_and_or_b32 v2, 0xffff0000, v3, v2
10192 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
10193 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2046 glc
10194 ; GFX10-NEXT: s_waitcnt vmcnt(0)
10195 ; GFX10-NEXT: buffer_gl1_inv
10196 ; GFX10-NEXT: buffer_gl0_inv
10197 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
10198 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
10199 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
10200 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
10201 ; GFX10-NEXT: s_cbranch_execnz .LBB39_1
10202 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
10203 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
10204 ; GFX10-NEXT: s_setpc_b64 s[30:31]
10206 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos:
10208 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10209 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2046
10210 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
10211 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
10212 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
10213 ; GFX90A-NEXT: s_mov_b32 s7, 0xffff0000
10214 ; GFX90A-NEXT: .LBB39_1: ; %atomicrmw.start
10215 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
10216 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
10217 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10218 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
10219 ; GFX90A-NEXT: v_bfe_u32 v5, v2, 16, 1
10220 ; GFX90A-NEXT: v_or_b32_e32 v6, 0x400000, v2
10221 ; GFX90A-NEXT: v_add3_u32 v5, v5, v2, s6
10222 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
10223 ; GFX90A-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc
10224 ; GFX90A-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10225 ; GFX90A-NEXT: v_and_or_b32 v2, v3, s7, v2
10226 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2046 glc
10227 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
10228 ; GFX90A-NEXT: buffer_wbinvl1
10229 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
10230 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10231 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
10232 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
10233 ; GFX90A-NEXT: s_cbranch_execnz .LBB39_1
10234 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
10235 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
10236 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
10238 ; GFX908-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos:
10240 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10241 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2046
10242 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
10243 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
10244 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
10245 ; GFX908-NEXT: s_mov_b32 s7, 0xffff0000
10246 ; GFX908-NEXT: .LBB39_1: ; %atomicrmw.start
10247 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
10248 ; GFX908-NEXT: s_waitcnt vmcnt(0)
10249 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10250 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
10251 ; GFX908-NEXT: v_bfe_u32 v5, v2, 16, 1
10252 ; GFX908-NEXT: v_or_b32_e32 v6, 0x400000, v2
10253 ; GFX908-NEXT: v_add3_u32 v5, v5, v2, s6
10254 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
10255 ; GFX908-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc
10256 ; GFX908-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10257 ; GFX908-NEXT: v_and_or_b32 v2, v3, s7, v2
10258 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2046 glc
10259 ; GFX908-NEXT: s_waitcnt vmcnt(0)
10260 ; GFX908-NEXT: buffer_wbinvl1
10261 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
10262 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10263 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
10264 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
10265 ; GFX908-NEXT: s_cbranch_execnz .LBB39_1
10266 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
10267 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
10268 ; GFX908-NEXT: s_setpc_b64 s[30:31]
10270 ; GFX8-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos:
10272 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10273 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fe, v0
10274 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
10275 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
10276 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
10277 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
10278 ; GFX8-NEXT: .LBB39_1: ; %atomicrmw.start
10279 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
10280 ; GFX8-NEXT: s_waitcnt vmcnt(0)
10281 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10282 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
10283 ; GFX8-NEXT: v_bfe_u32 v6, v2, 16, 1
10284 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v2
10285 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
10286 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v2
10287 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
10288 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
10289 ; GFX8-NEXT: v_cndmask_b32_e32 v2, v6, v7, vcc
10290 ; GFX8-NEXT: v_or_b32_sdwa v2, v5, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10291 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
10292 ; GFX8-NEXT: s_waitcnt vmcnt(0)
10293 ; GFX8-NEXT: buffer_wbinvl1
10294 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
10295 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10296 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
10297 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
10298 ; GFX8-NEXT: s_cbranch_execnz .LBB39_1
10299 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
10300 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
10301 ; GFX8-NEXT: s_setpc_b64 s[30:31]
10303 ; GFX7-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos:
10305 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10306 ; GFX7-NEXT: s_mov_b32 s6, 0
10307 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
10308 ; GFX7-NEXT: s_mov_b32 s4, s6
10309 ; GFX7-NEXT: s_mov_b32 s5, s6
10310 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2046
10311 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
10312 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
10313 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v2
10314 ; GFX7-NEXT: .LBB39_1: ; %atomicrmw.start
10315 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
10316 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10317 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10318 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
10319 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v4
10320 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
10321 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10322 ; GFX7-NEXT: v_or_b32_e32 v2, v5, v2
10323 ; GFX7-NEXT: v_mov_b32_e32 v6, v3
10324 ; GFX7-NEXT: v_mov_b32_e32 v5, v2
10325 ; GFX7-NEXT: buffer_atomic_cmpswap v[5:6], v[0:1], s[4:7], 0 addr64 offset:2046 glc
10326 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10327 ; GFX7-NEXT: buffer_wbinvl1
10328 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
10329 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
10330 ; GFX7-NEXT: v_mov_b32_e32 v3, v5
10331 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
10332 ; GFX7-NEXT: s_cbranch_execnz .LBB39_1
10333 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
10334 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
10335 ; GFX7-NEXT: s_setpc_b64 s[30:31]
10337 ; GFX6-LABEL: global_agent_atomic_fmax_noret_bf16__offset12b__align4_pos:
10339 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10340 ; GFX6-NEXT: s_mov_b32 s6, 0
10341 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
10342 ; GFX6-NEXT: s_mov_b32 s4, s6
10343 ; GFX6-NEXT: s_mov_b32 s5, s6
10344 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64 offset:2046
10345 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
10346 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
10347 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v2
10348 ; GFX6-NEXT: .LBB39_1: ; %atomicrmw.start
10349 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
10350 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10351 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v3
10352 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
10353 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v4
10354 ; GFX6-NEXT: s_waitcnt expcnt(0)
10355 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
10356 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10357 ; GFX6-NEXT: v_or_b32_e32 v2, v5, v2
10358 ; GFX6-NEXT: v_mov_b32_e32 v6, v3
10359 ; GFX6-NEXT: v_mov_b32_e32 v5, v2
10360 ; GFX6-NEXT: buffer_atomic_cmpswap v[5:6], v[0:1], s[4:7], 0 addr64 offset:2046 glc
10361 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10362 ; GFX6-NEXT: buffer_wbinvl1
10363 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v5, v3
10364 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
10365 ; GFX6-NEXT: v_mov_b32_e32 v3, v5
10366 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
10367 ; GFX6-NEXT: s_cbranch_execnz .LBB39_1
10368 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
10369 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
10370 ; GFX6-NEXT: s_waitcnt expcnt(0)
10371 ; GFX6-NEXT: s_setpc_b64 s[30:31]
10372 %gep = getelementptr bfloat, ptr addrspace(1) %ptr, i64 1023
10373 %unused = atomicrmw fmax ptr addrspace(1) %gep, bfloat %val syncscope("agent") seq_cst, align 4
10377 define bfloat @global_system_atomic_fmax_ret_bf16__offset12b_pos(ptr addrspace(1) %ptr, bfloat %val) #0 {
10378 ; GFX12-LABEL: global_system_atomic_fmax_ret_bf16__offset12b_pos:
10380 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10381 ; GFX12-NEXT: s_wait_expcnt 0x0
10382 ; GFX12-NEXT: s_wait_samplecnt 0x0
10383 ; GFX12-NEXT: s_wait_bvhcnt 0x0
10384 ; GFX12-NEXT: s_wait_kmcnt 0x0
10385 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
10386 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10387 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10388 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10389 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
10390 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
10391 ; GFX12-NEXT: s_mov_b32 s0, 0
10392 ; GFX12-NEXT: global_load_b32 v5, v[0:1], off
10393 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10394 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
10395 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
10396 ; GFX12-NEXT: v_not_b32_e32 v4, v4
10397 ; GFX12-NEXT: .LBB40_1: ; %atomicrmw.start
10398 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
10399 ; GFX12-NEXT: s_wait_loadcnt 0x0
10400 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
10401 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10402 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
10403 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 16, v5
10404 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10405 ; GFX12-NEXT: v_max_num_f32_e32 v5, v5, v2
10406 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
10407 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v5
10408 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
10409 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
10410 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
10411 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
10412 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10413 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, 16, v5
10414 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
10415 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
10416 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
10417 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
10418 ; GFX12-NEXT: s_wait_storecnt 0x0
10419 ; GFX12-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off th:TH_ATOMIC_RETURN scope:SCOPE_SYS
10420 ; GFX12-NEXT: s_wait_loadcnt 0x0
10421 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
10422 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
10423 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
10424 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10425 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10426 ; GFX12-NEXT: s_cbranch_execnz .LBB40_1
10427 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
10428 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
10429 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10430 ; GFX12-NEXT: s_setpc_b64 s[30:31]
10432 ; GFX940-LABEL: global_system_atomic_fmax_ret_bf16__offset12b_pos:
10434 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10435 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
10436 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
10437 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
10438 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
10439 ; GFX940-NEXT: global_load_dword v5, v[0:1], off
10440 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
10441 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10442 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
10443 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
10444 ; GFX940-NEXT: v_not_b32_e32 v4, v4
10445 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
10446 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10447 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
10448 ; GFX940-NEXT: .LBB40_1: ; %atomicrmw.start
10449 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
10450 ; GFX940-NEXT: s_waitcnt vmcnt(0)
10451 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
10452 ; GFX940-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10453 ; GFX940-NEXT: s_nop 0
10454 ; GFX940-NEXT: v_max_f32_e32 v5, v5, v2
10455 ; GFX940-NEXT: v_bfe_u32 v6, v5, 16, 1
10456 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v5
10457 ; GFX940-NEXT: v_add3_u32 v6, v6, v5, s2
10458 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10459 ; GFX940-NEXT: s_nop 1
10460 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
10461 ; GFX940-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10462 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
10463 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
10464 ; GFX940-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off sc0 sc1
10465 ; GFX940-NEXT: s_waitcnt vmcnt(0)
10466 ; GFX940-NEXT: buffer_inv sc0 sc1
10467 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
10468 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
10469 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
10470 ; GFX940-NEXT: s_cbranch_execnz .LBB40_1
10471 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
10472 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
10473 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10474 ; GFX940-NEXT: s_setpc_b64 s[30:31]
10476 ; GFX11-LABEL: global_system_atomic_fmax_ret_bf16__offset12b_pos:
10478 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10479 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
10480 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10481 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10482 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10483 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
10484 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
10485 ; GFX11-NEXT: s_mov_b32 s0, 0
10486 ; GFX11-NEXT: global_load_b32 v5, v[0:1], off
10487 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10488 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
10489 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
10490 ; GFX11-NEXT: v_not_b32_e32 v4, v4
10491 ; GFX11-NEXT: .p2align 6
10492 ; GFX11-NEXT: .LBB40_1: ; %atomicrmw.start
10493 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
10494 ; GFX11-NEXT: s_waitcnt vmcnt(0)
10495 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
10496 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10497 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
10498 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 16, v5
10499 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10500 ; GFX11-NEXT: v_max_f32_e32 v5, v5, v2
10501 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
10502 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v5
10503 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
10504 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
10505 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
10506 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
10507 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10508 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, 16, v5
10509 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
10510 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
10511 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
10512 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
10513 ; GFX11-NEXT: global_atomic_cmpswap_b32 v5, v[0:1], v[5:6], off glc
10514 ; GFX11-NEXT: s_waitcnt vmcnt(0)
10515 ; GFX11-NEXT: buffer_gl1_inv
10516 ; GFX11-NEXT: buffer_gl0_inv
10517 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
10518 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
10519 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10520 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10521 ; GFX11-NEXT: s_cbranch_execnz .LBB40_1
10522 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
10523 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
10524 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10525 ; GFX11-NEXT: s_setpc_b64 s[30:31]
10527 ; GFX10-LABEL: global_system_atomic_fmax_ret_bf16__offset12b_pos:
10529 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10530 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
10531 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10532 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10533 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
10534 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
10535 ; GFX10-NEXT: s_mov_b32 s4, 0
10536 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
10537 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10538 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
10539 ; GFX10-NEXT: v_not_b32_e32 v4, v4
10540 ; GFX10-NEXT: .LBB40_1: ; %atomicrmw.start
10541 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
10542 ; GFX10-NEXT: s_waitcnt vmcnt(0)
10543 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
10544 ; GFX10-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10545 ; GFX10-NEXT: v_max_f32_e32 v5, v5, v2
10546 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
10547 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v5
10548 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
10549 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
10550 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
10551 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10552 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
10553 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
10554 ; GFX10-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
10555 ; GFX10-NEXT: s_waitcnt vmcnt(0)
10556 ; GFX10-NEXT: buffer_gl1_inv
10557 ; GFX10-NEXT: buffer_gl0_inv
10558 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
10559 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
10560 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
10561 ; GFX10-NEXT: s_cbranch_execnz .LBB40_1
10562 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
10563 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
10564 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10565 ; GFX10-NEXT: s_setpc_b64 s[30:31]
10567 ; GFX90A-LABEL: global_system_atomic_fmax_ret_bf16__offset12b_pos:
10569 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10570 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
10571 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
10572 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
10573 ; GFX90A-NEXT: global_load_dword v5, v[0:1], off
10574 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
10575 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10576 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
10577 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10578 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
10579 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
10580 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10581 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
10582 ; GFX90A-NEXT: .LBB40_1: ; %atomicrmw.start
10583 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
10584 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
10585 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
10586 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10587 ; GFX90A-NEXT: v_max_f32_e32 v5, v5, v2
10588 ; GFX90A-NEXT: v_bfe_u32 v6, v5, 16, 1
10589 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v5
10590 ; GFX90A-NEXT: v_add3_u32 v6, v6, v5, s6
10591 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10592 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
10593 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10594 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
10595 ; GFX90A-NEXT: buffer_wbl2
10596 ; GFX90A-NEXT: global_atomic_cmpswap v5, v[0:1], v[6:7], off glc
10597 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
10598 ; GFX90A-NEXT: buffer_invl2
10599 ; GFX90A-NEXT: buffer_wbinvl1
10600 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
10601 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10602 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
10603 ; GFX90A-NEXT: s_cbranch_execnz .LBB40_1
10604 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
10605 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
10606 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10607 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
10609 ; GFX908-LABEL: global_system_atomic_fmax_ret_bf16__offset12b_pos:
10611 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10612 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
10613 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
10614 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
10615 ; GFX908-NEXT: global_load_dword v5, v[0:1], off
10616 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
10617 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10618 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
10619 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10620 ; GFX908-NEXT: v_not_b32_e32 v4, v4
10621 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
10622 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10623 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
10624 ; GFX908-NEXT: .LBB40_1: ; %atomicrmw.start
10625 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
10626 ; GFX908-NEXT: s_waitcnt vmcnt(0)
10627 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
10628 ; GFX908-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10629 ; GFX908-NEXT: v_max_f32_e32 v5, v5, v2
10630 ; GFX908-NEXT: v_bfe_u32 v7, v5, 16, 1
10631 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v5
10632 ; GFX908-NEXT: v_add3_u32 v7, v7, v5, s6
10633 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10634 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc
10635 ; GFX908-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10636 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
10637 ; GFX908-NEXT: global_atomic_cmpswap v5, v[0:1], v[5:6], off glc
10638 ; GFX908-NEXT: s_waitcnt vmcnt(0)
10639 ; GFX908-NEXT: buffer_wbinvl1
10640 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10641 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10642 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
10643 ; GFX908-NEXT: s_cbranch_execnz .LBB40_1
10644 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
10645 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
10646 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10647 ; GFX908-NEXT: s_setpc_b64 s[30:31]
10649 ; GFX8-LABEL: global_system_atomic_fmax_ret_bf16__offset12b_pos:
10651 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10652 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
10653 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
10654 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
10655 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
10656 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
10657 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10658 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
10659 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10660 ; GFX8-NEXT: v_not_b32_e32 v4, v4
10661 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
10662 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10663 ; GFX8-NEXT: .LBB40_1: ; %atomicrmw.start
10664 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
10665 ; GFX8-NEXT: s_waitcnt vmcnt(0)
10666 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
10667 ; GFX8-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10668 ; GFX8-NEXT: v_max_f32_e32 v5, v5, v2
10669 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
10670 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
10671 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
10672 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
10673 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10674 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
10675 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
10676 ; GFX8-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10677 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
10678 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10679 ; GFX8-NEXT: s_waitcnt vmcnt(0)
10680 ; GFX8-NEXT: buffer_wbinvl1
10681 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10682 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10683 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
10684 ; GFX8-NEXT: s_cbranch_execnz .LBB40_1
10685 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
10686 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
10687 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10688 ; GFX8-NEXT: s_setpc_b64 s[30:31]
10690 ; GFX7-LABEL: global_system_atomic_fmax_ret_bf16__offset12b_pos:
10692 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10693 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
10694 ; GFX7-NEXT: s_mov_b32 s6, 0
10695 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
10696 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
10697 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
10698 ; GFX7-NEXT: s_mov_b32 s4, s6
10699 ; GFX7-NEXT: s_mov_b32 s5, s6
10700 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
10701 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
10702 ; GFX7-NEXT: v_lshlrev_b32_e32 v6, 3, v4
10703 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v6
10704 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
10705 ; GFX7-NEXT: v_not_b32_e32 v7, v4
10706 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
10707 ; GFX7-NEXT: v_and_b32_e32 v8, 0xffff0000, v2
10708 ; GFX7-NEXT: .LBB40_1: ; %atomicrmw.start
10709 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
10710 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10711 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v6, v3
10712 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10713 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
10714 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v8
10715 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10716 ; GFX7-NEXT: v_and_b32_e32 v4, v3, v7
10717 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v6, v2
10718 ; GFX7-NEXT: v_or_b32_e32 v2, v4, v2
10719 ; GFX7-NEXT: v_mov_b32_e32 v5, v3
10720 ; GFX7-NEXT: v_mov_b32_e32 v4, v2
10721 ; GFX7-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
10722 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10723 ; GFX7-NEXT: buffer_wbinvl1
10724 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
10725 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
10726 ; GFX7-NEXT: v_mov_b32_e32 v3, v4
10727 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
10728 ; GFX7-NEXT: s_cbranch_execnz .LBB40_1
10729 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
10730 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
10731 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v6, v4
10732 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
10733 ; GFX7-NEXT: s_setpc_b64 s[30:31]
10735 ; GFX6-LABEL: global_system_atomic_fmax_ret_bf16__offset12b_pos:
10737 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10738 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
10739 ; GFX6-NEXT: s_mov_b32 s6, 0
10740 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
10741 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
10742 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
10743 ; GFX6-NEXT: s_mov_b32 s4, s6
10744 ; GFX6-NEXT: s_mov_b32 s5, s6
10745 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
10746 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
10747 ; GFX6-NEXT: v_lshlrev_b32_e32 v6, 3, v4
10748 ; GFX6-NEXT: v_lshl_b32_e32 v4, 0xffff, v6
10749 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
10750 ; GFX6-NEXT: v_not_b32_e32 v7, v4
10751 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
10752 ; GFX6-NEXT: v_and_b32_e32 v8, 0xffff0000, v2
10753 ; GFX6-NEXT: .LBB40_1: ; %atomicrmw.start
10754 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
10755 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10756 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v6, v3
10757 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10758 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
10759 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v8
10760 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10761 ; GFX6-NEXT: s_waitcnt expcnt(0)
10762 ; GFX6-NEXT: v_and_b32_e32 v4, v3, v7
10763 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v6, v2
10764 ; GFX6-NEXT: v_or_b32_e32 v2, v4, v2
10765 ; GFX6-NEXT: v_mov_b32_e32 v5, v3
10766 ; GFX6-NEXT: v_mov_b32_e32 v4, v2
10767 ; GFX6-NEXT: buffer_atomic_cmpswap v[4:5], v[0:1], s[4:7], 0 addr64 glc
10768 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10769 ; GFX6-NEXT: buffer_wbinvl1
10770 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v4, v3
10771 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
10772 ; GFX6-NEXT: v_mov_b32_e32 v3, v4
10773 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
10774 ; GFX6-NEXT: s_cbranch_execnz .LBB40_1
10775 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
10776 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
10777 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, v6, v4
10778 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v0
10779 ; GFX6-NEXT: s_waitcnt expcnt(0)
10780 ; GFX6-NEXT: s_setpc_b64 s[30:31]
10781 %gep = getelementptr bfloat, ptr addrspace(1) %ptr, i64 1023
10782 %result = atomicrmw fmax ptr addrspace(1) %gep, bfloat %val seq_cst
10786 define void @global_system_atomic_fmax_noret_bf16__offset12b_pos(ptr addrspace(1) %ptr, bfloat %val) #0 {
10787 ; GFX12-LABEL: global_system_atomic_fmax_noret_bf16__offset12b_pos:
10789 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10790 ; GFX12-NEXT: s_wait_expcnt 0x0
10791 ; GFX12-NEXT: s_wait_samplecnt 0x0
10792 ; GFX12-NEXT: s_wait_bvhcnt 0x0
10793 ; GFX12-NEXT: s_wait_kmcnt 0x0
10794 ; GFX12-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
10795 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10796 ; GFX12-NEXT: v_lshlrev_b32_e32 v6, 16, v2
10797 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10798 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v4
10799 ; GFX12-NEXT: v_and_b32_e32 v4, 3, v4
10800 ; GFX12-NEXT: s_mov_b32 s0, 0
10801 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
10802 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 3, v4
10803 ; GFX12-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
10804 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
10805 ; GFX12-NEXT: v_not_b32_e32 v5, v5
10806 ; GFX12-NEXT: .LBB41_1: ; %atomicrmw.start
10807 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
10808 ; GFX12-NEXT: s_wait_loadcnt 0x0
10809 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, v4, v3
10810 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10811 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10812 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v6
10813 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
10814 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
10815 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v2
10816 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
10817 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
10818 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10819 ; GFX12-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
10820 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10821 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10822 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, v4, v2
10823 ; GFX12-NEXT: v_and_or_b32 v2, v3, v5, v2
10824 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
10825 ; GFX12-NEXT: s_wait_storecnt 0x0
10826 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off th:TH_ATOMIC_RETURN scope:SCOPE_SYS
10827 ; GFX12-NEXT: s_wait_loadcnt 0x0
10828 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
10829 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
10830 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
10831 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
10832 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10833 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10834 ; GFX12-NEXT: s_cbranch_execnz .LBB41_1
10835 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
10836 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
10837 ; GFX12-NEXT: s_setpc_b64 s[30:31]
10839 ; GFX940-LABEL: global_system_atomic_fmax_noret_bf16__offset12b_pos:
10841 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10842 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
10843 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
10844 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
10845 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
10846 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
10847 ; GFX940-NEXT: v_and_b32_e32 v4, 3, v4
10848 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 3, v4
10849 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
10850 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v4, s0
10851 ; GFX940-NEXT: v_not_b32_e32 v5, v5
10852 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
10853 ; GFX940-NEXT: v_lshlrev_b32_e32 v6, 16, v2
10854 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
10855 ; GFX940-NEXT: .LBB41_1: ; %atomicrmw.start
10856 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
10857 ; GFX940-NEXT: s_waitcnt vmcnt(0)
10858 ; GFX940-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10859 ; GFX940-NEXT: s_nop 0
10860 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v6
10861 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
10862 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
10863 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s2
10864 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
10865 ; GFX940-NEXT: s_nop 1
10866 ; GFX940-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
10867 ; GFX940-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10868 ; GFX940-NEXT: v_and_or_b32 v2, v3, v5, v2
10869 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
10870 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0 sc1
10871 ; GFX940-NEXT: s_waitcnt vmcnt(0)
10872 ; GFX940-NEXT: buffer_inv sc0 sc1
10873 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
10874 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
10875 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
10876 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
10877 ; GFX940-NEXT: s_cbranch_execnz .LBB41_1
10878 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
10879 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
10880 ; GFX940-NEXT: s_setpc_b64 s[30:31]
10882 ; GFX11-LABEL: global_system_atomic_fmax_noret_bf16__offset12b_pos:
10884 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10885 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
10886 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10887 ; GFX11-NEXT: v_lshlrev_b32_e32 v6, 16, v2
10888 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10889 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v4
10890 ; GFX11-NEXT: v_and_b32_e32 v4, 3, v4
10891 ; GFX11-NEXT: s_mov_b32 s0, 0
10892 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
10893 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 3, v4
10894 ; GFX11-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
10895 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
10896 ; GFX11-NEXT: v_not_b32_e32 v5, v5
10897 ; GFX11-NEXT: .p2align 6
10898 ; GFX11-NEXT: .LBB41_1: ; %atomicrmw.start
10899 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
10900 ; GFX11-NEXT: s_waitcnt vmcnt(0)
10901 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, v4, v3
10902 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10903 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10904 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v6
10905 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
10906 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
10907 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v2
10908 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
10909 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
10910 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10911 ; GFX11-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
10912 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10913 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10914 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, v4, v2
10915 ; GFX11-NEXT: v_and_or_b32 v2, v3, v5, v2
10916 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
10917 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
10918 ; GFX11-NEXT: s_waitcnt vmcnt(0)
10919 ; GFX11-NEXT: buffer_gl1_inv
10920 ; GFX11-NEXT: buffer_gl0_inv
10921 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
10922 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
10923 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
10924 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10925 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10926 ; GFX11-NEXT: s_cbranch_execnz .LBB41_1
10927 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
10928 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
10929 ; GFX11-NEXT: s_setpc_b64 s[30:31]
10931 ; GFX10-LABEL: global_system_atomic_fmax_noret_bf16__offset12b_pos:
10933 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10934 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
10935 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10936 ; GFX10-NEXT: v_lshlrev_b32_e32 v6, 16, v2
10937 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v4
10938 ; GFX10-NEXT: v_and_b32_e32 v4, 3, v4
10939 ; GFX10-NEXT: s_mov_b32 s4, 0
10940 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
10941 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 3, v4
10942 ; GFX10-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
10943 ; GFX10-NEXT: v_not_b32_e32 v5, v5
10944 ; GFX10-NEXT: .LBB41_1: ; %atomicrmw.start
10945 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
10946 ; GFX10-NEXT: s_waitcnt vmcnt(0)
10947 ; GFX10-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10948 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v6
10949 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
10950 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v2
10951 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
10952 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
10953 ; GFX10-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
10954 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10955 ; GFX10-NEXT: v_and_or_b32 v2, v3, v5, v2
10956 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
10957 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
10958 ; GFX10-NEXT: s_waitcnt vmcnt(0)
10959 ; GFX10-NEXT: buffer_gl1_inv
10960 ; GFX10-NEXT: buffer_gl0_inv
10961 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
10962 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
10963 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
10964 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
10965 ; GFX10-NEXT: s_cbranch_execnz .LBB41_1
10966 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
10967 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
10968 ; GFX10-NEXT: s_setpc_b64 s[30:31]
10970 ; GFX90A-LABEL: global_system_atomic_fmax_noret_bf16__offset12b_pos:
10972 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10973 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
10974 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
10975 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v4
10976 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
10977 ; GFX90A-NEXT: v_and_b32_e32 v4, 3, v4
10978 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 3, v4
10979 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
10980 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v4, s4
10981 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
10982 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
10983 ; GFX90A-NEXT: v_lshlrev_b32_e32 v6, 16, v2
10984 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
10985 ; GFX90A-NEXT: .LBB41_1: ; %atomicrmw.start
10986 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
10987 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
10988 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10989 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v6
10990 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
10991 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
10992 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s6
10993 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
10994 ; GFX90A-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
10995 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10996 ; GFX90A-NEXT: v_and_or_b32 v2, v3, v5, v2
10997 ; GFX90A-NEXT: buffer_wbl2
10998 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
10999 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
11000 ; GFX90A-NEXT: buffer_invl2
11001 ; GFX90A-NEXT: buffer_wbinvl1
11002 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11003 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11004 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
11005 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
11006 ; GFX90A-NEXT: s_cbranch_execnz .LBB41_1
11007 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
11008 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
11009 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
11011 ; GFX908-LABEL: global_system_atomic_fmax_noret_bf16__offset12b_pos:
11013 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11014 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
11015 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
11016 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v4
11017 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
11018 ; GFX908-NEXT: v_and_b32_e32 v4, 3, v4
11019 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11020 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
11021 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v4, s4
11022 ; GFX908-NEXT: v_not_b32_e32 v5, v5
11023 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
11024 ; GFX908-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11025 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
11026 ; GFX908-NEXT: .LBB41_1: ; %atomicrmw.start
11027 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
11028 ; GFX908-NEXT: s_waitcnt vmcnt(0)
11029 ; GFX908-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11030 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v6
11031 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
11032 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
11033 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s6
11034 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11035 ; GFX908-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
11036 ; GFX908-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11037 ; GFX908-NEXT: v_and_or_b32 v2, v3, v5, v2
11038 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
11039 ; GFX908-NEXT: s_waitcnt vmcnt(0)
11040 ; GFX908-NEXT: buffer_wbinvl1
11041 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11042 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11043 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
11044 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
11045 ; GFX908-NEXT: s_cbranch_execnz .LBB41_1
11046 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
11047 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
11048 ; GFX908-NEXT: s_setpc_b64 s[30:31]
11050 ; GFX8-LABEL: global_system_atomic_fmax_noret_bf16__offset12b_pos:
11052 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11053 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7fe, v0
11054 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
11055 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v4
11056 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
11057 ; GFX8-NEXT: v_and_b32_e32 v4, 3, v4
11058 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11059 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
11060 ; GFX8-NEXT: v_lshlrev_b32_e64 v5, v4, s4
11061 ; GFX8-NEXT: v_not_b32_e32 v5, v5
11062 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
11063 ; GFX8-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11064 ; GFX8-NEXT: .LBB41_1: ; %atomicrmw.start
11065 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
11066 ; GFX8-NEXT: s_waitcnt vmcnt(0)
11067 ; GFX8-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11068 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v6
11069 ; GFX8-NEXT: v_bfe_u32 v8, v2, 16, 1
11070 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v2
11071 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
11072 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v2
11073 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11074 ; GFX8-NEXT: v_cndmask_b32_e32 v2, v8, v9, vcc
11075 ; GFX8-NEXT: v_and_b32_e32 v7, v3, v5
11076 ; GFX8-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11077 ; GFX8-NEXT: v_or_b32_e32 v2, v7, v2
11078 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11079 ; GFX8-NEXT: s_waitcnt vmcnt(0)
11080 ; GFX8-NEXT: buffer_wbinvl1
11081 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11082 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11083 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
11084 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
11085 ; GFX8-NEXT: s_cbranch_execnz .LBB41_1
11086 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
11087 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
11088 ; GFX8-NEXT: s_setpc_b64 s[30:31]
11090 ; GFX7-LABEL: global_system_atomic_fmax_noret_bf16__offset12b_pos:
11092 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11093 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
11094 ; GFX7-NEXT: s_mov_b32 s6, 0
11095 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
11096 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
11097 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
11098 ; GFX7-NEXT: s_mov_b32 s4, s6
11099 ; GFX7-NEXT: s_mov_b32 s5, s6
11100 ; GFX7-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
11101 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
11102 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11103 ; GFX7-NEXT: v_lshl_b32_e32 v5, 0xffff, v4
11104 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
11105 ; GFX7-NEXT: v_not_b32_e32 v5, v5
11106 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
11107 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
11108 ; GFX7-NEXT: .LBB41_1: ; %atomicrmw.start
11109 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
11110 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11111 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
11112 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11113 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
11114 ; GFX7-NEXT: v_max_f32_e32 v2, v2, v6
11115 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11116 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v5
11117 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
11118 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
11119 ; GFX7-NEXT: v_mov_b32_e32 v8, v3
11120 ; GFX7-NEXT: v_mov_b32_e32 v7, v2
11121 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
11122 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11123 ; GFX7-NEXT: buffer_wbinvl1
11124 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
11125 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
11126 ; GFX7-NEXT: v_mov_b32_e32 v3, v7
11127 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
11128 ; GFX7-NEXT: s_cbranch_execnz .LBB41_1
11129 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
11130 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
11131 ; GFX7-NEXT: s_setpc_b64 s[30:31]
11133 ; GFX6-LABEL: global_system_atomic_fmax_noret_bf16__offset12b_pos:
11135 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11136 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
11137 ; GFX6-NEXT: s_mov_b32 s6, 0
11138 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
11139 ; GFX6-NEXT: v_and_b32_e32 v0, -4, v4
11140 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
11141 ; GFX6-NEXT: s_mov_b32 s4, s6
11142 ; GFX6-NEXT: s_mov_b32 s5, s6
11143 ; GFX6-NEXT: buffer_load_dword v3, v[0:1], s[4:7], 0 addr64
11144 ; GFX6-NEXT: v_and_b32_e32 v4, 3, v4
11145 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11146 ; GFX6-NEXT: v_lshl_b32_e32 v5, 0xffff, v4
11147 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
11148 ; GFX6-NEXT: v_not_b32_e32 v5, v5
11149 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
11150 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
11151 ; GFX6-NEXT: .LBB41_1: ; %atomicrmw.start
11152 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
11153 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11154 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, v4, v3
11155 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11156 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
11157 ; GFX6-NEXT: v_max_f32_e32 v2, v2, v6
11158 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11159 ; GFX6-NEXT: s_waitcnt expcnt(0)
11160 ; GFX6-NEXT: v_and_b32_e32 v7, v3, v5
11161 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, v4, v2
11162 ; GFX6-NEXT: v_or_b32_e32 v2, v7, v2
11163 ; GFX6-NEXT: v_mov_b32_e32 v8, v3
11164 ; GFX6-NEXT: v_mov_b32_e32 v7, v2
11165 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
11166 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11167 ; GFX6-NEXT: buffer_wbinvl1
11168 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v3
11169 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
11170 ; GFX6-NEXT: v_mov_b32_e32 v3, v7
11171 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
11172 ; GFX6-NEXT: s_cbranch_execnz .LBB41_1
11173 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
11174 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
11175 ; GFX6-NEXT: s_waitcnt expcnt(0)
11176 ; GFX6-NEXT: s_setpc_b64 s[30:31]
11177 %gep = getelementptr bfloat, ptr addrspace(1) %ptr, i64 1023
11178 %unused = atomicrmw fmax ptr addrspace(1) %gep, bfloat %val seq_cst
11182 ; --------------------------------------------------------------------
11184 ; --------------------------------------------------------------------
11186 define <2 x half> @global_agent_atomic_fmax_ret_v2f16(ptr addrspace(1) %ptr, <2 x half> %val) #0 {
11187 ; GFX12-LABEL: global_agent_atomic_fmax_ret_v2f16:
11189 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11190 ; GFX12-NEXT: s_wait_expcnt 0x0
11191 ; GFX12-NEXT: s_wait_samplecnt 0x0
11192 ; GFX12-NEXT: s_wait_bvhcnt 0x0
11193 ; GFX12-NEXT: s_wait_kmcnt 0x0
11194 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
11195 ; GFX12-NEXT: v_pk_max_num_f16 v2, v2, v2
11196 ; GFX12-NEXT: s_mov_b32 s0, 0
11197 ; GFX12-NEXT: .LBB42_1: ; %atomicrmw.start
11198 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
11199 ; GFX12-NEXT: s_wait_loadcnt 0x0
11200 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
11201 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11202 ; GFX12-NEXT: v_pk_max_num_f16 v3, v4, v4
11203 ; GFX12-NEXT: v_pk_max_num_f16 v3, v3, v2
11204 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
11205 ; GFX12-NEXT: s_wait_storecnt 0x0
11206 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
11207 ; GFX12-NEXT: s_wait_loadcnt 0x0
11208 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
11209 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11210 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
11211 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11212 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11213 ; GFX12-NEXT: s_cbranch_execnz .LBB42_1
11214 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
11215 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
11216 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
11217 ; GFX12-NEXT: s_setpc_b64 s[30:31]
11219 ; GFX940-LABEL: global_agent_atomic_fmax_ret_v2f16:
11221 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11222 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
11223 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
11224 ; GFX940-NEXT: v_pk_max_f16 v2, v2, v2
11225 ; GFX940-NEXT: .LBB42_1: ; %atomicrmw.start
11226 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
11227 ; GFX940-NEXT: s_waitcnt vmcnt(0)
11228 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
11229 ; GFX940-NEXT: v_pk_max_f16 v3, v5, v5
11230 ; GFX940-NEXT: s_nop 0
11231 ; GFX940-NEXT: v_pk_max_f16 v4, v3, v2
11232 ; GFX940-NEXT: buffer_wbl2 sc1
11233 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off sc0
11234 ; GFX940-NEXT: s_waitcnt vmcnt(0)
11235 ; GFX940-NEXT: buffer_inv sc1
11236 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
11237 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
11238 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
11239 ; GFX940-NEXT: s_cbranch_execnz .LBB42_1
11240 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
11241 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
11242 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
11243 ; GFX940-NEXT: s_setpc_b64 s[30:31]
11245 ; GFX11-LABEL: global_agent_atomic_fmax_ret_v2f16:
11247 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11248 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
11249 ; GFX11-NEXT: v_pk_max_f16 v2, v2, v2
11250 ; GFX11-NEXT: s_mov_b32 s0, 0
11251 ; GFX11-NEXT: .LBB42_1: ; %atomicrmw.start
11252 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
11253 ; GFX11-NEXT: s_waitcnt vmcnt(0)
11254 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
11255 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11256 ; GFX11-NEXT: v_pk_max_f16 v3, v4, v4
11257 ; GFX11-NEXT: v_pk_max_f16 v3, v3, v2
11258 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
11259 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off glc
11260 ; GFX11-NEXT: s_waitcnt vmcnt(0)
11261 ; GFX11-NEXT: buffer_gl1_inv
11262 ; GFX11-NEXT: buffer_gl0_inv
11263 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11264 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
11265 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11266 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11267 ; GFX11-NEXT: s_cbranch_execnz .LBB42_1
11268 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
11269 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
11270 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
11271 ; GFX11-NEXT: s_setpc_b64 s[30:31]
11273 ; GFX10-LABEL: global_agent_atomic_fmax_ret_v2f16:
11275 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11276 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
11277 ; GFX10-NEXT: v_pk_max_f16 v2, v2, v2
11278 ; GFX10-NEXT: s_mov_b32 s4, 0
11279 ; GFX10-NEXT: .LBB42_1: ; %atomicrmw.start
11280 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
11281 ; GFX10-NEXT: s_waitcnt vmcnt(0)
11282 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
11283 ; GFX10-NEXT: v_pk_max_f16 v3, v4, v4
11284 ; GFX10-NEXT: v_pk_max_f16 v3, v3, v2
11285 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
11286 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off glc
11287 ; GFX10-NEXT: s_waitcnt vmcnt(0)
11288 ; GFX10-NEXT: buffer_gl1_inv
11289 ; GFX10-NEXT: buffer_gl0_inv
11290 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11291 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
11292 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
11293 ; GFX10-NEXT: s_cbranch_execnz .LBB42_1
11294 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
11295 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
11296 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
11297 ; GFX10-NEXT: s_setpc_b64 s[30:31]
11299 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_v2f16:
11301 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11302 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
11303 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
11304 ; GFX90A-NEXT: v_pk_max_f16 v2, v2, v2
11305 ; GFX90A-NEXT: .LBB42_1: ; %atomicrmw.start
11306 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
11307 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
11308 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
11309 ; GFX90A-NEXT: v_pk_max_f16 v3, v5, v5
11310 ; GFX90A-NEXT: v_pk_max_f16 v4, v3, v2
11311 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off glc
11312 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
11313 ; GFX90A-NEXT: buffer_wbinvl1
11314 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
11315 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11316 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
11317 ; GFX90A-NEXT: s_cbranch_execnz .LBB42_1
11318 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
11319 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
11320 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
11321 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
11323 ; GFX908-LABEL: global_agent_atomic_fmax_ret_v2f16:
11325 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11326 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
11327 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
11328 ; GFX908-NEXT: v_pk_max_f16 v2, v2, v2
11329 ; GFX908-NEXT: .LBB42_1: ; %atomicrmw.start
11330 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
11331 ; GFX908-NEXT: s_waitcnt vmcnt(0)
11332 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
11333 ; GFX908-NEXT: v_pk_max_f16 v3, v4, v4
11334 ; GFX908-NEXT: v_pk_max_f16 v3, v3, v2
11335 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off glc
11336 ; GFX908-NEXT: s_waitcnt vmcnt(0)
11337 ; GFX908-NEXT: buffer_wbinvl1
11338 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
11339 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11340 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
11341 ; GFX908-NEXT: s_cbranch_execnz .LBB42_1
11342 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
11343 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
11344 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
11345 ; GFX908-NEXT: s_setpc_b64 s[30:31]
11347 ; GFX8-LABEL: global_agent_atomic_fmax_ret_v2f16:
11349 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11350 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
11351 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
11352 ; GFX8-NEXT: v_max_f16_sdwa v4, v2, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
11353 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
11354 ; GFX8-NEXT: .LBB42_1: ; %atomicrmw.start
11355 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
11356 ; GFX8-NEXT: s_waitcnt vmcnt(0)
11357 ; GFX8-NEXT: v_mov_b32_e32 v6, v3
11358 ; GFX8-NEXT: v_max_f16_sdwa v3, v6, v6 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
11359 ; GFX8-NEXT: v_max_f16_e32 v5, v6, v6
11360 ; GFX8-NEXT: v_max_f16_sdwa v3, v3, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11361 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v2
11362 ; GFX8-NEXT: v_or_b32_e32 v5, v5, v3
11363 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
11364 ; GFX8-NEXT: s_waitcnt vmcnt(0)
11365 ; GFX8-NEXT: buffer_wbinvl1
11366 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
11367 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11368 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
11369 ; GFX8-NEXT: s_cbranch_execnz .LBB42_1
11370 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
11371 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
11372 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
11373 ; GFX8-NEXT: s_setpc_b64 s[30:31]
11375 ; GFX7-LABEL: global_agent_atomic_fmax_ret_v2f16:
11377 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11378 ; GFX7-NEXT: s_mov_b32 s6, 0
11379 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
11380 ; GFX7-NEXT: s_mov_b32 s4, s6
11381 ; GFX7-NEXT: s_mov_b32 s5, s6
11382 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64
11383 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
11384 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
11385 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
11386 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v3
11387 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11388 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
11389 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
11390 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
11391 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v6
11392 ; GFX7-NEXT: .LBB42_1: ; %atomicrmw.start
11393 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
11394 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
11395 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
11396 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v3
11397 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v2
11398 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
11399 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v4
11400 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v5
11401 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
11402 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
11403 ; GFX7-NEXT: v_or_b32_e32 v7, v2, v3
11404 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v6
11405 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v2
11406 ; GFX7-NEXT: v_mov_b32_e32 v9, v7
11407 ; GFX7-NEXT: v_mov_b32_e32 v8, v6
11408 ; GFX7-NEXT: buffer_atomic_cmpswap v[8:9], v[0:1], s[4:7], 0 addr64 glc
11409 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11410 ; GFX7-NEXT: buffer_wbinvl1
11411 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v8
11412 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v8
11413 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
11414 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v8, v7
11415 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
11416 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
11417 ; GFX7-NEXT: s_cbranch_execnz .LBB42_1
11418 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
11419 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
11420 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
11421 ; GFX7-NEXT: v_mov_b32_e32 v1, v3
11422 ; GFX7-NEXT: s_setpc_b64 s[30:31]
11424 ; GFX6-LABEL: global_agent_atomic_fmax_ret_v2f16:
11426 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11427 ; GFX6-NEXT: s_mov_b32 s6, 0
11428 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
11429 ; GFX6-NEXT: s_mov_b32 s4, s6
11430 ; GFX6-NEXT: s_mov_b32 s5, s6
11431 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64
11432 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
11433 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v2
11434 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
11435 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v3
11436 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11437 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v5
11438 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v5
11439 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
11440 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v6
11441 ; GFX6-NEXT: .LBB42_1: ; %atomicrmw.start
11442 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
11443 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
11444 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
11445 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v3
11446 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v2
11447 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
11448 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v4
11449 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v5
11450 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v6
11451 ; GFX6-NEXT: s_waitcnt expcnt(0)
11452 ; GFX6-NEXT: v_cvt_f16_f32_e32 v8, v7
11453 ; GFX6-NEXT: v_or_b32_e32 v7, v2, v3
11454 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v6
11455 ; GFX6-NEXT: v_or_b32_e32 v6, v8, v2
11456 ; GFX6-NEXT: v_mov_b32_e32 v9, v7
11457 ; GFX6-NEXT: v_mov_b32_e32 v8, v6
11458 ; GFX6-NEXT: buffer_atomic_cmpswap v[8:9], v[0:1], s[4:7], 0 addr64 glc
11459 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11460 ; GFX6-NEXT: buffer_wbinvl1
11461 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v8
11462 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v8
11463 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
11464 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v8, v7
11465 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
11466 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
11467 ; GFX6-NEXT: s_cbranch_execnz .LBB42_1
11468 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
11469 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
11470 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
11471 ; GFX6-NEXT: v_mov_b32_e32 v1, v3
11472 ; GFX6-NEXT: s_waitcnt expcnt(0)
11473 ; GFX6-NEXT: s_setpc_b64 s[30:31]
11474 %result = atomicrmw fmax ptr addrspace(1) %ptr, <2 x half> %val syncscope("agent") seq_cst
11475 ret <2 x half> %result
11478 define <2 x half> @global_agent_atomic_fmax_ret_v2f16__offset12b_pos(ptr addrspace(1) %ptr, <2 x half> %val) #0 {
11479 ; GFX12-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_pos:
11481 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11482 ; GFX12-NEXT: s_wait_expcnt 0x0
11483 ; GFX12-NEXT: s_wait_samplecnt 0x0
11484 ; GFX12-NEXT: s_wait_bvhcnt 0x0
11485 ; GFX12-NEXT: s_wait_kmcnt 0x0
11486 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
11487 ; GFX12-NEXT: v_pk_max_num_f16 v2, v2, v2
11488 ; GFX12-NEXT: s_mov_b32 s0, 0
11489 ; GFX12-NEXT: .LBB43_1: ; %atomicrmw.start
11490 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
11491 ; GFX12-NEXT: s_wait_loadcnt 0x0
11492 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
11493 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11494 ; GFX12-NEXT: v_pk_max_num_f16 v3, v4, v4
11495 ; GFX12-NEXT: v_pk_max_num_f16 v3, v3, v2
11496 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
11497 ; GFX12-NEXT: s_wait_storecnt 0x0
11498 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
11499 ; GFX12-NEXT: s_wait_loadcnt 0x0
11500 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
11501 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11502 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
11503 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11504 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11505 ; GFX12-NEXT: s_cbranch_execnz .LBB43_1
11506 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
11507 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
11508 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
11509 ; GFX12-NEXT: s_setpc_b64 s[30:31]
11511 ; GFX940-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_pos:
11513 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11514 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
11515 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
11516 ; GFX940-NEXT: v_pk_max_f16 v2, v2, v2
11517 ; GFX940-NEXT: .LBB43_1: ; %atomicrmw.start
11518 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
11519 ; GFX940-NEXT: s_waitcnt vmcnt(0)
11520 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
11521 ; GFX940-NEXT: v_pk_max_f16 v3, v5, v5
11522 ; GFX940-NEXT: s_nop 0
11523 ; GFX940-NEXT: v_pk_max_f16 v4, v3, v2
11524 ; GFX940-NEXT: buffer_wbl2 sc1
11525 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 sc0
11526 ; GFX940-NEXT: s_waitcnt vmcnt(0)
11527 ; GFX940-NEXT: buffer_inv sc1
11528 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
11529 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
11530 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
11531 ; GFX940-NEXT: s_cbranch_execnz .LBB43_1
11532 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
11533 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
11534 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
11535 ; GFX940-NEXT: s_setpc_b64 s[30:31]
11537 ; GFX11-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_pos:
11539 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11540 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
11541 ; GFX11-NEXT: v_pk_max_f16 v2, v2, v2
11542 ; GFX11-NEXT: s_mov_b32 s0, 0
11543 ; GFX11-NEXT: .LBB43_1: ; %atomicrmw.start
11544 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
11545 ; GFX11-NEXT: s_waitcnt vmcnt(0)
11546 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
11547 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11548 ; GFX11-NEXT: v_pk_max_f16 v3, v4, v4
11549 ; GFX11-NEXT: v_pk_max_f16 v3, v3, v2
11550 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
11551 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2044 glc
11552 ; GFX11-NEXT: s_waitcnt vmcnt(0)
11553 ; GFX11-NEXT: buffer_gl1_inv
11554 ; GFX11-NEXT: buffer_gl0_inv
11555 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11556 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
11557 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11558 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11559 ; GFX11-NEXT: s_cbranch_execnz .LBB43_1
11560 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
11561 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
11562 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
11563 ; GFX11-NEXT: s_setpc_b64 s[30:31]
11565 ; GFX10-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_pos:
11567 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11568 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
11569 ; GFX10-NEXT: v_pk_max_f16 v2, v2, v2
11570 ; GFX10-NEXT: s_mov_b32 s4, 0
11571 ; GFX10-NEXT: .LBB43_1: ; %atomicrmw.start
11572 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
11573 ; GFX10-NEXT: s_waitcnt vmcnt(0)
11574 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
11575 ; GFX10-NEXT: v_pk_max_f16 v3, v4, v4
11576 ; GFX10-NEXT: v_pk_max_f16 v3, v3, v2
11577 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
11578 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
11579 ; GFX10-NEXT: s_waitcnt vmcnt(0)
11580 ; GFX10-NEXT: buffer_gl1_inv
11581 ; GFX10-NEXT: buffer_gl0_inv
11582 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11583 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
11584 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
11585 ; GFX10-NEXT: s_cbranch_execnz .LBB43_1
11586 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
11587 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
11588 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
11589 ; GFX10-NEXT: s_setpc_b64 s[30:31]
11591 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_pos:
11593 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11594 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
11595 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
11596 ; GFX90A-NEXT: v_pk_max_f16 v2, v2, v2
11597 ; GFX90A-NEXT: .LBB43_1: ; %atomicrmw.start
11598 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
11599 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
11600 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
11601 ; GFX90A-NEXT: v_pk_max_f16 v3, v5, v5
11602 ; GFX90A-NEXT: v_pk_max_f16 v4, v3, v2
11603 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 glc
11604 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
11605 ; GFX90A-NEXT: buffer_wbinvl1
11606 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
11607 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11608 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
11609 ; GFX90A-NEXT: s_cbranch_execnz .LBB43_1
11610 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
11611 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
11612 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
11613 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
11615 ; GFX908-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_pos:
11617 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11618 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
11619 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
11620 ; GFX908-NEXT: v_pk_max_f16 v2, v2, v2
11621 ; GFX908-NEXT: .LBB43_1: ; %atomicrmw.start
11622 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
11623 ; GFX908-NEXT: s_waitcnt vmcnt(0)
11624 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
11625 ; GFX908-NEXT: v_pk_max_f16 v3, v4, v4
11626 ; GFX908-NEXT: v_pk_max_f16 v3, v3, v2
11627 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
11628 ; GFX908-NEXT: s_waitcnt vmcnt(0)
11629 ; GFX908-NEXT: buffer_wbinvl1
11630 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
11631 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11632 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
11633 ; GFX908-NEXT: s_cbranch_execnz .LBB43_1
11634 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
11635 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
11636 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
11637 ; GFX908-NEXT: s_setpc_b64 s[30:31]
11639 ; GFX8-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_pos:
11641 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11642 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
11643 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
11644 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
11645 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
11646 ; GFX8-NEXT: v_max_f16_sdwa v1, v2, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
11647 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
11648 ; GFX8-NEXT: .LBB43_1: ; %atomicrmw.start
11649 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
11650 ; GFX8-NEXT: s_waitcnt vmcnt(0)
11651 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
11652 ; GFX8-NEXT: v_max_f16_sdwa v0, v6, v6 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
11653 ; GFX8-NEXT: v_max_f16_e32 v5, v6, v6
11654 ; GFX8-NEXT: v_max_f16_sdwa v0, v0, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11655 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v2
11656 ; GFX8-NEXT: v_or_b32_e32 v5, v5, v0
11657 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
11658 ; GFX8-NEXT: s_waitcnt vmcnt(0)
11659 ; GFX8-NEXT: buffer_wbinvl1
11660 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
11661 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11662 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
11663 ; GFX8-NEXT: s_cbranch_execnz .LBB43_1
11664 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
11665 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
11666 ; GFX8-NEXT: s_setpc_b64 s[30:31]
11668 ; GFX7-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_pos:
11670 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11671 ; GFX7-NEXT: s_mov_b32 s6, 0
11672 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
11673 ; GFX7-NEXT: s_mov_b32 s4, s6
11674 ; GFX7-NEXT: s_mov_b32 s5, s6
11675 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
11676 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
11677 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
11678 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
11679 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v3
11680 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11681 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
11682 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
11683 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
11684 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v6
11685 ; GFX7-NEXT: .LBB43_1: ; %atomicrmw.start
11686 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
11687 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
11688 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
11689 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v3
11690 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v2
11691 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
11692 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v4
11693 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v5
11694 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
11695 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
11696 ; GFX7-NEXT: v_or_b32_e32 v7, v2, v3
11697 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v6
11698 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v2
11699 ; GFX7-NEXT: v_mov_b32_e32 v9, v7
11700 ; GFX7-NEXT: v_mov_b32_e32 v8, v6
11701 ; GFX7-NEXT: buffer_atomic_cmpswap v[8:9], v[0:1], s[4:7], 0 addr64 offset:2044 glc
11702 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11703 ; GFX7-NEXT: buffer_wbinvl1
11704 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v8
11705 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v8
11706 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
11707 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v8, v7
11708 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
11709 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
11710 ; GFX7-NEXT: s_cbranch_execnz .LBB43_1
11711 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
11712 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
11713 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
11714 ; GFX7-NEXT: v_mov_b32_e32 v1, v3
11715 ; GFX7-NEXT: s_setpc_b64 s[30:31]
11717 ; GFX6-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_pos:
11719 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11720 ; GFX6-NEXT: s_mov_b32 s6, 0
11721 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
11722 ; GFX6-NEXT: s_mov_b32 s4, s6
11723 ; GFX6-NEXT: s_mov_b32 s5, s6
11724 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
11725 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
11726 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v2
11727 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
11728 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v3
11729 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11730 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v5
11731 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v5
11732 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
11733 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v6
11734 ; GFX6-NEXT: .LBB43_1: ; %atomicrmw.start
11735 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
11736 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
11737 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
11738 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v3
11739 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v2
11740 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
11741 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v4
11742 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v5
11743 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v6
11744 ; GFX6-NEXT: s_waitcnt expcnt(0)
11745 ; GFX6-NEXT: v_cvt_f16_f32_e32 v8, v7
11746 ; GFX6-NEXT: v_or_b32_e32 v7, v2, v3
11747 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v6
11748 ; GFX6-NEXT: v_or_b32_e32 v6, v8, v2
11749 ; GFX6-NEXT: v_mov_b32_e32 v9, v7
11750 ; GFX6-NEXT: v_mov_b32_e32 v8, v6
11751 ; GFX6-NEXT: buffer_atomic_cmpswap v[8:9], v[0:1], s[4:7], 0 addr64 offset:2044 glc
11752 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11753 ; GFX6-NEXT: buffer_wbinvl1
11754 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v8
11755 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v8
11756 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
11757 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v8, v7
11758 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
11759 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
11760 ; GFX6-NEXT: s_cbranch_execnz .LBB43_1
11761 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
11762 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
11763 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
11764 ; GFX6-NEXT: v_mov_b32_e32 v1, v3
11765 ; GFX6-NEXT: s_waitcnt expcnt(0)
11766 ; GFX6-NEXT: s_setpc_b64 s[30:31]
11767 %gep = getelementptr <2 x half>, ptr addrspace(1) %ptr, i64 511
11768 %result = atomicrmw fmax ptr addrspace(1) %gep, <2 x half> %val syncscope("agent") seq_cst
11769 ret <2 x half> %result
11772 define <2 x half> @global_agent_atomic_fmax_ret_v2f16__offset12b_neg(ptr addrspace(1) %ptr, <2 x half> %val) #0 {
11773 ; GFX12-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_neg:
11775 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11776 ; GFX12-NEXT: s_wait_expcnt 0x0
11777 ; GFX12-NEXT: s_wait_samplecnt 0x0
11778 ; GFX12-NEXT: s_wait_bvhcnt 0x0
11779 ; GFX12-NEXT: s_wait_kmcnt 0x0
11780 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:-2048
11781 ; GFX12-NEXT: v_pk_max_num_f16 v2, v2, v2
11782 ; GFX12-NEXT: s_mov_b32 s0, 0
11783 ; GFX12-NEXT: .LBB44_1: ; %atomicrmw.start
11784 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
11785 ; GFX12-NEXT: s_wait_loadcnt 0x0
11786 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
11787 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11788 ; GFX12-NEXT: v_pk_max_num_f16 v3, v4, v4
11789 ; GFX12-NEXT: v_pk_max_num_f16 v3, v3, v2
11790 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
11791 ; GFX12-NEXT: s_wait_storecnt 0x0
11792 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
11793 ; GFX12-NEXT: s_wait_loadcnt 0x0
11794 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
11795 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11796 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
11797 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11798 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11799 ; GFX12-NEXT: s_cbranch_execnz .LBB44_1
11800 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
11801 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
11802 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
11803 ; GFX12-NEXT: s_setpc_b64 s[30:31]
11805 ; GFX940-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_neg:
11807 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11808 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:-2048
11809 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
11810 ; GFX940-NEXT: v_pk_max_f16 v2, v2, v2
11811 ; GFX940-NEXT: .LBB44_1: ; %atomicrmw.start
11812 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
11813 ; GFX940-NEXT: s_waitcnt vmcnt(0)
11814 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
11815 ; GFX940-NEXT: v_pk_max_f16 v3, v5, v5
11816 ; GFX940-NEXT: s_nop 0
11817 ; GFX940-NEXT: v_pk_max_f16 v4, v3, v2
11818 ; GFX940-NEXT: buffer_wbl2 sc1
11819 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:-2048 sc0
11820 ; GFX940-NEXT: s_waitcnt vmcnt(0)
11821 ; GFX940-NEXT: buffer_inv sc1
11822 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
11823 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
11824 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
11825 ; GFX940-NEXT: s_cbranch_execnz .LBB44_1
11826 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
11827 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
11828 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
11829 ; GFX940-NEXT: s_setpc_b64 s[30:31]
11831 ; GFX11-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_neg:
11833 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11834 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:-2048
11835 ; GFX11-NEXT: v_pk_max_f16 v2, v2, v2
11836 ; GFX11-NEXT: s_mov_b32 s0, 0
11837 ; GFX11-NEXT: .LBB44_1: ; %atomicrmw.start
11838 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
11839 ; GFX11-NEXT: s_waitcnt vmcnt(0)
11840 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
11841 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11842 ; GFX11-NEXT: v_pk_max_f16 v3, v4, v4
11843 ; GFX11-NEXT: v_pk_max_f16 v3, v3, v2
11844 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
11845 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:-2048 glc
11846 ; GFX11-NEXT: s_waitcnt vmcnt(0)
11847 ; GFX11-NEXT: buffer_gl1_inv
11848 ; GFX11-NEXT: buffer_gl0_inv
11849 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11850 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
11851 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11852 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11853 ; GFX11-NEXT: s_cbranch_execnz .LBB44_1
11854 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
11855 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
11856 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
11857 ; GFX11-NEXT: s_setpc_b64 s[30:31]
11859 ; GFX10-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_neg:
11861 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11862 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:-2048
11863 ; GFX10-NEXT: v_pk_max_f16 v2, v2, v2
11864 ; GFX10-NEXT: s_mov_b32 s4, 0
11865 ; GFX10-NEXT: .LBB44_1: ; %atomicrmw.start
11866 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
11867 ; GFX10-NEXT: s_waitcnt vmcnt(0)
11868 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
11869 ; GFX10-NEXT: v_pk_max_f16 v3, v4, v4
11870 ; GFX10-NEXT: v_pk_max_f16 v3, v3, v2
11871 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
11872 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:-2048 glc
11873 ; GFX10-NEXT: s_waitcnt vmcnt(0)
11874 ; GFX10-NEXT: buffer_gl1_inv
11875 ; GFX10-NEXT: buffer_gl0_inv
11876 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11877 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
11878 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
11879 ; GFX10-NEXT: s_cbranch_execnz .LBB44_1
11880 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
11881 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
11882 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
11883 ; GFX10-NEXT: s_setpc_b64 s[30:31]
11885 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_neg:
11887 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11888 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:-2048
11889 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
11890 ; GFX90A-NEXT: v_pk_max_f16 v2, v2, v2
11891 ; GFX90A-NEXT: .LBB44_1: ; %atomicrmw.start
11892 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
11893 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
11894 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
11895 ; GFX90A-NEXT: v_pk_max_f16 v3, v5, v5
11896 ; GFX90A-NEXT: v_pk_max_f16 v4, v3, v2
11897 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:-2048 glc
11898 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
11899 ; GFX90A-NEXT: buffer_wbinvl1
11900 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
11901 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11902 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
11903 ; GFX90A-NEXT: s_cbranch_execnz .LBB44_1
11904 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
11905 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
11906 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
11907 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
11909 ; GFX908-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_neg:
11911 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11912 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:-2048
11913 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
11914 ; GFX908-NEXT: v_pk_max_f16 v2, v2, v2
11915 ; GFX908-NEXT: .LBB44_1: ; %atomicrmw.start
11916 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
11917 ; GFX908-NEXT: s_waitcnt vmcnt(0)
11918 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
11919 ; GFX908-NEXT: v_pk_max_f16 v3, v4, v4
11920 ; GFX908-NEXT: v_pk_max_f16 v3, v3, v2
11921 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:-2048 glc
11922 ; GFX908-NEXT: s_waitcnt vmcnt(0)
11923 ; GFX908-NEXT: buffer_wbinvl1
11924 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
11925 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11926 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
11927 ; GFX908-NEXT: s_cbranch_execnz .LBB44_1
11928 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
11929 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
11930 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
11931 ; GFX908-NEXT: s_setpc_b64 s[30:31]
11933 ; GFX8-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_neg:
11935 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11936 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
11937 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
11938 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
11939 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
11940 ; GFX8-NEXT: v_max_f16_sdwa v1, v2, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
11941 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
11942 ; GFX8-NEXT: .LBB44_1: ; %atomicrmw.start
11943 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
11944 ; GFX8-NEXT: s_waitcnt vmcnt(0)
11945 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
11946 ; GFX8-NEXT: v_max_f16_sdwa v0, v6, v6 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
11947 ; GFX8-NEXT: v_max_f16_e32 v5, v6, v6
11948 ; GFX8-NEXT: v_max_f16_sdwa v0, v0, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11949 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v2
11950 ; GFX8-NEXT: v_or_b32_e32 v5, v5, v0
11951 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
11952 ; GFX8-NEXT: s_waitcnt vmcnt(0)
11953 ; GFX8-NEXT: buffer_wbinvl1
11954 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
11955 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11956 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
11957 ; GFX8-NEXT: s_cbranch_execnz .LBB44_1
11958 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
11959 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
11960 ; GFX8-NEXT: s_setpc_b64 s[30:31]
11962 ; GFX7-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_neg:
11964 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11965 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
11966 ; GFX7-NEXT: s_mov_b32 s5, -1
11967 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
11968 ; GFX7-NEXT: s_mov_b32 s6, 0
11969 ; GFX7-NEXT: buffer_load_dword v6, v[0:1], s[4:7], 0 addr64
11970 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
11971 ; GFX7-NEXT: v_cvt_f16_f32_e32 v0, v3
11972 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v2
11973 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, -1, v1, vcc
11974 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v0
11975 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
11976 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
11977 ; GFX7-NEXT: s_mov_b32 s4, s6
11978 ; GFX7-NEXT: s_mov_b32 s5, s6
11979 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11980 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v6
11981 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v6
11982 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
11983 ; GFX7-NEXT: .LBB44_1: ; %atomicrmw.start
11984 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
11985 ; GFX7-NEXT: v_cvt_f16_f32_e32 v1, v1
11986 ; GFX7-NEXT: v_cvt_f16_f32_e32 v0, v0
11987 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v1
11988 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v0
11989 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 16, v1
11990 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
11991 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
11992 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
11993 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
11994 ; GFX7-NEXT: v_or_b32_e32 v7, v0, v1
11995 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v6
11996 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v0
11997 ; GFX7-NEXT: v_mov_b32_e32 v9, v7
11998 ; GFX7-NEXT: v_mov_b32_e32 v8, v6
11999 ; GFX7-NEXT: buffer_atomic_cmpswap v[8:9], v[4:5], s[4:7], 0 addr64 glc
12000 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12001 ; GFX7-NEXT: buffer_wbinvl1
12002 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v8
12003 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v8
12004 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
12005 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v8, v7
12006 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
12007 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
12008 ; GFX7-NEXT: s_cbranch_execnz .LBB44_1
12009 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
12010 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
12011 ; GFX7-NEXT: s_setpc_b64 s[30:31]
12013 ; GFX6-LABEL: global_agent_atomic_fmax_ret_v2f16__offset12b_neg:
12015 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12016 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
12017 ; GFX6-NEXT: s_mov_b32 s5, -1
12018 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
12019 ; GFX6-NEXT: s_mov_b32 s6, 0
12020 ; GFX6-NEXT: buffer_load_dword v6, v[0:1], s[4:7], 0 addr64
12021 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
12022 ; GFX6-NEXT: v_cvt_f16_f32_e32 v0, v3
12023 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v2
12024 ; GFX6-NEXT: v_addc_u32_e32 v5, vcc, -1, v1, vcc
12025 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v0
12026 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
12027 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
12028 ; GFX6-NEXT: s_mov_b32 s4, s6
12029 ; GFX6-NEXT: s_mov_b32 s5, s6
12030 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12031 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v6
12032 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v6
12033 ; GFX6-NEXT: v_cvt_f32_f16_e32 v1, v1
12034 ; GFX6-NEXT: .LBB44_1: ; %atomicrmw.start
12035 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
12036 ; GFX6-NEXT: v_cvt_f16_f32_e32 v1, v1
12037 ; GFX6-NEXT: v_cvt_f16_f32_e32 v0, v0
12038 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v1
12039 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v0
12040 ; GFX6-NEXT: v_lshlrev_b32_e32 v1, 16, v1
12041 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
12042 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
12043 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v6
12044 ; GFX6-NEXT: s_waitcnt expcnt(0)
12045 ; GFX6-NEXT: v_cvt_f16_f32_e32 v8, v7
12046 ; GFX6-NEXT: v_or_b32_e32 v7, v0, v1
12047 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v6
12048 ; GFX6-NEXT: v_or_b32_e32 v6, v8, v0
12049 ; GFX6-NEXT: v_mov_b32_e32 v9, v7
12050 ; GFX6-NEXT: v_mov_b32_e32 v8, v6
12051 ; GFX6-NEXT: buffer_atomic_cmpswap v[8:9], v[4:5], s[4:7], 0 addr64 glc
12052 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12053 ; GFX6-NEXT: buffer_wbinvl1
12054 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v8
12055 ; GFX6-NEXT: v_cvt_f32_f16_e32 v0, v8
12056 ; GFX6-NEXT: v_cvt_f32_f16_e32 v1, v1
12057 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v8, v7
12058 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
12059 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
12060 ; GFX6-NEXT: s_cbranch_execnz .LBB44_1
12061 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
12062 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
12063 ; GFX6-NEXT: s_waitcnt expcnt(0)
12064 ; GFX6-NEXT: s_setpc_b64 s[30:31]
12065 %gep = getelementptr <2 x half>, ptr addrspace(1) %ptr, i64 -512
12066 %result = atomicrmw fmax ptr addrspace(1) %gep, <2 x half> %val syncscope("agent") seq_cst
12067 ret <2 x half> %result
12070 define void @global_agent_atomic_fmax_noret_v2f16(ptr addrspace(1) %ptr, <2 x half> %val) #0 {
12071 ; GFX12-LABEL: global_agent_atomic_fmax_noret_v2f16:
12073 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12074 ; GFX12-NEXT: s_wait_expcnt 0x0
12075 ; GFX12-NEXT: s_wait_samplecnt 0x0
12076 ; GFX12-NEXT: s_wait_bvhcnt 0x0
12077 ; GFX12-NEXT: s_wait_kmcnt 0x0
12078 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
12079 ; GFX12-NEXT: v_pk_max_num_f16 v4, v2, v2
12080 ; GFX12-NEXT: s_mov_b32 s0, 0
12081 ; GFX12-NEXT: .LBB45_1: ; %atomicrmw.start
12082 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
12083 ; GFX12-NEXT: s_wait_loadcnt 0x0
12084 ; GFX12-NEXT: v_pk_max_num_f16 v2, v3, v3
12085 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
12086 ; GFX12-NEXT: v_pk_max_num_f16 v2, v2, v4
12087 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
12088 ; GFX12-NEXT: s_wait_storecnt 0x0
12089 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
12090 ; GFX12-NEXT: s_wait_loadcnt 0x0
12091 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
12092 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12093 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
12094 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
12095 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12096 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12097 ; GFX12-NEXT: s_cbranch_execnz .LBB45_1
12098 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
12099 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
12100 ; GFX12-NEXT: s_setpc_b64 s[30:31]
12102 ; GFX940-LABEL: global_agent_atomic_fmax_noret_v2f16:
12104 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12105 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
12106 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
12107 ; GFX940-NEXT: v_pk_max_f16 v4, v2, v2
12108 ; GFX940-NEXT: .LBB45_1: ; %atomicrmw.start
12109 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
12110 ; GFX940-NEXT: s_waitcnt vmcnt(0)
12111 ; GFX940-NEXT: v_pk_max_f16 v2, v3, v3
12112 ; GFX940-NEXT: s_nop 0
12113 ; GFX940-NEXT: v_pk_max_f16 v2, v2, v4
12114 ; GFX940-NEXT: buffer_wbl2 sc1
12115 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0
12116 ; GFX940-NEXT: s_waitcnt vmcnt(0)
12117 ; GFX940-NEXT: buffer_inv sc1
12118 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12119 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
12120 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
12121 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
12122 ; GFX940-NEXT: s_cbranch_execnz .LBB45_1
12123 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
12124 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
12125 ; GFX940-NEXT: s_setpc_b64 s[30:31]
12127 ; GFX11-LABEL: global_agent_atomic_fmax_noret_v2f16:
12129 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12130 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
12131 ; GFX11-NEXT: v_pk_max_f16 v4, v2, v2
12132 ; GFX11-NEXT: s_mov_b32 s0, 0
12133 ; GFX11-NEXT: .LBB45_1: ; %atomicrmw.start
12134 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
12135 ; GFX11-NEXT: s_waitcnt vmcnt(0)
12136 ; GFX11-NEXT: v_pk_max_f16 v2, v3, v3
12137 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
12138 ; GFX11-NEXT: v_pk_max_f16 v2, v2, v4
12139 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
12140 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
12141 ; GFX11-NEXT: s_waitcnt vmcnt(0)
12142 ; GFX11-NEXT: buffer_gl1_inv
12143 ; GFX11-NEXT: buffer_gl0_inv
12144 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12145 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
12146 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
12147 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12148 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12149 ; GFX11-NEXT: s_cbranch_execnz .LBB45_1
12150 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
12151 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
12152 ; GFX11-NEXT: s_setpc_b64 s[30:31]
12154 ; GFX10-LABEL: global_agent_atomic_fmax_noret_v2f16:
12156 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12157 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
12158 ; GFX10-NEXT: v_pk_max_f16 v4, v2, v2
12159 ; GFX10-NEXT: s_mov_b32 s4, 0
12160 ; GFX10-NEXT: .LBB45_1: ; %atomicrmw.start
12161 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
12162 ; GFX10-NEXT: s_waitcnt vmcnt(0)
12163 ; GFX10-NEXT: v_pk_max_f16 v2, v3, v3
12164 ; GFX10-NEXT: v_pk_max_f16 v2, v2, v4
12165 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
12166 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
12167 ; GFX10-NEXT: s_waitcnt vmcnt(0)
12168 ; GFX10-NEXT: buffer_gl1_inv
12169 ; GFX10-NEXT: buffer_gl0_inv
12170 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12171 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
12172 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
12173 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
12174 ; GFX10-NEXT: s_cbranch_execnz .LBB45_1
12175 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
12176 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
12177 ; GFX10-NEXT: s_setpc_b64 s[30:31]
12179 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_v2f16:
12181 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12182 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
12183 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
12184 ; GFX90A-NEXT: v_pk_max_f16 v4, v2, v2
12185 ; GFX90A-NEXT: .LBB45_1: ; %atomicrmw.start
12186 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
12187 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
12188 ; GFX90A-NEXT: v_pk_max_f16 v2, v3, v3
12189 ; GFX90A-NEXT: v_pk_max_f16 v2, v2, v4
12190 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
12191 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
12192 ; GFX90A-NEXT: buffer_wbinvl1
12193 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12194 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12195 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
12196 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
12197 ; GFX90A-NEXT: s_cbranch_execnz .LBB45_1
12198 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
12199 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
12200 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
12202 ; GFX908-LABEL: global_agent_atomic_fmax_noret_v2f16:
12204 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12205 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
12206 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
12207 ; GFX908-NEXT: v_pk_max_f16 v4, v2, v2
12208 ; GFX908-NEXT: .LBB45_1: ; %atomicrmw.start
12209 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
12210 ; GFX908-NEXT: s_waitcnt vmcnt(0)
12211 ; GFX908-NEXT: v_pk_max_f16 v2, v3, v3
12212 ; GFX908-NEXT: v_pk_max_f16 v2, v2, v4
12213 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
12214 ; GFX908-NEXT: s_waitcnt vmcnt(0)
12215 ; GFX908-NEXT: buffer_wbinvl1
12216 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12217 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12218 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
12219 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
12220 ; GFX908-NEXT: s_cbranch_execnz .LBB45_1
12221 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
12222 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
12223 ; GFX908-NEXT: s_setpc_b64 s[30:31]
12225 ; GFX8-LABEL: global_agent_atomic_fmax_noret_v2f16:
12227 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12228 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
12229 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
12230 ; GFX8-NEXT: v_max_f16_sdwa v4, v2, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
12231 ; GFX8-NEXT: v_max_f16_e32 v5, v2, v2
12232 ; GFX8-NEXT: .LBB45_1: ; %atomicrmw.start
12233 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
12234 ; GFX8-NEXT: s_waitcnt vmcnt(0)
12235 ; GFX8-NEXT: v_max_f16_sdwa v2, v3, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
12236 ; GFX8-NEXT: v_max_f16_e32 v6, v3, v3
12237 ; GFX8-NEXT: v_max_f16_sdwa v2, v2, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12238 ; GFX8-NEXT: v_max_f16_e32 v6, v6, v5
12239 ; GFX8-NEXT: v_or_b32_e32 v2, v6, v2
12240 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12241 ; GFX8-NEXT: s_waitcnt vmcnt(0)
12242 ; GFX8-NEXT: buffer_wbinvl1
12243 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12244 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12245 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
12246 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
12247 ; GFX8-NEXT: s_cbranch_execnz .LBB45_1
12248 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
12249 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
12250 ; GFX8-NEXT: s_setpc_b64 s[30:31]
12252 ; GFX7-LABEL: global_agent_atomic_fmax_noret_v2f16:
12254 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12255 ; GFX7-NEXT: s_mov_b32 s6, 0
12256 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
12257 ; GFX7-NEXT: s_mov_b32 s4, s6
12258 ; GFX7-NEXT: s_mov_b32 s5, s6
12259 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64
12260 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
12261 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
12262 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
12263 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
12264 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12265 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
12266 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
12267 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
12268 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
12269 ; GFX7-NEXT: .LBB45_1: ; %atomicrmw.start
12270 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
12271 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
12272 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
12273 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
12274 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
12275 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
12276 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
12277 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
12278 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
12279 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
12280 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
12281 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
12282 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
12283 ; GFX7-NEXT: v_mov_b32_e32 v8, v6
12284 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
12285 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
12286 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12287 ; GFX7-NEXT: buffer_wbinvl1
12288 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
12289 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
12290 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
12291 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
12292 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
12293 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
12294 ; GFX7-NEXT: s_cbranch_execnz .LBB45_1
12295 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
12296 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
12297 ; GFX7-NEXT: s_setpc_b64 s[30:31]
12299 ; GFX6-LABEL: global_agent_atomic_fmax_noret_v2f16:
12301 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12302 ; GFX6-NEXT: s_mov_b32 s6, 0
12303 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
12304 ; GFX6-NEXT: s_mov_b32 s4, s6
12305 ; GFX6-NEXT: s_mov_b32 s5, s6
12306 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64
12307 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
12308 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v2
12309 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
12310 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v3
12311 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12312 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v5
12313 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v5
12314 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v3
12315 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v6
12316 ; GFX6-NEXT: .LBB45_1: ; %atomicrmw.start
12317 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
12318 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v5
12319 ; GFX6-NEXT: v_cvt_f16_f32_e32 v4, v4
12320 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v5
12321 ; GFX6-NEXT: s_waitcnt expcnt(0)
12322 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v4
12323 ; GFX6-NEXT: v_lshlrev_b32_e32 v5, 16, v5
12324 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
12325 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
12326 ; GFX6-NEXT: v_cvt_f16_f32_e32 v8, v6
12327 ; GFX6-NEXT: v_cvt_f16_f32_e32 v7, v7
12328 ; GFX6-NEXT: v_or_b32_e32 v6, v4, v5
12329 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v8
12330 ; GFX6-NEXT: v_or_b32_e32 v5, v7, v4
12331 ; GFX6-NEXT: v_mov_b32_e32 v8, v6
12332 ; GFX6-NEXT: v_mov_b32_e32 v7, v5
12333 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
12334 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12335 ; GFX6-NEXT: buffer_wbinvl1
12336 ; GFX6-NEXT: v_lshrrev_b32_e32 v5, 16, v7
12337 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v7
12338 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v5
12339 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
12340 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
12341 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
12342 ; GFX6-NEXT: s_cbranch_execnz .LBB45_1
12343 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
12344 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
12345 ; GFX6-NEXT: s_waitcnt expcnt(0)
12346 ; GFX6-NEXT: s_setpc_b64 s[30:31]
12347 %unused = atomicrmw fmax ptr addrspace(1) %ptr, <2 x half> %val syncscope("agent") seq_cst
12351 define void @global_agent_atomic_fmax_noret_v2f16__offset12b_pos(ptr addrspace(1) %ptr, <2 x half> %val) #0 {
12352 ; GFX12-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_pos:
12354 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12355 ; GFX12-NEXT: s_wait_expcnt 0x0
12356 ; GFX12-NEXT: s_wait_samplecnt 0x0
12357 ; GFX12-NEXT: s_wait_bvhcnt 0x0
12358 ; GFX12-NEXT: s_wait_kmcnt 0x0
12359 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
12360 ; GFX12-NEXT: v_pk_max_num_f16 v4, v2, v2
12361 ; GFX12-NEXT: s_mov_b32 s0, 0
12362 ; GFX12-NEXT: .LBB46_1: ; %atomicrmw.start
12363 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
12364 ; GFX12-NEXT: s_wait_loadcnt 0x0
12365 ; GFX12-NEXT: v_pk_max_num_f16 v2, v3, v3
12366 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
12367 ; GFX12-NEXT: v_pk_max_num_f16 v2, v2, v4
12368 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
12369 ; GFX12-NEXT: s_wait_storecnt 0x0
12370 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
12371 ; GFX12-NEXT: s_wait_loadcnt 0x0
12372 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
12373 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12374 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
12375 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
12376 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12377 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12378 ; GFX12-NEXT: s_cbranch_execnz .LBB46_1
12379 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
12380 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
12381 ; GFX12-NEXT: s_setpc_b64 s[30:31]
12383 ; GFX940-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_pos:
12385 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12386 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
12387 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
12388 ; GFX940-NEXT: v_pk_max_f16 v4, v2, v2
12389 ; GFX940-NEXT: .LBB46_1: ; %atomicrmw.start
12390 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
12391 ; GFX940-NEXT: s_waitcnt vmcnt(0)
12392 ; GFX940-NEXT: v_pk_max_f16 v2, v3, v3
12393 ; GFX940-NEXT: s_nop 0
12394 ; GFX940-NEXT: v_pk_max_f16 v2, v2, v4
12395 ; GFX940-NEXT: buffer_wbl2 sc1
12396 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 sc0
12397 ; GFX940-NEXT: s_waitcnt vmcnt(0)
12398 ; GFX940-NEXT: buffer_inv sc1
12399 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12400 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
12401 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
12402 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
12403 ; GFX940-NEXT: s_cbranch_execnz .LBB46_1
12404 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
12405 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
12406 ; GFX940-NEXT: s_setpc_b64 s[30:31]
12408 ; GFX11-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_pos:
12410 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12411 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
12412 ; GFX11-NEXT: v_pk_max_f16 v4, v2, v2
12413 ; GFX11-NEXT: s_mov_b32 s0, 0
12414 ; GFX11-NEXT: .LBB46_1: ; %atomicrmw.start
12415 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
12416 ; GFX11-NEXT: s_waitcnt vmcnt(0)
12417 ; GFX11-NEXT: v_pk_max_f16 v2, v3, v3
12418 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
12419 ; GFX11-NEXT: v_pk_max_f16 v2, v2, v4
12420 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
12421 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 glc
12422 ; GFX11-NEXT: s_waitcnt vmcnt(0)
12423 ; GFX11-NEXT: buffer_gl1_inv
12424 ; GFX11-NEXT: buffer_gl0_inv
12425 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12426 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
12427 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
12428 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12429 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12430 ; GFX11-NEXT: s_cbranch_execnz .LBB46_1
12431 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
12432 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
12433 ; GFX11-NEXT: s_setpc_b64 s[30:31]
12435 ; GFX10-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_pos:
12437 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12438 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
12439 ; GFX10-NEXT: v_pk_max_f16 v4, v2, v2
12440 ; GFX10-NEXT: s_mov_b32 s4, 0
12441 ; GFX10-NEXT: .LBB46_1: ; %atomicrmw.start
12442 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
12443 ; GFX10-NEXT: s_waitcnt vmcnt(0)
12444 ; GFX10-NEXT: v_pk_max_f16 v2, v3, v3
12445 ; GFX10-NEXT: v_pk_max_f16 v2, v2, v4
12446 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
12447 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
12448 ; GFX10-NEXT: s_waitcnt vmcnt(0)
12449 ; GFX10-NEXT: buffer_gl1_inv
12450 ; GFX10-NEXT: buffer_gl0_inv
12451 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12452 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
12453 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
12454 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
12455 ; GFX10-NEXT: s_cbranch_execnz .LBB46_1
12456 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
12457 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
12458 ; GFX10-NEXT: s_setpc_b64 s[30:31]
12460 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_pos:
12462 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12463 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
12464 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
12465 ; GFX90A-NEXT: v_pk_max_f16 v4, v2, v2
12466 ; GFX90A-NEXT: .LBB46_1: ; %atomicrmw.start
12467 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
12468 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
12469 ; GFX90A-NEXT: v_pk_max_f16 v2, v3, v3
12470 ; GFX90A-NEXT: v_pk_max_f16 v2, v2, v4
12471 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
12472 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
12473 ; GFX90A-NEXT: buffer_wbinvl1
12474 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12475 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12476 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
12477 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
12478 ; GFX90A-NEXT: s_cbranch_execnz .LBB46_1
12479 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
12480 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
12481 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
12483 ; GFX908-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_pos:
12485 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12486 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
12487 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
12488 ; GFX908-NEXT: v_pk_max_f16 v4, v2, v2
12489 ; GFX908-NEXT: .LBB46_1: ; %atomicrmw.start
12490 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
12491 ; GFX908-NEXT: s_waitcnt vmcnt(0)
12492 ; GFX908-NEXT: v_pk_max_f16 v2, v3, v3
12493 ; GFX908-NEXT: v_pk_max_f16 v2, v2, v4
12494 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
12495 ; GFX908-NEXT: s_waitcnt vmcnt(0)
12496 ; GFX908-NEXT: buffer_wbinvl1
12497 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12498 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12499 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
12500 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
12501 ; GFX908-NEXT: s_cbranch_execnz .LBB46_1
12502 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
12503 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
12504 ; GFX908-NEXT: s_setpc_b64 s[30:31]
12506 ; GFX8-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_pos:
12508 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12509 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
12510 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
12511 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
12512 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
12513 ; GFX8-NEXT: v_max_f16_sdwa v4, v2, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
12514 ; GFX8-NEXT: v_max_f16_e32 v5, v2, v2
12515 ; GFX8-NEXT: .LBB46_1: ; %atomicrmw.start
12516 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
12517 ; GFX8-NEXT: s_waitcnt vmcnt(0)
12518 ; GFX8-NEXT: v_max_f16_sdwa v2, v3, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
12519 ; GFX8-NEXT: v_max_f16_e32 v6, v3, v3
12520 ; GFX8-NEXT: v_max_f16_sdwa v2, v2, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12521 ; GFX8-NEXT: v_max_f16_e32 v6, v6, v5
12522 ; GFX8-NEXT: v_or_b32_e32 v2, v6, v2
12523 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12524 ; GFX8-NEXT: s_waitcnt vmcnt(0)
12525 ; GFX8-NEXT: buffer_wbinvl1
12526 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12527 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12528 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
12529 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
12530 ; GFX8-NEXT: s_cbranch_execnz .LBB46_1
12531 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
12532 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
12533 ; GFX8-NEXT: s_setpc_b64 s[30:31]
12535 ; GFX7-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_pos:
12537 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12538 ; GFX7-NEXT: s_mov_b32 s6, 0
12539 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
12540 ; GFX7-NEXT: s_mov_b32 s4, s6
12541 ; GFX7-NEXT: s_mov_b32 s5, s6
12542 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
12543 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
12544 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
12545 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
12546 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
12547 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12548 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
12549 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
12550 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
12551 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
12552 ; GFX7-NEXT: .LBB46_1: ; %atomicrmw.start
12553 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
12554 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
12555 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
12556 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
12557 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
12558 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
12559 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
12560 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
12561 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
12562 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
12563 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
12564 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
12565 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
12566 ; GFX7-NEXT: v_mov_b32_e32 v8, v6
12567 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
12568 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 offset:2044 glc
12569 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12570 ; GFX7-NEXT: buffer_wbinvl1
12571 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
12572 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
12573 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
12574 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
12575 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
12576 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
12577 ; GFX7-NEXT: s_cbranch_execnz .LBB46_1
12578 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
12579 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
12580 ; GFX7-NEXT: s_setpc_b64 s[30:31]
12582 ; GFX6-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_pos:
12584 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12585 ; GFX6-NEXT: s_mov_b32 s6, 0
12586 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
12587 ; GFX6-NEXT: s_mov_b32 s4, s6
12588 ; GFX6-NEXT: s_mov_b32 s5, s6
12589 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
12590 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
12591 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v2
12592 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
12593 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v3
12594 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12595 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v5
12596 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v5
12597 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v3
12598 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v6
12599 ; GFX6-NEXT: .LBB46_1: ; %atomicrmw.start
12600 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
12601 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v5
12602 ; GFX6-NEXT: v_cvt_f16_f32_e32 v4, v4
12603 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v5
12604 ; GFX6-NEXT: s_waitcnt expcnt(0)
12605 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v4
12606 ; GFX6-NEXT: v_lshlrev_b32_e32 v5, 16, v5
12607 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
12608 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
12609 ; GFX6-NEXT: v_cvt_f16_f32_e32 v8, v6
12610 ; GFX6-NEXT: v_cvt_f16_f32_e32 v7, v7
12611 ; GFX6-NEXT: v_or_b32_e32 v6, v4, v5
12612 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v8
12613 ; GFX6-NEXT: v_or_b32_e32 v5, v7, v4
12614 ; GFX6-NEXT: v_mov_b32_e32 v8, v6
12615 ; GFX6-NEXT: v_mov_b32_e32 v7, v5
12616 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 offset:2044 glc
12617 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12618 ; GFX6-NEXT: buffer_wbinvl1
12619 ; GFX6-NEXT: v_lshrrev_b32_e32 v5, 16, v7
12620 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v7
12621 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v5
12622 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
12623 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
12624 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
12625 ; GFX6-NEXT: s_cbranch_execnz .LBB46_1
12626 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
12627 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
12628 ; GFX6-NEXT: s_waitcnt expcnt(0)
12629 ; GFX6-NEXT: s_setpc_b64 s[30:31]
12630 %gep = getelementptr <2 x half>, ptr addrspace(1) %ptr, i64 511
12631 %unused = atomicrmw fmax ptr addrspace(1) %gep, <2 x half> %val syncscope("agent") seq_cst
12635 define void @global_agent_atomic_fmax_noret_v2f16__offset12b_neg(ptr addrspace(1) %ptr, <2 x half> %val) #0 {
12636 ; GFX12-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_neg:
12638 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12639 ; GFX12-NEXT: s_wait_expcnt 0x0
12640 ; GFX12-NEXT: s_wait_samplecnt 0x0
12641 ; GFX12-NEXT: s_wait_bvhcnt 0x0
12642 ; GFX12-NEXT: s_wait_kmcnt 0x0
12643 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:-2048
12644 ; GFX12-NEXT: v_pk_max_num_f16 v4, v2, v2
12645 ; GFX12-NEXT: s_mov_b32 s0, 0
12646 ; GFX12-NEXT: .LBB47_1: ; %atomicrmw.start
12647 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
12648 ; GFX12-NEXT: s_wait_loadcnt 0x0
12649 ; GFX12-NEXT: v_pk_max_num_f16 v2, v3, v3
12650 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
12651 ; GFX12-NEXT: v_pk_max_num_f16 v2, v2, v4
12652 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
12653 ; GFX12-NEXT: s_wait_storecnt 0x0
12654 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
12655 ; GFX12-NEXT: s_wait_loadcnt 0x0
12656 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
12657 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12658 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
12659 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
12660 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12661 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12662 ; GFX12-NEXT: s_cbranch_execnz .LBB47_1
12663 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
12664 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
12665 ; GFX12-NEXT: s_setpc_b64 s[30:31]
12667 ; GFX940-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_neg:
12669 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12670 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:-2048
12671 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
12672 ; GFX940-NEXT: v_pk_max_f16 v4, v2, v2
12673 ; GFX940-NEXT: .LBB47_1: ; %atomicrmw.start
12674 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
12675 ; GFX940-NEXT: s_waitcnt vmcnt(0)
12676 ; GFX940-NEXT: v_pk_max_f16 v2, v3, v3
12677 ; GFX940-NEXT: s_nop 0
12678 ; GFX940-NEXT: v_pk_max_f16 v2, v2, v4
12679 ; GFX940-NEXT: buffer_wbl2 sc1
12680 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 sc0
12681 ; GFX940-NEXT: s_waitcnt vmcnt(0)
12682 ; GFX940-NEXT: buffer_inv sc1
12683 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12684 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
12685 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
12686 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
12687 ; GFX940-NEXT: s_cbranch_execnz .LBB47_1
12688 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
12689 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
12690 ; GFX940-NEXT: s_setpc_b64 s[30:31]
12692 ; GFX11-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_neg:
12694 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12695 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:-2048
12696 ; GFX11-NEXT: v_pk_max_f16 v4, v2, v2
12697 ; GFX11-NEXT: s_mov_b32 s0, 0
12698 ; GFX11-NEXT: .LBB47_1: ; %atomicrmw.start
12699 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
12700 ; GFX11-NEXT: s_waitcnt vmcnt(0)
12701 ; GFX11-NEXT: v_pk_max_f16 v2, v3, v3
12702 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
12703 ; GFX11-NEXT: v_pk_max_f16 v2, v2, v4
12704 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
12705 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:-2048 glc
12706 ; GFX11-NEXT: s_waitcnt vmcnt(0)
12707 ; GFX11-NEXT: buffer_gl1_inv
12708 ; GFX11-NEXT: buffer_gl0_inv
12709 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12710 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
12711 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
12712 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12713 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12714 ; GFX11-NEXT: s_cbranch_execnz .LBB47_1
12715 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
12716 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
12717 ; GFX11-NEXT: s_setpc_b64 s[30:31]
12719 ; GFX10-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_neg:
12721 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12722 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:-2048
12723 ; GFX10-NEXT: v_pk_max_f16 v4, v2, v2
12724 ; GFX10-NEXT: s_mov_b32 s4, 0
12725 ; GFX10-NEXT: .LBB47_1: ; %atomicrmw.start
12726 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
12727 ; GFX10-NEXT: s_waitcnt vmcnt(0)
12728 ; GFX10-NEXT: v_pk_max_f16 v2, v3, v3
12729 ; GFX10-NEXT: v_pk_max_f16 v2, v2, v4
12730 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
12731 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
12732 ; GFX10-NEXT: s_waitcnt vmcnt(0)
12733 ; GFX10-NEXT: buffer_gl1_inv
12734 ; GFX10-NEXT: buffer_gl0_inv
12735 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12736 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
12737 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
12738 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
12739 ; GFX10-NEXT: s_cbranch_execnz .LBB47_1
12740 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
12741 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
12742 ; GFX10-NEXT: s_setpc_b64 s[30:31]
12744 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_neg:
12746 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12747 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:-2048
12748 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
12749 ; GFX90A-NEXT: v_pk_max_f16 v4, v2, v2
12750 ; GFX90A-NEXT: .LBB47_1: ; %atomicrmw.start
12751 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
12752 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
12753 ; GFX90A-NEXT: v_pk_max_f16 v2, v3, v3
12754 ; GFX90A-NEXT: v_pk_max_f16 v2, v2, v4
12755 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
12756 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
12757 ; GFX90A-NEXT: buffer_wbinvl1
12758 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12759 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12760 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
12761 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
12762 ; GFX90A-NEXT: s_cbranch_execnz .LBB47_1
12763 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
12764 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
12765 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
12767 ; GFX908-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_neg:
12769 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12770 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:-2048
12771 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
12772 ; GFX908-NEXT: v_pk_max_f16 v4, v2, v2
12773 ; GFX908-NEXT: .LBB47_1: ; %atomicrmw.start
12774 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
12775 ; GFX908-NEXT: s_waitcnt vmcnt(0)
12776 ; GFX908-NEXT: v_pk_max_f16 v2, v3, v3
12777 ; GFX908-NEXT: v_pk_max_f16 v2, v2, v4
12778 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
12779 ; GFX908-NEXT: s_waitcnt vmcnt(0)
12780 ; GFX908-NEXT: buffer_wbinvl1
12781 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12782 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12783 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
12784 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
12785 ; GFX908-NEXT: s_cbranch_execnz .LBB47_1
12786 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
12787 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
12788 ; GFX908-NEXT: s_setpc_b64 s[30:31]
12790 ; GFX8-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_neg:
12792 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12793 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff800, v0
12794 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
12795 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
12796 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
12797 ; GFX8-NEXT: v_max_f16_sdwa v4, v2, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
12798 ; GFX8-NEXT: v_max_f16_e32 v5, v2, v2
12799 ; GFX8-NEXT: .LBB47_1: ; %atomicrmw.start
12800 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
12801 ; GFX8-NEXT: s_waitcnt vmcnt(0)
12802 ; GFX8-NEXT: v_max_f16_sdwa v2, v3, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
12803 ; GFX8-NEXT: v_max_f16_e32 v6, v3, v3
12804 ; GFX8-NEXT: v_max_f16_sdwa v2, v2, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12805 ; GFX8-NEXT: v_max_f16_e32 v6, v6, v5
12806 ; GFX8-NEXT: v_or_b32_e32 v2, v6, v2
12807 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12808 ; GFX8-NEXT: s_waitcnt vmcnt(0)
12809 ; GFX8-NEXT: buffer_wbinvl1
12810 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12811 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12812 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
12813 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
12814 ; GFX8-NEXT: s_cbranch_execnz .LBB47_1
12815 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
12816 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
12817 ; GFX8-NEXT: s_setpc_b64 s[30:31]
12819 ; GFX7-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_neg:
12821 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12822 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
12823 ; GFX7-NEXT: s_mov_b32 s5, -1
12824 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
12825 ; GFX7-NEXT: s_mov_b32 s6, 0
12826 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64
12827 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
12828 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
12829 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0xfffff800, v0
12830 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
12831 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
12832 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
12833 ; GFX7-NEXT: s_mov_b32 s4, s6
12834 ; GFX7-NEXT: s_mov_b32 s5, s6
12835 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12836 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
12837 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
12838 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
12839 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
12840 ; GFX7-NEXT: .LBB47_1: ; %atomicrmw.start
12841 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
12842 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
12843 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
12844 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
12845 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
12846 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
12847 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
12848 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
12849 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
12850 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
12851 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
12852 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
12853 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
12854 ; GFX7-NEXT: v_mov_b32_e32 v8, v6
12855 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
12856 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
12857 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12858 ; GFX7-NEXT: buffer_wbinvl1
12859 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
12860 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
12861 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
12862 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
12863 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
12864 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
12865 ; GFX7-NEXT: s_cbranch_execnz .LBB47_1
12866 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
12867 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
12868 ; GFX7-NEXT: s_setpc_b64 s[30:31]
12870 ; GFX6-LABEL: global_agent_atomic_fmax_noret_v2f16__offset12b_neg:
12872 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12873 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
12874 ; GFX6-NEXT: s_mov_b32 s5, -1
12875 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
12876 ; GFX6-NEXT: s_mov_b32 s6, 0
12877 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64
12878 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
12879 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v2
12880 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffff800, v0
12881 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v3
12882 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
12883 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
12884 ; GFX6-NEXT: s_mov_b32 s4, s6
12885 ; GFX6-NEXT: s_mov_b32 s5, s6
12886 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12887 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v5
12888 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v5
12889 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v3
12890 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v6
12891 ; GFX6-NEXT: .LBB47_1: ; %atomicrmw.start
12892 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
12893 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v5
12894 ; GFX6-NEXT: v_cvt_f16_f32_e32 v4, v4
12895 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v5
12896 ; GFX6-NEXT: s_waitcnt expcnt(0)
12897 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v4
12898 ; GFX6-NEXT: v_lshlrev_b32_e32 v5, 16, v5
12899 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
12900 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
12901 ; GFX6-NEXT: v_cvt_f16_f32_e32 v8, v6
12902 ; GFX6-NEXT: v_cvt_f16_f32_e32 v7, v7
12903 ; GFX6-NEXT: v_or_b32_e32 v6, v4, v5
12904 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v8
12905 ; GFX6-NEXT: v_or_b32_e32 v5, v7, v4
12906 ; GFX6-NEXT: v_mov_b32_e32 v8, v6
12907 ; GFX6-NEXT: v_mov_b32_e32 v7, v5
12908 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 glc
12909 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12910 ; GFX6-NEXT: buffer_wbinvl1
12911 ; GFX6-NEXT: v_lshrrev_b32_e32 v5, 16, v7
12912 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v7
12913 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v5
12914 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
12915 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
12916 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
12917 ; GFX6-NEXT: s_cbranch_execnz .LBB47_1
12918 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
12919 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
12920 ; GFX6-NEXT: s_waitcnt expcnt(0)
12921 ; GFX6-NEXT: s_setpc_b64 s[30:31]
12922 %gep = getelementptr <2 x half>, ptr addrspace(1) %ptr, i64 -512
12923 %unused = atomicrmw fmax ptr addrspace(1) %gep, <2 x half> %val syncscope("agent") seq_cst
12927 define <2 x half> @global_system_atomic_fmax_ret_v2f16__offset12b_pos(ptr addrspace(1) %ptr, <2 x half> %val) #0 {
12928 ; GFX12-LABEL: global_system_atomic_fmax_ret_v2f16__offset12b_pos:
12930 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12931 ; GFX12-NEXT: s_wait_expcnt 0x0
12932 ; GFX12-NEXT: s_wait_samplecnt 0x0
12933 ; GFX12-NEXT: s_wait_bvhcnt 0x0
12934 ; GFX12-NEXT: s_wait_kmcnt 0x0
12935 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
12936 ; GFX12-NEXT: v_pk_max_num_f16 v2, v2, v2
12937 ; GFX12-NEXT: s_mov_b32 s0, 0
12938 ; GFX12-NEXT: .LBB48_1: ; %atomicrmw.start
12939 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
12940 ; GFX12-NEXT: s_wait_loadcnt 0x0
12941 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
12942 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12943 ; GFX12-NEXT: v_pk_max_num_f16 v3, v4, v4
12944 ; GFX12-NEXT: v_pk_max_num_f16 v3, v3, v2
12945 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
12946 ; GFX12-NEXT: s_wait_storecnt 0x0
12947 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
12948 ; GFX12-NEXT: s_wait_loadcnt 0x0
12949 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
12950 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
12951 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
12952 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12953 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12954 ; GFX12-NEXT: s_cbranch_execnz .LBB48_1
12955 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
12956 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
12957 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
12958 ; GFX12-NEXT: s_setpc_b64 s[30:31]
12960 ; GFX940-LABEL: global_system_atomic_fmax_ret_v2f16__offset12b_pos:
12962 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12963 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
12964 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
12965 ; GFX940-NEXT: v_pk_max_f16 v2, v2, v2
12966 ; GFX940-NEXT: .LBB48_1: ; %atomicrmw.start
12967 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
12968 ; GFX940-NEXT: s_waitcnt vmcnt(0)
12969 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
12970 ; GFX940-NEXT: v_pk_max_f16 v3, v5, v5
12971 ; GFX940-NEXT: s_nop 0
12972 ; GFX940-NEXT: v_pk_max_f16 v4, v3, v2
12973 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
12974 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 sc0 sc1
12975 ; GFX940-NEXT: s_waitcnt vmcnt(0)
12976 ; GFX940-NEXT: buffer_inv sc0 sc1
12977 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
12978 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
12979 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
12980 ; GFX940-NEXT: s_cbranch_execnz .LBB48_1
12981 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
12982 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
12983 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
12984 ; GFX940-NEXT: s_setpc_b64 s[30:31]
12986 ; GFX11-LABEL: global_system_atomic_fmax_ret_v2f16__offset12b_pos:
12988 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12989 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
12990 ; GFX11-NEXT: v_pk_max_f16 v2, v2, v2
12991 ; GFX11-NEXT: s_mov_b32 s0, 0
12992 ; GFX11-NEXT: .LBB48_1: ; %atomicrmw.start
12993 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
12994 ; GFX11-NEXT: s_waitcnt vmcnt(0)
12995 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
12996 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12997 ; GFX11-NEXT: v_pk_max_f16 v3, v4, v4
12998 ; GFX11-NEXT: v_pk_max_f16 v3, v3, v2
12999 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
13000 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[3:4], off offset:2044 glc
13001 ; GFX11-NEXT: s_waitcnt vmcnt(0)
13002 ; GFX11-NEXT: buffer_gl1_inv
13003 ; GFX11-NEXT: buffer_gl0_inv
13004 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
13005 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
13006 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13007 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
13008 ; GFX11-NEXT: s_cbranch_execnz .LBB48_1
13009 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
13010 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
13011 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
13012 ; GFX11-NEXT: s_setpc_b64 s[30:31]
13014 ; GFX10-LABEL: global_system_atomic_fmax_ret_v2f16__offset12b_pos:
13016 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13017 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
13018 ; GFX10-NEXT: v_pk_max_f16 v2, v2, v2
13019 ; GFX10-NEXT: s_mov_b32 s4, 0
13020 ; GFX10-NEXT: .LBB48_1: ; %atomicrmw.start
13021 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
13022 ; GFX10-NEXT: s_waitcnt vmcnt(0)
13023 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
13024 ; GFX10-NEXT: v_pk_max_f16 v3, v4, v4
13025 ; GFX10-NEXT: v_pk_max_f16 v3, v3, v2
13026 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
13027 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
13028 ; GFX10-NEXT: s_waitcnt vmcnt(0)
13029 ; GFX10-NEXT: buffer_gl1_inv
13030 ; GFX10-NEXT: buffer_gl0_inv
13031 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
13032 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
13033 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
13034 ; GFX10-NEXT: s_cbranch_execnz .LBB48_1
13035 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
13036 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
13037 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
13038 ; GFX10-NEXT: s_setpc_b64 s[30:31]
13040 ; GFX90A-LABEL: global_system_atomic_fmax_ret_v2f16__offset12b_pos:
13042 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13043 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
13044 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
13045 ; GFX90A-NEXT: v_pk_max_f16 v2, v2, v2
13046 ; GFX90A-NEXT: .LBB48_1: ; %atomicrmw.start
13047 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
13048 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
13049 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
13050 ; GFX90A-NEXT: v_pk_max_f16 v3, v5, v5
13051 ; GFX90A-NEXT: v_pk_max_f16 v4, v3, v2
13052 ; GFX90A-NEXT: buffer_wbl2
13053 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[4:5], off offset:2044 glc
13054 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
13055 ; GFX90A-NEXT: buffer_invl2
13056 ; GFX90A-NEXT: buffer_wbinvl1
13057 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
13058 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13059 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
13060 ; GFX90A-NEXT: s_cbranch_execnz .LBB48_1
13061 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
13062 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
13063 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
13064 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
13066 ; GFX908-LABEL: global_system_atomic_fmax_ret_v2f16__offset12b_pos:
13068 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13069 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
13070 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
13071 ; GFX908-NEXT: v_pk_max_f16 v2, v2, v2
13072 ; GFX908-NEXT: .LBB48_1: ; %atomicrmw.start
13073 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
13074 ; GFX908-NEXT: s_waitcnt vmcnt(0)
13075 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
13076 ; GFX908-NEXT: v_pk_max_f16 v3, v4, v4
13077 ; GFX908-NEXT: v_pk_max_f16 v3, v3, v2
13078 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[3:4], off offset:2044 glc
13079 ; GFX908-NEXT: s_waitcnt vmcnt(0)
13080 ; GFX908-NEXT: buffer_wbinvl1
13081 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
13082 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13083 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
13084 ; GFX908-NEXT: s_cbranch_execnz .LBB48_1
13085 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
13086 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
13087 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
13088 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13090 ; GFX8-LABEL: global_system_atomic_fmax_ret_v2f16__offset12b_pos:
13092 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13093 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
13094 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
13095 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
13096 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
13097 ; GFX8-NEXT: v_max_f16_sdwa v1, v2, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
13098 ; GFX8-NEXT: v_max_f16_e32 v2, v2, v2
13099 ; GFX8-NEXT: .LBB48_1: ; %atomicrmw.start
13100 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
13101 ; GFX8-NEXT: s_waitcnt vmcnt(0)
13102 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
13103 ; GFX8-NEXT: v_max_f16_sdwa v0, v6, v6 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
13104 ; GFX8-NEXT: v_max_f16_e32 v5, v6, v6
13105 ; GFX8-NEXT: v_max_f16_sdwa v0, v0, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
13106 ; GFX8-NEXT: v_max_f16_e32 v5, v5, v2
13107 ; GFX8-NEXT: v_or_b32_e32 v5, v5, v0
13108 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
13109 ; GFX8-NEXT: s_waitcnt vmcnt(0)
13110 ; GFX8-NEXT: buffer_wbinvl1
13111 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
13112 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13113 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
13114 ; GFX8-NEXT: s_cbranch_execnz .LBB48_1
13115 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
13116 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
13117 ; GFX8-NEXT: s_setpc_b64 s[30:31]
13119 ; GFX7-LABEL: global_system_atomic_fmax_ret_v2f16__offset12b_pos:
13121 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13122 ; GFX7-NEXT: s_mov_b32 s6, 0
13123 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
13124 ; GFX7-NEXT: s_mov_b32 s4, s6
13125 ; GFX7-NEXT: s_mov_b32 s5, s6
13126 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
13127 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
13128 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
13129 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
13130 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v3
13131 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13132 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
13133 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
13134 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
13135 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v6
13136 ; GFX7-NEXT: .LBB48_1: ; %atomicrmw.start
13137 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
13138 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
13139 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
13140 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v3
13141 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v2
13142 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
13143 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v4
13144 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v5
13145 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
13146 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
13147 ; GFX7-NEXT: v_or_b32_e32 v7, v2, v3
13148 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v6
13149 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v2
13150 ; GFX7-NEXT: v_mov_b32_e32 v9, v7
13151 ; GFX7-NEXT: v_mov_b32_e32 v8, v6
13152 ; GFX7-NEXT: buffer_atomic_cmpswap v[8:9], v[0:1], s[4:7], 0 addr64 offset:2044 glc
13153 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13154 ; GFX7-NEXT: buffer_wbinvl1
13155 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v8
13156 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v8
13157 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
13158 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v8, v7
13159 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
13160 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
13161 ; GFX7-NEXT: s_cbranch_execnz .LBB48_1
13162 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
13163 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
13164 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
13165 ; GFX7-NEXT: v_mov_b32_e32 v1, v3
13166 ; GFX7-NEXT: s_setpc_b64 s[30:31]
13168 ; GFX6-LABEL: global_system_atomic_fmax_ret_v2f16__offset12b_pos:
13170 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13171 ; GFX6-NEXT: s_mov_b32 s6, 0
13172 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
13173 ; GFX6-NEXT: s_mov_b32 s4, s6
13174 ; GFX6-NEXT: s_mov_b32 s5, s6
13175 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
13176 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
13177 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v2
13178 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
13179 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v3
13180 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13181 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v5
13182 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v5
13183 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
13184 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v6
13185 ; GFX6-NEXT: .LBB48_1: ; %atomicrmw.start
13186 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
13187 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
13188 ; GFX6-NEXT: v_cvt_f16_f32_e32 v2, v2
13189 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v3
13190 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v2
13191 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v3
13192 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v4
13193 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v5
13194 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v6
13195 ; GFX6-NEXT: s_waitcnt expcnt(0)
13196 ; GFX6-NEXT: v_cvt_f16_f32_e32 v8, v7
13197 ; GFX6-NEXT: v_or_b32_e32 v7, v2, v3
13198 ; GFX6-NEXT: v_lshlrev_b32_e32 v2, 16, v6
13199 ; GFX6-NEXT: v_or_b32_e32 v6, v8, v2
13200 ; GFX6-NEXT: v_mov_b32_e32 v9, v7
13201 ; GFX6-NEXT: v_mov_b32_e32 v8, v6
13202 ; GFX6-NEXT: buffer_atomic_cmpswap v[8:9], v[0:1], s[4:7], 0 addr64 offset:2044 glc
13203 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13204 ; GFX6-NEXT: buffer_wbinvl1
13205 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v8
13206 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v8
13207 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v3
13208 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v8, v7
13209 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
13210 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
13211 ; GFX6-NEXT: s_cbranch_execnz .LBB48_1
13212 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
13213 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
13214 ; GFX6-NEXT: v_mov_b32_e32 v0, v2
13215 ; GFX6-NEXT: v_mov_b32_e32 v1, v3
13216 ; GFX6-NEXT: s_waitcnt expcnt(0)
13217 ; GFX6-NEXT: s_setpc_b64 s[30:31]
13218 %gep = getelementptr <2 x half>, ptr addrspace(1) %ptr, i64 511
13219 %result = atomicrmw fmax ptr addrspace(1) %gep, <2 x half> %val seq_cst
13220 ret <2 x half> %result
13223 define void @global_system_atomic_fmax_noret_v2f16__offset12b_pos(ptr addrspace(1) %ptr, <2 x half> %val) #0 {
13224 ; GFX12-LABEL: global_system_atomic_fmax_noret_v2f16__offset12b_pos:
13226 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13227 ; GFX12-NEXT: s_wait_expcnt 0x0
13228 ; GFX12-NEXT: s_wait_samplecnt 0x0
13229 ; GFX12-NEXT: s_wait_bvhcnt 0x0
13230 ; GFX12-NEXT: s_wait_kmcnt 0x0
13231 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
13232 ; GFX12-NEXT: v_pk_max_num_f16 v4, v2, v2
13233 ; GFX12-NEXT: s_mov_b32 s0, 0
13234 ; GFX12-NEXT: .LBB49_1: ; %atomicrmw.start
13235 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
13236 ; GFX12-NEXT: s_wait_loadcnt 0x0
13237 ; GFX12-NEXT: v_pk_max_num_f16 v2, v3, v3
13238 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
13239 ; GFX12-NEXT: v_pk_max_num_f16 v2, v2, v4
13240 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
13241 ; GFX12-NEXT: s_wait_storecnt 0x0
13242 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
13243 ; GFX12-NEXT: s_wait_loadcnt 0x0
13244 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
13245 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
13246 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
13247 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
13248 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13249 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
13250 ; GFX12-NEXT: s_cbranch_execnz .LBB49_1
13251 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
13252 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
13253 ; GFX12-NEXT: s_setpc_b64 s[30:31]
13255 ; GFX940-LABEL: global_system_atomic_fmax_noret_v2f16__offset12b_pos:
13257 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13258 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
13259 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
13260 ; GFX940-NEXT: v_pk_max_f16 v4, v2, v2
13261 ; GFX940-NEXT: .LBB49_1: ; %atomicrmw.start
13262 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
13263 ; GFX940-NEXT: s_waitcnt vmcnt(0)
13264 ; GFX940-NEXT: v_pk_max_f16 v2, v3, v3
13265 ; GFX940-NEXT: s_nop 0
13266 ; GFX940-NEXT: v_pk_max_f16 v2, v2, v4
13267 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
13268 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 sc0 sc1
13269 ; GFX940-NEXT: s_waitcnt vmcnt(0)
13270 ; GFX940-NEXT: buffer_inv sc0 sc1
13271 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
13272 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
13273 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
13274 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
13275 ; GFX940-NEXT: s_cbranch_execnz .LBB49_1
13276 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
13277 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
13278 ; GFX940-NEXT: s_setpc_b64 s[30:31]
13280 ; GFX11-LABEL: global_system_atomic_fmax_noret_v2f16__offset12b_pos:
13282 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13283 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
13284 ; GFX11-NEXT: v_pk_max_f16 v4, v2, v2
13285 ; GFX11-NEXT: s_mov_b32 s0, 0
13286 ; GFX11-NEXT: .LBB49_1: ; %atomicrmw.start
13287 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
13288 ; GFX11-NEXT: s_waitcnt vmcnt(0)
13289 ; GFX11-NEXT: v_pk_max_f16 v2, v3, v3
13290 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
13291 ; GFX11-NEXT: v_pk_max_f16 v2, v2, v4
13292 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
13293 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 glc
13294 ; GFX11-NEXT: s_waitcnt vmcnt(0)
13295 ; GFX11-NEXT: buffer_gl1_inv
13296 ; GFX11-NEXT: buffer_gl0_inv
13297 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
13298 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
13299 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
13300 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13301 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
13302 ; GFX11-NEXT: s_cbranch_execnz .LBB49_1
13303 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
13304 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
13305 ; GFX11-NEXT: s_setpc_b64 s[30:31]
13307 ; GFX10-LABEL: global_system_atomic_fmax_noret_v2f16__offset12b_pos:
13309 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13310 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
13311 ; GFX10-NEXT: v_pk_max_f16 v4, v2, v2
13312 ; GFX10-NEXT: s_mov_b32 s4, 0
13313 ; GFX10-NEXT: .LBB49_1: ; %atomicrmw.start
13314 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
13315 ; GFX10-NEXT: s_waitcnt vmcnt(0)
13316 ; GFX10-NEXT: v_pk_max_f16 v2, v3, v3
13317 ; GFX10-NEXT: v_pk_max_f16 v2, v2, v4
13318 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
13319 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
13320 ; GFX10-NEXT: s_waitcnt vmcnt(0)
13321 ; GFX10-NEXT: buffer_gl1_inv
13322 ; GFX10-NEXT: buffer_gl0_inv
13323 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
13324 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
13325 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
13326 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
13327 ; GFX10-NEXT: s_cbranch_execnz .LBB49_1
13328 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
13329 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
13330 ; GFX10-NEXT: s_setpc_b64 s[30:31]
13332 ; GFX90A-LABEL: global_system_atomic_fmax_noret_v2f16__offset12b_pos:
13334 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13335 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
13336 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
13337 ; GFX90A-NEXT: v_pk_max_f16 v4, v2, v2
13338 ; GFX90A-NEXT: .LBB49_1: ; %atomicrmw.start
13339 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
13340 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
13341 ; GFX90A-NEXT: v_pk_max_f16 v2, v3, v3
13342 ; GFX90A-NEXT: v_pk_max_f16 v2, v2, v4
13343 ; GFX90A-NEXT: buffer_wbl2
13344 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
13345 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
13346 ; GFX90A-NEXT: buffer_invl2
13347 ; GFX90A-NEXT: buffer_wbinvl1
13348 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
13349 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13350 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
13351 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
13352 ; GFX90A-NEXT: s_cbranch_execnz .LBB49_1
13353 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
13354 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
13355 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
13357 ; GFX908-LABEL: global_system_atomic_fmax_noret_v2f16__offset12b_pos:
13359 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13360 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
13361 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
13362 ; GFX908-NEXT: v_pk_max_f16 v4, v2, v2
13363 ; GFX908-NEXT: .LBB49_1: ; %atomicrmw.start
13364 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
13365 ; GFX908-NEXT: s_waitcnt vmcnt(0)
13366 ; GFX908-NEXT: v_pk_max_f16 v2, v3, v3
13367 ; GFX908-NEXT: v_pk_max_f16 v2, v2, v4
13368 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
13369 ; GFX908-NEXT: s_waitcnt vmcnt(0)
13370 ; GFX908-NEXT: buffer_wbinvl1
13371 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
13372 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13373 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
13374 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
13375 ; GFX908-NEXT: s_cbranch_execnz .LBB49_1
13376 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
13377 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
13378 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13380 ; GFX8-LABEL: global_system_atomic_fmax_noret_v2f16__offset12b_pos:
13382 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13383 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
13384 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
13385 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
13386 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
13387 ; GFX8-NEXT: v_max_f16_sdwa v4, v2, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
13388 ; GFX8-NEXT: v_max_f16_e32 v5, v2, v2
13389 ; GFX8-NEXT: .LBB49_1: ; %atomicrmw.start
13390 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
13391 ; GFX8-NEXT: s_waitcnt vmcnt(0)
13392 ; GFX8-NEXT: v_max_f16_sdwa v2, v3, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
13393 ; GFX8-NEXT: v_max_f16_e32 v6, v3, v3
13394 ; GFX8-NEXT: v_max_f16_sdwa v2, v2, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
13395 ; GFX8-NEXT: v_max_f16_e32 v6, v6, v5
13396 ; GFX8-NEXT: v_or_b32_e32 v2, v6, v2
13397 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13398 ; GFX8-NEXT: s_waitcnt vmcnt(0)
13399 ; GFX8-NEXT: buffer_wbinvl1
13400 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
13401 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13402 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
13403 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
13404 ; GFX8-NEXT: s_cbranch_execnz .LBB49_1
13405 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
13406 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
13407 ; GFX8-NEXT: s_setpc_b64 s[30:31]
13409 ; GFX7-LABEL: global_system_atomic_fmax_noret_v2f16__offset12b_pos:
13411 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13412 ; GFX7-NEXT: s_mov_b32 s6, 0
13413 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
13414 ; GFX7-NEXT: s_mov_b32 s4, s6
13415 ; GFX7-NEXT: s_mov_b32 s5, s6
13416 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
13417 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
13418 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
13419 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
13420 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
13421 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13422 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
13423 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
13424 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
13425 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
13426 ; GFX7-NEXT: .LBB49_1: ; %atomicrmw.start
13427 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
13428 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
13429 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
13430 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
13431 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
13432 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
13433 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
13434 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
13435 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
13436 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
13437 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
13438 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
13439 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
13440 ; GFX7-NEXT: v_mov_b32_e32 v8, v6
13441 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
13442 ; GFX7-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 offset:2044 glc
13443 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13444 ; GFX7-NEXT: buffer_wbinvl1
13445 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
13446 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
13447 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
13448 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
13449 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
13450 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
13451 ; GFX7-NEXT: s_cbranch_execnz .LBB49_1
13452 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
13453 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
13454 ; GFX7-NEXT: s_setpc_b64 s[30:31]
13456 ; GFX6-LABEL: global_system_atomic_fmax_noret_v2f16__offset12b_pos:
13458 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13459 ; GFX6-NEXT: s_mov_b32 s6, 0
13460 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
13461 ; GFX6-NEXT: s_mov_b32 s4, s6
13462 ; GFX6-NEXT: s_mov_b32 s5, s6
13463 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
13464 ; GFX6-NEXT: v_cvt_f16_f32_e32 v3, v3
13465 ; GFX6-NEXT: v_cvt_f16_f32_e32 v6, v2
13466 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
13467 ; GFX6-NEXT: v_cvt_f32_f16_e32 v2, v3
13468 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13469 ; GFX6-NEXT: v_lshrrev_b32_e32 v3, 16, v5
13470 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v5
13471 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v3
13472 ; GFX6-NEXT: v_cvt_f32_f16_e32 v3, v6
13473 ; GFX6-NEXT: .LBB49_1: ; %atomicrmw.start
13474 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
13475 ; GFX6-NEXT: v_cvt_f16_f32_e32 v5, v5
13476 ; GFX6-NEXT: v_cvt_f16_f32_e32 v4, v4
13477 ; GFX6-NEXT: v_cvt_f32_f16_e32 v6, v5
13478 ; GFX6-NEXT: s_waitcnt expcnt(0)
13479 ; GFX6-NEXT: v_cvt_f32_f16_e32 v7, v4
13480 ; GFX6-NEXT: v_lshlrev_b32_e32 v5, 16, v5
13481 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
13482 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
13483 ; GFX6-NEXT: v_cvt_f16_f32_e32 v8, v6
13484 ; GFX6-NEXT: v_cvt_f16_f32_e32 v7, v7
13485 ; GFX6-NEXT: v_or_b32_e32 v6, v4, v5
13486 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v8
13487 ; GFX6-NEXT: v_or_b32_e32 v5, v7, v4
13488 ; GFX6-NEXT: v_mov_b32_e32 v8, v6
13489 ; GFX6-NEXT: v_mov_b32_e32 v7, v5
13490 ; GFX6-NEXT: buffer_atomic_cmpswap v[7:8], v[0:1], s[4:7], 0 addr64 offset:2044 glc
13491 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13492 ; GFX6-NEXT: buffer_wbinvl1
13493 ; GFX6-NEXT: v_lshrrev_b32_e32 v5, 16, v7
13494 ; GFX6-NEXT: v_cvt_f32_f16_e32 v4, v7
13495 ; GFX6-NEXT: v_cvt_f32_f16_e32 v5, v5
13496 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
13497 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
13498 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
13499 ; GFX6-NEXT: s_cbranch_execnz .LBB49_1
13500 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
13501 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
13502 ; GFX6-NEXT: s_waitcnt expcnt(0)
13503 ; GFX6-NEXT: s_setpc_b64 s[30:31]
13504 %gep = getelementptr <2 x half>, ptr addrspace(1) %ptr, i64 511
13505 %unused = atomicrmw fmax ptr addrspace(1) %gep, <2 x half> %val seq_cst
13509 ; --------------------------------------------------------------------
13511 ; --------------------------------------------------------------------
13513 define <2 x bfloat> @global_agent_atomic_fmax_ret_v2bf16(ptr addrspace(1) %ptr, <2 x bfloat> %val) #0 {
13514 ; GFX12-LABEL: global_agent_atomic_fmax_ret_v2bf16:
13516 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13517 ; GFX12-NEXT: s_wait_expcnt 0x0
13518 ; GFX12-NEXT: s_wait_samplecnt 0x0
13519 ; GFX12-NEXT: s_wait_bvhcnt 0x0
13520 ; GFX12-NEXT: s_wait_kmcnt 0x0
13521 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
13522 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
13523 ; GFX12-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
13524 ; GFX12-NEXT: s_mov_b32 s1, 0
13525 ; GFX12-NEXT: .LBB50_1: ; %atomicrmw.start
13526 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
13527 ; GFX12-NEXT: s_wait_loadcnt 0x0
13528 ; GFX12-NEXT: v_mov_b32_e32 v6, v3
13529 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
13530 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
13531 ; GFX12-NEXT: v_max_num_f32_e32 v5, v5, v2
13532 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v6
13533 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
13534 ; GFX12-NEXT: v_bfe_u32 v8, v5, 16, 1
13535 ; GFX12-NEXT: v_max_num_f32_e32 v3, v3, v4
13536 ; GFX12-NEXT: v_or_b32_e32 v10, 0x400000, v5
13537 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
13538 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
13539 ; GFX12-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
13540 ; GFX12-NEXT: v_bfe_u32 v7, v3, 16, 1
13541 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v3
13542 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v3, v3
13543 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
13544 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
13545 ; GFX12-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
13546 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
13547 ; GFX12-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
13548 ; GFX12-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
13549 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
13550 ; GFX12-NEXT: s_wait_storecnt 0x0
13551 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[5:6], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
13552 ; GFX12-NEXT: s_wait_loadcnt 0x0
13553 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
13554 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
13555 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
13556 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13557 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
13558 ; GFX12-NEXT: s_cbranch_execnz .LBB50_1
13559 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
13560 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
13561 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
13562 ; GFX12-NEXT: s_setpc_b64 s[30:31]
13564 ; GFX940-LABEL: global_agent_atomic_fmax_ret_v2bf16:
13566 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13567 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
13568 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
13569 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
13570 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
13571 ; GFX940-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
13572 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
13573 ; GFX940-NEXT: .LBB50_1: ; %atomicrmw.start
13574 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
13575 ; GFX940-NEXT: s_waitcnt vmcnt(0)
13576 ; GFX940-NEXT: v_mov_b32_e32 v7, v3
13577 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 16, v7
13578 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
13579 ; GFX940-NEXT: v_max_f32_e32 v3, v3, v4
13580 ; GFX940-NEXT: v_max_f32_e32 v5, v5, v2
13581 ; GFX940-NEXT: v_bfe_u32 v6, v3, 16, 1
13582 ; GFX940-NEXT: v_bfe_u32 v9, v5, 16, 1
13583 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v3
13584 ; GFX940-NEXT: v_or_b32_e32 v10, 0x400000, v5
13585 ; GFX940-NEXT: v_add3_u32 v6, v6, v3, s4
13586 ; GFX940-NEXT: v_add3_u32 v9, v9, v5, s4
13587 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
13588 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v3, v3
13589 ; GFX940-NEXT: s_nop 0
13590 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
13591 ; GFX940-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[0:1]
13592 ; GFX940-NEXT: v_perm_b32 v6, v5, v3, s5
13593 ; GFX940-NEXT: buffer_wbl2 sc1
13594 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[6:7], off sc0
13595 ; GFX940-NEXT: s_waitcnt vmcnt(0)
13596 ; GFX940-NEXT: buffer_inv sc1
13597 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
13598 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
13599 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
13600 ; GFX940-NEXT: s_cbranch_execnz .LBB50_1
13601 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
13602 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
13603 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
13604 ; GFX940-NEXT: s_setpc_b64 s[30:31]
13606 ; GFX11-LABEL: global_agent_atomic_fmax_ret_v2bf16:
13608 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13609 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
13610 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
13611 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
13612 ; GFX11-NEXT: s_mov_b32 s1, 0
13613 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
13614 ; GFX11-NEXT: .p2align 6
13615 ; GFX11-NEXT: .LBB50_1: ; %atomicrmw.start
13616 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
13617 ; GFX11-NEXT: s_waitcnt vmcnt(0)
13618 ; GFX11-NEXT: v_mov_b32_e32 v6, v3
13619 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
13620 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
13621 ; GFX11-NEXT: v_max_f32_e32 v5, v5, v2
13622 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v6
13623 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
13624 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
13625 ; GFX11-NEXT: v_max_f32_e32 v3, v3, v4
13626 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
13627 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
13628 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
13629 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
13630 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
13631 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v3
13632 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v3, v3
13633 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
13634 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
13635 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
13636 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
13637 ; GFX11-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
13638 ; GFX11-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
13639 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
13640 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[5:6], off glc
13641 ; GFX11-NEXT: s_waitcnt vmcnt(0)
13642 ; GFX11-NEXT: buffer_gl1_inv
13643 ; GFX11-NEXT: buffer_gl0_inv
13644 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
13645 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
13646 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13647 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
13648 ; GFX11-NEXT: s_cbranch_execnz .LBB50_1
13649 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
13650 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
13651 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
13652 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
13653 ; GFX11-NEXT: s_setpc_b64 s[30:31]
13655 ; GFX10-LABEL: global_agent_atomic_fmax_ret_v2bf16:
13657 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13658 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
13659 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
13660 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
13661 ; GFX10-NEXT: s_mov_b32 s5, 0
13662 ; GFX10-NEXT: .LBB50_1: ; %atomicrmw.start
13663 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
13664 ; GFX10-NEXT: s_waitcnt vmcnt(0)
13665 ; GFX10-NEXT: v_mov_b32_e32 v6, v3
13666 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v6
13667 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
13668 ; GFX10-NEXT: v_max_f32_e32 v3, v3, v4
13669 ; GFX10-NEXT: v_max_f32_e32 v5, v5, v2
13670 ; GFX10-NEXT: v_bfe_u32 v7, v3, 16, 1
13671 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
13672 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v3
13673 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
13674 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
13675 ; GFX10-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
13676 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
13677 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v3, v3
13678 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
13679 ; GFX10-NEXT: v_cndmask_b32_e64 v3, v7, v9, s4
13680 ; GFX10-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
13681 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
13682 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[5:6], off glc
13683 ; GFX10-NEXT: s_waitcnt vmcnt(0)
13684 ; GFX10-NEXT: buffer_gl1_inv
13685 ; GFX10-NEXT: buffer_gl0_inv
13686 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
13687 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
13688 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
13689 ; GFX10-NEXT: s_cbranch_execnz .LBB50_1
13690 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
13691 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
13692 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
13693 ; GFX10-NEXT: s_setpc_b64 s[30:31]
13695 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_v2bf16:
13697 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13698 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
13699 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
13700 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
13701 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
13702 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
13703 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
13704 ; GFX90A-NEXT: .LBB50_1: ; %atomicrmw.start
13705 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
13706 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
13707 ; GFX90A-NEXT: v_mov_b32_e32 v7, v3
13708 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v7
13709 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
13710 ; GFX90A-NEXT: v_max_f32_e32 v3, v3, v4
13711 ; GFX90A-NEXT: v_max_f32_e32 v5, v5, v2
13712 ; GFX90A-NEXT: v_bfe_u32 v6, v3, 16, 1
13713 ; GFX90A-NEXT: v_bfe_u32 v9, v5, 16, 1
13714 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v3
13715 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v5
13716 ; GFX90A-NEXT: v_add3_u32 v6, v6, v3, s8
13717 ; GFX90A-NEXT: v_add3_u32 v9, v9, v5, s8
13718 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
13719 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
13720 ; GFX90A-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[4:5]
13721 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
13722 ; GFX90A-NEXT: v_perm_b32 v6, v5, v3, s9
13723 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[6:7], off glc
13724 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
13725 ; GFX90A-NEXT: buffer_wbinvl1
13726 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
13727 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
13728 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
13729 ; GFX90A-NEXT: s_cbranch_execnz .LBB50_1
13730 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
13731 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
13732 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
13733 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
13735 ; GFX908-LABEL: global_agent_atomic_fmax_ret_v2bf16:
13737 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13738 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
13739 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
13740 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
13741 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
13742 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
13743 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
13744 ; GFX908-NEXT: .LBB50_1: ; %atomicrmw.start
13745 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
13746 ; GFX908-NEXT: s_waitcnt vmcnt(0)
13747 ; GFX908-NEXT: v_mov_b32_e32 v6, v3
13748 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v6
13749 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
13750 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v4
13751 ; GFX908-NEXT: v_max_f32_e32 v5, v5, v2
13752 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
13753 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
13754 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
13755 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
13756 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s8
13757 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
13758 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
13759 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
13760 ; GFX908-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
13761 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
13762 ; GFX908-NEXT: v_perm_b32 v5, v5, v3, s9
13763 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[5:6], off glc
13764 ; GFX908-NEXT: s_waitcnt vmcnt(0)
13765 ; GFX908-NEXT: buffer_wbinvl1
13766 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
13767 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
13768 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
13769 ; GFX908-NEXT: s_cbranch_execnz .LBB50_1
13770 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
13771 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
13772 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
13773 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13775 ; GFX8-LABEL: global_agent_atomic_fmax_ret_v2bf16:
13777 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13778 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
13779 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
13780 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
13781 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
13782 ; GFX8-NEXT: .LBB50_1: ; %atomicrmw.start
13783 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
13784 ; GFX8-NEXT: s_waitcnt vmcnt(0)
13785 ; GFX8-NEXT: v_mov_b32_e32 v6, v3
13786 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 16, v6
13787 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
13788 ; GFX8-NEXT: v_max_f32_e32 v3, v3, v4
13789 ; GFX8-NEXT: v_max_f32_e32 v5, v5, v2
13790 ; GFX8-NEXT: v_bfe_u32 v7, v3, 16, 1
13791 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
13792 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v3
13793 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
13794 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
13795 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
13796 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
13797 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
13798 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v3
13799 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
13800 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
13801 ; GFX8-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
13802 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
13803 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v3, 16
13804 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
13805 ; GFX8-NEXT: s_waitcnt vmcnt(0)
13806 ; GFX8-NEXT: buffer_wbinvl1
13807 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
13808 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
13809 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
13810 ; GFX8-NEXT: s_cbranch_execnz .LBB50_1
13811 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
13812 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
13813 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
13814 ; GFX8-NEXT: s_setpc_b64 s[30:31]
13816 ; GFX7-LABEL: global_agent_atomic_fmax_ret_v2bf16:
13818 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13819 ; GFX7-NEXT: s_mov_b32 s6, 0
13820 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
13821 ; GFX7-NEXT: s_mov_b32 s4, s6
13822 ; GFX7-NEXT: s_mov_b32 s5, s6
13823 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64
13824 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
13825 ; GFX7-NEXT: v_mul_f32_e32 v6, 1.0, v2
13826 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
13827 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
13828 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13829 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v5
13830 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
13831 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
13832 ; GFX7-NEXT: .LBB50_1: ; %atomicrmw.start
13833 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
13834 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
13835 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
13836 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
13837 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v3
13838 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
13839 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v4
13840 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v5
13841 ; GFX7-NEXT: v_alignbit_b32 v3, v2, v3, 16
13842 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v6
13843 ; GFX7-NEXT: v_alignbit_b32 v2, v2, v7, 16
13844 ; GFX7-NEXT: v_mov_b32_e32 v7, v3
13845 ; GFX7-NEXT: v_mov_b32_e32 v6, v2
13846 ; GFX7-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 glc
13847 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13848 ; GFX7-NEXT: buffer_wbinvl1
13849 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v3
13850 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
13851 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
13852 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v6
13853 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
13854 ; GFX7-NEXT: s_cbranch_execnz .LBB50_1
13855 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
13856 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
13857 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
13858 ; GFX7-NEXT: v_mov_b32_e32 v1, v2
13859 ; GFX7-NEXT: s_setpc_b64 s[30:31]
13861 ; GFX6-LABEL: global_agent_atomic_fmax_ret_v2bf16:
13863 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13864 ; GFX6-NEXT: s_mov_b32 s6, 0
13865 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
13866 ; GFX6-NEXT: s_mov_b32 s4, s6
13867 ; GFX6-NEXT: s_mov_b32 s5, s6
13868 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64
13869 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
13870 ; GFX6-NEXT: v_mul_f32_e32 v6, 1.0, v2
13871 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
13872 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
13873 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13874 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v5
13875 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v5
13876 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
13877 ; GFX6-NEXT: .LBB50_1: ; %atomicrmw.start
13878 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
13879 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
13880 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
13881 ; GFX6-NEXT: s_waitcnt expcnt(0)
13882 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
13883 ; GFX6-NEXT: v_and_b32_e32 v7, 0xffff0000, v3
13884 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
13885 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v4
13886 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v5
13887 ; GFX6-NEXT: v_alignbit_b32 v3, v2, v3, 16
13888 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v6
13889 ; GFX6-NEXT: v_alignbit_b32 v2, v2, v7, 16
13890 ; GFX6-NEXT: v_mov_b32_e32 v7, v3
13891 ; GFX6-NEXT: v_mov_b32_e32 v6, v2
13892 ; GFX6-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 glc
13893 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13894 ; GFX6-NEXT: buffer_wbinvl1
13895 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v6, v3
13896 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
13897 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
13898 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v6
13899 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
13900 ; GFX6-NEXT: s_cbranch_execnz .LBB50_1
13901 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
13902 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
13903 ; GFX6-NEXT: v_mov_b32_e32 v0, v3
13904 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
13905 ; GFX6-NEXT: s_waitcnt expcnt(0)
13906 ; GFX6-NEXT: s_setpc_b64 s[30:31]
13907 %result = atomicrmw fmax ptr addrspace(1) %ptr, <2 x bfloat> %val syncscope("agent") seq_cst
13908 ret <2 x bfloat> %result
13911 define <2 x bfloat> @global_agent_atomic_fmax_ret_v2bf16__offset12b_pos(ptr addrspace(1) %ptr, <2 x bfloat> %val) #0 {
13912 ; GFX12-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_pos:
13914 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13915 ; GFX12-NEXT: s_wait_expcnt 0x0
13916 ; GFX12-NEXT: s_wait_samplecnt 0x0
13917 ; GFX12-NEXT: s_wait_bvhcnt 0x0
13918 ; GFX12-NEXT: s_wait_kmcnt 0x0
13919 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
13920 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
13921 ; GFX12-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
13922 ; GFX12-NEXT: s_mov_b32 s1, 0
13923 ; GFX12-NEXT: .LBB51_1: ; %atomicrmw.start
13924 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
13925 ; GFX12-NEXT: s_wait_loadcnt 0x0
13926 ; GFX12-NEXT: v_mov_b32_e32 v6, v3
13927 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
13928 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
13929 ; GFX12-NEXT: v_max_num_f32_e32 v5, v5, v2
13930 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v6
13931 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
13932 ; GFX12-NEXT: v_bfe_u32 v8, v5, 16, 1
13933 ; GFX12-NEXT: v_max_num_f32_e32 v3, v3, v4
13934 ; GFX12-NEXT: v_or_b32_e32 v10, 0x400000, v5
13935 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
13936 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
13937 ; GFX12-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
13938 ; GFX12-NEXT: v_bfe_u32 v7, v3, 16, 1
13939 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v3
13940 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v3, v3
13941 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
13942 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
13943 ; GFX12-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
13944 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
13945 ; GFX12-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
13946 ; GFX12-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
13947 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
13948 ; GFX12-NEXT: s_wait_storecnt 0x0
13949 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[5:6], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
13950 ; GFX12-NEXT: s_wait_loadcnt 0x0
13951 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
13952 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
13953 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
13954 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13955 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
13956 ; GFX12-NEXT: s_cbranch_execnz .LBB51_1
13957 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
13958 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
13959 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
13960 ; GFX12-NEXT: s_setpc_b64 s[30:31]
13962 ; GFX940-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_pos:
13964 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13965 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
13966 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
13967 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
13968 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
13969 ; GFX940-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
13970 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
13971 ; GFX940-NEXT: .LBB51_1: ; %atomicrmw.start
13972 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
13973 ; GFX940-NEXT: s_waitcnt vmcnt(0)
13974 ; GFX940-NEXT: v_mov_b32_e32 v7, v3
13975 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 16, v7
13976 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
13977 ; GFX940-NEXT: v_max_f32_e32 v3, v3, v4
13978 ; GFX940-NEXT: v_max_f32_e32 v5, v5, v2
13979 ; GFX940-NEXT: v_bfe_u32 v6, v3, 16, 1
13980 ; GFX940-NEXT: v_bfe_u32 v9, v5, 16, 1
13981 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v3
13982 ; GFX940-NEXT: v_or_b32_e32 v10, 0x400000, v5
13983 ; GFX940-NEXT: v_add3_u32 v6, v6, v3, s4
13984 ; GFX940-NEXT: v_add3_u32 v9, v9, v5, s4
13985 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
13986 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v3, v3
13987 ; GFX940-NEXT: s_nop 0
13988 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
13989 ; GFX940-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[0:1]
13990 ; GFX940-NEXT: v_perm_b32 v6, v5, v3, s5
13991 ; GFX940-NEXT: buffer_wbl2 sc1
13992 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[6:7], off offset:2044 sc0
13993 ; GFX940-NEXT: s_waitcnt vmcnt(0)
13994 ; GFX940-NEXT: buffer_inv sc1
13995 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
13996 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
13997 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
13998 ; GFX940-NEXT: s_cbranch_execnz .LBB51_1
13999 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
14000 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
14001 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
14002 ; GFX940-NEXT: s_setpc_b64 s[30:31]
14004 ; GFX11-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_pos:
14006 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14007 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
14008 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14009 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14010 ; GFX11-NEXT: s_mov_b32 s1, 0
14011 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
14012 ; GFX11-NEXT: .p2align 6
14013 ; GFX11-NEXT: .LBB51_1: ; %atomicrmw.start
14014 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
14015 ; GFX11-NEXT: s_waitcnt vmcnt(0)
14016 ; GFX11-NEXT: v_mov_b32_e32 v6, v3
14017 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
14018 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14019 ; GFX11-NEXT: v_max_f32_e32 v5, v5, v2
14020 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v6
14021 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
14022 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
14023 ; GFX11-NEXT: v_max_f32_e32 v3, v3, v4
14024 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
14025 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
14026 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
14027 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
14028 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
14029 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v3
14030 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v3, v3
14031 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
14032 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
14033 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
14034 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
14035 ; GFX11-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
14036 ; GFX11-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
14037 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
14038 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[5:6], off offset:2044 glc
14039 ; GFX11-NEXT: s_waitcnt vmcnt(0)
14040 ; GFX11-NEXT: buffer_gl1_inv
14041 ; GFX11-NEXT: buffer_gl0_inv
14042 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
14043 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
14044 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14045 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
14046 ; GFX11-NEXT: s_cbranch_execnz .LBB51_1
14047 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
14048 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
14049 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
14050 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
14051 ; GFX11-NEXT: s_setpc_b64 s[30:31]
14053 ; GFX10-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_pos:
14055 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14056 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
14057 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14058 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14059 ; GFX10-NEXT: s_mov_b32 s5, 0
14060 ; GFX10-NEXT: .LBB51_1: ; %atomicrmw.start
14061 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
14062 ; GFX10-NEXT: s_waitcnt vmcnt(0)
14063 ; GFX10-NEXT: v_mov_b32_e32 v6, v3
14064 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v6
14065 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14066 ; GFX10-NEXT: v_max_f32_e32 v3, v3, v4
14067 ; GFX10-NEXT: v_max_f32_e32 v5, v5, v2
14068 ; GFX10-NEXT: v_bfe_u32 v7, v3, 16, 1
14069 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
14070 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v3
14071 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
14072 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
14073 ; GFX10-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
14074 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
14075 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v3, v3
14076 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
14077 ; GFX10-NEXT: v_cndmask_b32_e64 v3, v7, v9, s4
14078 ; GFX10-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
14079 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
14080 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[5:6], off offset:2044 glc
14081 ; GFX10-NEXT: s_waitcnt vmcnt(0)
14082 ; GFX10-NEXT: buffer_gl1_inv
14083 ; GFX10-NEXT: buffer_gl0_inv
14084 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
14085 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
14086 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
14087 ; GFX10-NEXT: s_cbranch_execnz .LBB51_1
14088 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
14089 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
14090 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
14091 ; GFX10-NEXT: s_setpc_b64 s[30:31]
14093 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_pos:
14095 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14096 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
14097 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
14098 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14099 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
14100 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14101 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
14102 ; GFX90A-NEXT: .LBB51_1: ; %atomicrmw.start
14103 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
14104 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
14105 ; GFX90A-NEXT: v_mov_b32_e32 v7, v3
14106 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v7
14107 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
14108 ; GFX90A-NEXT: v_max_f32_e32 v3, v3, v4
14109 ; GFX90A-NEXT: v_max_f32_e32 v5, v5, v2
14110 ; GFX90A-NEXT: v_bfe_u32 v6, v3, 16, 1
14111 ; GFX90A-NEXT: v_bfe_u32 v9, v5, 16, 1
14112 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v3
14113 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v5
14114 ; GFX90A-NEXT: v_add3_u32 v6, v6, v3, s8
14115 ; GFX90A-NEXT: v_add3_u32 v9, v9, v5, s8
14116 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
14117 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
14118 ; GFX90A-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[4:5]
14119 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
14120 ; GFX90A-NEXT: v_perm_b32 v6, v5, v3, s9
14121 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[6:7], off offset:2044 glc
14122 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
14123 ; GFX90A-NEXT: buffer_wbinvl1
14124 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
14125 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
14126 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
14127 ; GFX90A-NEXT: s_cbranch_execnz .LBB51_1
14128 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
14129 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
14130 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
14131 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
14133 ; GFX908-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_pos:
14135 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14136 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
14137 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
14138 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14139 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
14140 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14141 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
14142 ; GFX908-NEXT: .LBB51_1: ; %atomicrmw.start
14143 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
14144 ; GFX908-NEXT: s_waitcnt vmcnt(0)
14145 ; GFX908-NEXT: v_mov_b32_e32 v6, v3
14146 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v6
14147 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14148 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v4
14149 ; GFX908-NEXT: v_max_f32_e32 v5, v5, v2
14150 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
14151 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
14152 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
14153 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
14154 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s8
14155 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
14156 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
14157 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
14158 ; GFX908-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
14159 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
14160 ; GFX908-NEXT: v_perm_b32 v5, v5, v3, s9
14161 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[5:6], off offset:2044 glc
14162 ; GFX908-NEXT: s_waitcnt vmcnt(0)
14163 ; GFX908-NEXT: buffer_wbinvl1
14164 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
14165 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
14166 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
14167 ; GFX908-NEXT: s_cbranch_execnz .LBB51_1
14168 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
14169 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
14170 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
14171 ; GFX908-NEXT: s_setpc_b64 s[30:31]
14173 ; GFX8-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_pos:
14175 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14176 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
14177 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
14178 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
14179 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
14180 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 16, v2
14181 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14182 ; GFX8-NEXT: .LBB51_1: ; %atomicrmw.start
14183 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
14184 ; GFX8-NEXT: s_waitcnt vmcnt(0)
14185 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
14186 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v6
14187 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14188 ; GFX8-NEXT: v_max_f32_e32 v0, v0, v1
14189 ; GFX8-NEXT: v_max_f32_e32 v5, v5, v2
14190 ; GFX8-NEXT: v_bfe_u32 v7, v0, 16, 1
14191 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
14192 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v0
14193 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
14194 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
14195 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
14196 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
14197 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
14198 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v0
14199 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
14200 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
14201 ; GFX8-NEXT: v_cndmask_b32_e64 v0, v7, v8, s[4:5]
14202 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
14203 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v0, 16
14204 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
14205 ; GFX8-NEXT: s_waitcnt vmcnt(0)
14206 ; GFX8-NEXT: buffer_wbinvl1
14207 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
14208 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
14209 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
14210 ; GFX8-NEXT: s_cbranch_execnz .LBB51_1
14211 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
14212 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
14213 ; GFX8-NEXT: s_setpc_b64 s[30:31]
14215 ; GFX7-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_pos:
14217 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14218 ; GFX7-NEXT: s_mov_b32 s6, 0
14219 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
14220 ; GFX7-NEXT: s_mov_b32 s4, s6
14221 ; GFX7-NEXT: s_mov_b32 s5, s6
14222 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
14223 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
14224 ; GFX7-NEXT: v_mul_f32_e32 v6, 1.0, v2
14225 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
14226 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
14227 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14228 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v5
14229 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
14230 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14231 ; GFX7-NEXT: .LBB51_1: ; %atomicrmw.start
14232 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
14233 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
14234 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
14235 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
14236 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v3
14237 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
14238 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v4
14239 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v5
14240 ; GFX7-NEXT: v_alignbit_b32 v3, v2, v3, 16
14241 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v6
14242 ; GFX7-NEXT: v_alignbit_b32 v2, v2, v7, 16
14243 ; GFX7-NEXT: v_mov_b32_e32 v7, v3
14244 ; GFX7-NEXT: v_mov_b32_e32 v6, v2
14245 ; GFX7-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 offset:2044 glc
14246 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14247 ; GFX7-NEXT: buffer_wbinvl1
14248 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v3
14249 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
14250 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
14251 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v6
14252 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
14253 ; GFX7-NEXT: s_cbranch_execnz .LBB51_1
14254 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
14255 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
14256 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
14257 ; GFX7-NEXT: v_mov_b32_e32 v1, v2
14258 ; GFX7-NEXT: s_setpc_b64 s[30:31]
14260 ; GFX6-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_pos:
14262 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14263 ; GFX6-NEXT: s_mov_b32 s6, 0
14264 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
14265 ; GFX6-NEXT: s_mov_b32 s4, s6
14266 ; GFX6-NEXT: s_mov_b32 s5, s6
14267 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
14268 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
14269 ; GFX6-NEXT: v_mul_f32_e32 v6, 1.0, v2
14270 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
14271 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
14272 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14273 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v5
14274 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v5
14275 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14276 ; GFX6-NEXT: .LBB51_1: ; %atomicrmw.start
14277 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
14278 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
14279 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
14280 ; GFX6-NEXT: s_waitcnt expcnt(0)
14281 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
14282 ; GFX6-NEXT: v_and_b32_e32 v7, 0xffff0000, v3
14283 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
14284 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v4
14285 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v5
14286 ; GFX6-NEXT: v_alignbit_b32 v3, v2, v3, 16
14287 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v6
14288 ; GFX6-NEXT: v_alignbit_b32 v2, v2, v7, 16
14289 ; GFX6-NEXT: v_mov_b32_e32 v7, v3
14290 ; GFX6-NEXT: v_mov_b32_e32 v6, v2
14291 ; GFX6-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 offset:2044 glc
14292 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14293 ; GFX6-NEXT: buffer_wbinvl1
14294 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v6, v3
14295 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
14296 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
14297 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v6
14298 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
14299 ; GFX6-NEXT: s_cbranch_execnz .LBB51_1
14300 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
14301 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
14302 ; GFX6-NEXT: v_mov_b32_e32 v0, v3
14303 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
14304 ; GFX6-NEXT: s_waitcnt expcnt(0)
14305 ; GFX6-NEXT: s_setpc_b64 s[30:31]
14306 %gep = getelementptr <2 x bfloat>, ptr addrspace(1) %ptr, i64 511
14307 %result = atomicrmw fmax ptr addrspace(1) %gep, <2 x bfloat> %val syncscope("agent") seq_cst
14308 ret <2 x bfloat> %result
14311 define <2 x bfloat> @global_agent_atomic_fmax_ret_v2bf16__offset12b_neg(ptr addrspace(1) %ptr, <2 x bfloat> %val) #0 {
14312 ; GFX12-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_neg:
14314 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
14315 ; GFX12-NEXT: s_wait_expcnt 0x0
14316 ; GFX12-NEXT: s_wait_samplecnt 0x0
14317 ; GFX12-NEXT: s_wait_bvhcnt 0x0
14318 ; GFX12-NEXT: s_wait_kmcnt 0x0
14319 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:-2048
14320 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14321 ; GFX12-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14322 ; GFX12-NEXT: s_mov_b32 s1, 0
14323 ; GFX12-NEXT: .LBB52_1: ; %atomicrmw.start
14324 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
14325 ; GFX12-NEXT: s_wait_loadcnt 0x0
14326 ; GFX12-NEXT: v_mov_b32_e32 v6, v3
14327 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
14328 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14329 ; GFX12-NEXT: v_max_num_f32_e32 v5, v5, v2
14330 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v6
14331 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
14332 ; GFX12-NEXT: v_bfe_u32 v8, v5, 16, 1
14333 ; GFX12-NEXT: v_max_num_f32_e32 v3, v3, v4
14334 ; GFX12-NEXT: v_or_b32_e32 v10, 0x400000, v5
14335 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
14336 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
14337 ; GFX12-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
14338 ; GFX12-NEXT: v_bfe_u32 v7, v3, 16, 1
14339 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v3
14340 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v3, v3
14341 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
14342 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
14343 ; GFX12-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
14344 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
14345 ; GFX12-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
14346 ; GFX12-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
14347 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
14348 ; GFX12-NEXT: s_wait_storecnt 0x0
14349 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[5:6], off offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
14350 ; GFX12-NEXT: s_wait_loadcnt 0x0
14351 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
14352 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
14353 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
14354 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14355 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
14356 ; GFX12-NEXT: s_cbranch_execnz .LBB52_1
14357 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
14358 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
14359 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
14360 ; GFX12-NEXT: s_setpc_b64 s[30:31]
14362 ; GFX940-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_neg:
14364 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14365 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:-2048
14366 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
14367 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14368 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
14369 ; GFX940-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14370 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
14371 ; GFX940-NEXT: .LBB52_1: ; %atomicrmw.start
14372 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
14373 ; GFX940-NEXT: s_waitcnt vmcnt(0)
14374 ; GFX940-NEXT: v_mov_b32_e32 v7, v3
14375 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 16, v7
14376 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
14377 ; GFX940-NEXT: v_max_f32_e32 v3, v3, v4
14378 ; GFX940-NEXT: v_max_f32_e32 v5, v5, v2
14379 ; GFX940-NEXT: v_bfe_u32 v6, v3, 16, 1
14380 ; GFX940-NEXT: v_bfe_u32 v9, v5, 16, 1
14381 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v3
14382 ; GFX940-NEXT: v_or_b32_e32 v10, 0x400000, v5
14383 ; GFX940-NEXT: v_add3_u32 v6, v6, v3, s4
14384 ; GFX940-NEXT: v_add3_u32 v9, v9, v5, s4
14385 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
14386 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v3, v3
14387 ; GFX940-NEXT: s_nop 0
14388 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
14389 ; GFX940-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[0:1]
14390 ; GFX940-NEXT: v_perm_b32 v6, v5, v3, s5
14391 ; GFX940-NEXT: buffer_wbl2 sc1
14392 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[6:7], off offset:-2048 sc0
14393 ; GFX940-NEXT: s_waitcnt vmcnt(0)
14394 ; GFX940-NEXT: buffer_inv sc1
14395 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
14396 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
14397 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
14398 ; GFX940-NEXT: s_cbranch_execnz .LBB52_1
14399 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
14400 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
14401 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
14402 ; GFX940-NEXT: s_setpc_b64 s[30:31]
14404 ; GFX11-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_neg:
14406 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14407 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:-2048
14408 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14409 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14410 ; GFX11-NEXT: s_mov_b32 s1, 0
14411 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
14412 ; GFX11-NEXT: .p2align 6
14413 ; GFX11-NEXT: .LBB52_1: ; %atomicrmw.start
14414 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
14415 ; GFX11-NEXT: s_waitcnt vmcnt(0)
14416 ; GFX11-NEXT: v_mov_b32_e32 v6, v3
14417 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
14418 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14419 ; GFX11-NEXT: v_max_f32_e32 v5, v5, v2
14420 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v6
14421 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
14422 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
14423 ; GFX11-NEXT: v_max_f32_e32 v3, v3, v4
14424 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
14425 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
14426 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
14427 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
14428 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
14429 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v3
14430 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v3, v3
14431 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
14432 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
14433 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
14434 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
14435 ; GFX11-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
14436 ; GFX11-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
14437 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
14438 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[5:6], off offset:-2048 glc
14439 ; GFX11-NEXT: s_waitcnt vmcnt(0)
14440 ; GFX11-NEXT: buffer_gl1_inv
14441 ; GFX11-NEXT: buffer_gl0_inv
14442 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
14443 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
14444 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14445 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
14446 ; GFX11-NEXT: s_cbranch_execnz .LBB52_1
14447 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
14448 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
14449 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
14450 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
14451 ; GFX11-NEXT: s_setpc_b64 s[30:31]
14453 ; GFX10-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_neg:
14455 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14456 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:-2048
14457 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14458 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14459 ; GFX10-NEXT: s_mov_b32 s5, 0
14460 ; GFX10-NEXT: .LBB52_1: ; %atomicrmw.start
14461 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
14462 ; GFX10-NEXT: s_waitcnt vmcnt(0)
14463 ; GFX10-NEXT: v_mov_b32_e32 v6, v3
14464 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v6
14465 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14466 ; GFX10-NEXT: v_max_f32_e32 v3, v3, v4
14467 ; GFX10-NEXT: v_max_f32_e32 v5, v5, v2
14468 ; GFX10-NEXT: v_bfe_u32 v7, v3, 16, 1
14469 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
14470 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v3
14471 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
14472 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
14473 ; GFX10-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
14474 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
14475 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v3, v3
14476 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
14477 ; GFX10-NEXT: v_cndmask_b32_e64 v3, v7, v9, s4
14478 ; GFX10-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
14479 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
14480 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[5:6], off offset:-2048 glc
14481 ; GFX10-NEXT: s_waitcnt vmcnt(0)
14482 ; GFX10-NEXT: buffer_gl1_inv
14483 ; GFX10-NEXT: buffer_gl0_inv
14484 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
14485 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
14486 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
14487 ; GFX10-NEXT: s_cbranch_execnz .LBB52_1
14488 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
14489 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
14490 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
14491 ; GFX10-NEXT: s_setpc_b64 s[30:31]
14493 ; GFX90A-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_neg:
14495 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14496 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:-2048
14497 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
14498 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14499 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
14500 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14501 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
14502 ; GFX90A-NEXT: .LBB52_1: ; %atomicrmw.start
14503 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
14504 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
14505 ; GFX90A-NEXT: v_mov_b32_e32 v7, v3
14506 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v7
14507 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
14508 ; GFX90A-NEXT: v_max_f32_e32 v3, v3, v4
14509 ; GFX90A-NEXT: v_max_f32_e32 v5, v5, v2
14510 ; GFX90A-NEXT: v_bfe_u32 v6, v3, 16, 1
14511 ; GFX90A-NEXT: v_bfe_u32 v9, v5, 16, 1
14512 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v3
14513 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v5
14514 ; GFX90A-NEXT: v_add3_u32 v6, v6, v3, s8
14515 ; GFX90A-NEXT: v_add3_u32 v9, v9, v5, s8
14516 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
14517 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
14518 ; GFX90A-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[4:5]
14519 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
14520 ; GFX90A-NEXT: v_perm_b32 v6, v5, v3, s9
14521 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[6:7], off offset:-2048 glc
14522 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
14523 ; GFX90A-NEXT: buffer_wbinvl1
14524 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
14525 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
14526 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
14527 ; GFX90A-NEXT: s_cbranch_execnz .LBB52_1
14528 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
14529 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
14530 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
14531 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
14533 ; GFX908-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_neg:
14535 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14536 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:-2048
14537 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
14538 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14539 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
14540 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14541 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
14542 ; GFX908-NEXT: .LBB52_1: ; %atomicrmw.start
14543 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
14544 ; GFX908-NEXT: s_waitcnt vmcnt(0)
14545 ; GFX908-NEXT: v_mov_b32_e32 v6, v3
14546 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v6
14547 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14548 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v4
14549 ; GFX908-NEXT: v_max_f32_e32 v5, v5, v2
14550 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
14551 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
14552 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
14553 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
14554 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s8
14555 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
14556 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
14557 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
14558 ; GFX908-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
14559 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
14560 ; GFX908-NEXT: v_perm_b32 v5, v5, v3, s9
14561 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[5:6], off offset:-2048 glc
14562 ; GFX908-NEXT: s_waitcnt vmcnt(0)
14563 ; GFX908-NEXT: buffer_wbinvl1
14564 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
14565 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
14566 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
14567 ; GFX908-NEXT: s_cbranch_execnz .LBB52_1
14568 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
14569 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
14570 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
14571 ; GFX908-NEXT: s_setpc_b64 s[30:31]
14573 ; GFX8-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_neg:
14575 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14576 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
14577 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
14578 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
14579 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
14580 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 16, v2
14581 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
14582 ; GFX8-NEXT: .LBB52_1: ; %atomicrmw.start
14583 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
14584 ; GFX8-NEXT: s_waitcnt vmcnt(0)
14585 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
14586 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v6
14587 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
14588 ; GFX8-NEXT: v_max_f32_e32 v0, v0, v1
14589 ; GFX8-NEXT: v_max_f32_e32 v5, v5, v2
14590 ; GFX8-NEXT: v_bfe_u32 v7, v0, 16, 1
14591 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
14592 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v0
14593 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
14594 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
14595 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
14596 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
14597 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
14598 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v0
14599 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
14600 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
14601 ; GFX8-NEXT: v_cndmask_b32_e64 v0, v7, v8, s[4:5]
14602 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
14603 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v0, 16
14604 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
14605 ; GFX8-NEXT: s_waitcnt vmcnt(0)
14606 ; GFX8-NEXT: buffer_wbinvl1
14607 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
14608 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
14609 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
14610 ; GFX8-NEXT: s_cbranch_execnz .LBB52_1
14611 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
14612 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
14613 ; GFX8-NEXT: s_setpc_b64 s[30:31]
14615 ; GFX7-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_neg:
14617 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14618 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
14619 ; GFX7-NEXT: s_mov_b32 s5, -1
14620 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
14621 ; GFX7-NEXT: s_mov_b32 s6, 0
14622 ; GFX7-NEXT: buffer_load_dword v6, v[0:1], s[4:7], 0 addr64
14623 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
14624 ; GFX7-NEXT: v_mul_f32_e32 v0, 1.0, v3
14625 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v2
14626 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
14627 ; GFX7-NEXT: s_mov_b32 s4, s6
14628 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, -1, v1, vcc
14629 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v0
14630 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
14631 ; GFX7-NEXT: s_mov_b32 s5, s6
14632 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14633 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v6
14634 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v6
14635 ; GFX7-NEXT: .LBB52_1: ; %atomicrmw.start
14636 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
14637 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v1
14638 ; GFX7-NEXT: v_mul_f32_e32 v0, 1.0, v0
14639 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v1
14640 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v0
14641 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
14642 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
14643 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
14644 ; GFX7-NEXT: v_alignbit_b32 v1, v1, v0, 16
14645 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, 16, v6
14646 ; GFX7-NEXT: v_alignbit_b32 v0, v0, v7, 16
14647 ; GFX7-NEXT: v_mov_b32_e32 v7, v1
14648 ; GFX7-NEXT: v_mov_b32_e32 v6, v0
14649 ; GFX7-NEXT: buffer_atomic_cmpswap v[6:7], v[4:5], s[4:7], 0 addr64 glc
14650 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14651 ; GFX7-NEXT: buffer_wbinvl1
14652 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v1
14653 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v6
14654 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
14655 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v6
14656 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
14657 ; GFX7-NEXT: s_cbranch_execnz .LBB52_1
14658 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
14659 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
14660 ; GFX7-NEXT: s_setpc_b64 s[30:31]
14662 ; GFX6-LABEL: global_agent_atomic_fmax_ret_v2bf16__offset12b_neg:
14664 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14665 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
14666 ; GFX6-NEXT: s_mov_b32 s5, -1
14667 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
14668 ; GFX6-NEXT: s_mov_b32 s6, 0
14669 ; GFX6-NEXT: buffer_load_dword v6, v[0:1], s[4:7], 0 addr64
14670 ; GFX6-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
14671 ; GFX6-NEXT: v_mul_f32_e32 v0, 1.0, v3
14672 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v2
14673 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
14674 ; GFX6-NEXT: s_mov_b32 s4, s6
14675 ; GFX6-NEXT: v_addc_u32_e32 v5, vcc, -1, v1, vcc
14676 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v0
14677 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
14678 ; GFX6-NEXT: s_mov_b32 s5, s6
14679 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14680 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff0000, v6
14681 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v6
14682 ; GFX6-NEXT: .LBB52_1: ; %atomicrmw.start
14683 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
14684 ; GFX6-NEXT: v_mul_f32_e32 v1, 1.0, v1
14685 ; GFX6-NEXT: v_mul_f32_e32 v0, 1.0, v0
14686 ; GFX6-NEXT: s_waitcnt expcnt(0)
14687 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v1
14688 ; GFX6-NEXT: v_and_b32_e32 v7, 0xffff0000, v0
14689 ; GFX6-NEXT: v_lshrrev_b32_e32 v1, 16, v1
14690 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
14691 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
14692 ; GFX6-NEXT: v_alignbit_b32 v1, v1, v0, 16
14693 ; GFX6-NEXT: v_lshrrev_b32_e32 v0, 16, v6
14694 ; GFX6-NEXT: v_alignbit_b32 v0, v0, v7, 16
14695 ; GFX6-NEXT: v_mov_b32_e32 v7, v1
14696 ; GFX6-NEXT: v_mov_b32_e32 v6, v0
14697 ; GFX6-NEXT: buffer_atomic_cmpswap v[6:7], v[4:5], s[4:7], 0 addr64 glc
14698 ; GFX6-NEXT: s_waitcnt vmcnt(0)
14699 ; GFX6-NEXT: buffer_wbinvl1
14700 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v6, v1
14701 ; GFX6-NEXT: v_and_b32_e32 v1, 0xffff0000, v6
14702 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
14703 ; GFX6-NEXT: v_lshlrev_b32_e32 v0, 16, v6
14704 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
14705 ; GFX6-NEXT: s_cbranch_execnz .LBB52_1
14706 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
14707 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
14708 ; GFX6-NEXT: s_waitcnt expcnt(0)
14709 ; GFX6-NEXT: s_setpc_b64 s[30:31]
14710 %gep = getelementptr <2 x bfloat>, ptr addrspace(1) %ptr, i64 -512
14711 %result = atomicrmw fmax ptr addrspace(1) %gep, <2 x bfloat> %val syncscope("agent") seq_cst
14712 ret <2 x bfloat> %result
14715 define void @global_agent_atomic_fmax_noret_v2bf16(ptr addrspace(1) %ptr, <2 x bfloat> %val) #0 {
14716 ; GFX12-LABEL: global_agent_atomic_fmax_noret_v2bf16:
14718 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
14719 ; GFX12-NEXT: s_wait_expcnt 0x0
14720 ; GFX12-NEXT: s_wait_samplecnt 0x0
14721 ; GFX12-NEXT: s_wait_bvhcnt 0x0
14722 ; GFX12-NEXT: s_wait_kmcnt 0x0
14723 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off
14724 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14725 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
14726 ; GFX12-NEXT: s_mov_b32 s1, 0
14727 ; GFX12-NEXT: .LBB53_1: ; %atomicrmw.start
14728 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
14729 ; GFX12-NEXT: s_wait_loadcnt 0x0
14730 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v3
14731 ; GFX12-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
14732 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
14733 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v4
14734 ; GFX12-NEXT: v_max_num_f32_e32 v6, v6, v5
14735 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
14736 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
14737 ; GFX12-NEXT: v_bfe_u32 v8, v6, 16, 1
14738 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v2
14739 ; GFX12-NEXT: v_or_b32_e32 v10, 0x400000, v6
14740 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
14741 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
14742 ; GFX12-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
14743 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v2, v2
14744 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
14745 ; GFX12-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
14746 ; GFX12-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
14747 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
14748 ; GFX12-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
14749 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
14750 ; GFX12-NEXT: s_wait_storecnt 0x0
14751 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off th:TH_ATOMIC_RETURN scope:SCOPE_DEV
14752 ; GFX12-NEXT: s_wait_loadcnt 0x0
14753 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
14754 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
14755 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
14756 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
14757 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14758 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
14759 ; GFX12-NEXT: s_cbranch_execnz .LBB53_1
14760 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
14761 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
14762 ; GFX12-NEXT: s_setpc_b64 s[30:31]
14764 ; GFX940-LABEL: global_agent_atomic_fmax_noret_v2bf16:
14766 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14767 ; GFX940-NEXT: global_load_dword v3, v[0:1], off
14768 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
14769 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14770 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
14771 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
14772 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
14773 ; GFX940-NEXT: .LBB53_1: ; %atomicrmw.start
14774 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
14775 ; GFX940-NEXT: s_waitcnt vmcnt(0)
14776 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v3
14777 ; GFX940-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
14778 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
14779 ; GFX940-NEXT: v_max_f32_e32 v6, v6, v5
14780 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
14781 ; GFX940-NEXT: v_bfe_u32 v9, v6, 16, 1
14782 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
14783 ; GFX940-NEXT: v_or_b32_e32 v10, 0x400000, v6
14784 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s4
14785 ; GFX940-NEXT: v_add3_u32 v9, v9, v6, s4
14786 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
14787 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v2, v2
14788 ; GFX940-NEXT: s_nop 0
14789 ; GFX940-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
14790 ; GFX940-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[0:1]
14791 ; GFX940-NEXT: v_perm_b32 v2, v6, v2, s5
14792 ; GFX940-NEXT: buffer_wbl2 sc1
14793 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off sc0
14794 ; GFX940-NEXT: s_waitcnt vmcnt(0)
14795 ; GFX940-NEXT: buffer_inv sc1
14796 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
14797 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
14798 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
14799 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
14800 ; GFX940-NEXT: s_cbranch_execnz .LBB53_1
14801 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
14802 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
14803 ; GFX940-NEXT: s_setpc_b64 s[30:31]
14805 ; GFX11-LABEL: global_agent_atomic_fmax_noret_v2bf16:
14807 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14808 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off
14809 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14810 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
14811 ; GFX11-NEXT: s_mov_b32 s1, 0
14812 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
14813 ; GFX11-NEXT: .p2align 6
14814 ; GFX11-NEXT: .LBB53_1: ; %atomicrmw.start
14815 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
14816 ; GFX11-NEXT: s_waitcnt vmcnt(0)
14817 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
14818 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
14819 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
14820 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v4
14821 ; GFX11-NEXT: v_max_f32_e32 v6, v6, v5
14822 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
14823 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
14824 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
14825 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
14826 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
14827 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
14828 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
14829 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
14830 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
14831 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
14832 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
14833 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
14834 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
14835 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
14836 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
14837 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off glc
14838 ; GFX11-NEXT: s_waitcnt vmcnt(0)
14839 ; GFX11-NEXT: buffer_gl1_inv
14840 ; GFX11-NEXT: buffer_gl0_inv
14841 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
14842 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
14843 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
14844 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14845 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
14846 ; GFX11-NEXT: s_cbranch_execnz .LBB53_1
14847 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
14848 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
14849 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
14850 ; GFX11-NEXT: s_setpc_b64 s[30:31]
14852 ; GFX10-LABEL: global_agent_atomic_fmax_noret_v2bf16:
14854 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14855 ; GFX10-NEXT: global_load_dword v3, v[0:1], off
14856 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14857 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
14858 ; GFX10-NEXT: s_mov_b32 s5, 0
14859 ; GFX10-NEXT: .LBB53_1: ; %atomicrmw.start
14860 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
14861 ; GFX10-NEXT: s_waitcnt vmcnt(0)
14862 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
14863 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
14864 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v4
14865 ; GFX10-NEXT: v_max_f32_e32 v6, v6, v5
14866 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
14867 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
14868 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
14869 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
14870 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
14871 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
14872 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
14873 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
14874 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
14875 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
14876 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
14877 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
14878 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
14879 ; GFX10-NEXT: s_waitcnt vmcnt(0)
14880 ; GFX10-NEXT: buffer_gl1_inv
14881 ; GFX10-NEXT: buffer_gl0_inv
14882 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
14883 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
14884 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
14885 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
14886 ; GFX10-NEXT: s_cbranch_execnz .LBB53_1
14887 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
14888 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
14889 ; GFX10-NEXT: s_setpc_b64 s[30:31]
14891 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_v2bf16:
14893 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14894 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off
14895 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
14896 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14897 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
14898 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
14899 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
14900 ; GFX90A-NEXT: .LBB53_1: ; %atomicrmw.start
14901 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
14902 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
14903 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
14904 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
14905 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
14906 ; GFX90A-NEXT: v_max_f32_e32 v6, v6, v5
14907 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
14908 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
14909 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
14910 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
14911 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s8
14912 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
14913 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
14914 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
14915 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
14916 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
14917 ; GFX90A-NEXT: v_perm_b32 v2, v6, v2, s9
14918 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
14919 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
14920 ; GFX90A-NEXT: buffer_wbinvl1
14921 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
14922 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
14923 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
14924 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
14925 ; GFX90A-NEXT: s_cbranch_execnz .LBB53_1
14926 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
14927 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
14928 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
14930 ; GFX908-LABEL: global_agent_atomic_fmax_noret_v2bf16:
14932 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14933 ; GFX908-NEXT: global_load_dword v3, v[0:1], off
14934 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
14935 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14936 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
14937 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
14938 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
14939 ; GFX908-NEXT: .LBB53_1: ; %atomicrmw.start
14940 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
14941 ; GFX908-NEXT: s_waitcnt vmcnt(0)
14942 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
14943 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
14944 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
14945 ; GFX908-NEXT: v_max_f32_e32 v6, v6, v5
14946 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
14947 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
14948 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
14949 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
14950 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s8
14951 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
14952 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
14953 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
14954 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
14955 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
14956 ; GFX908-NEXT: v_perm_b32 v2, v6, v2, s9
14957 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off glc
14958 ; GFX908-NEXT: s_waitcnt vmcnt(0)
14959 ; GFX908-NEXT: buffer_wbinvl1
14960 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
14961 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
14962 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
14963 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
14964 ; GFX908-NEXT: s_cbranch_execnz .LBB53_1
14965 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
14966 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
14967 ; GFX908-NEXT: s_setpc_b64 s[30:31]
14969 ; GFX8-LABEL: global_agent_atomic_fmax_noret_v2bf16:
14971 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14972 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
14973 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
14974 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
14975 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
14976 ; GFX8-NEXT: .LBB53_1: ; %atomicrmw.start
14977 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
14978 ; GFX8-NEXT: s_waitcnt vmcnt(0)
14979 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
14980 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
14981 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
14982 ; GFX8-NEXT: v_max_f32_e32 v6, v6, v5
14983 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
14984 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
14985 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
14986 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
14987 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
14988 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
14989 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
14990 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
14991 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
14992 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
14993 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
14994 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
14995 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
14996 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
14997 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14998 ; GFX8-NEXT: s_waitcnt vmcnt(0)
14999 ; GFX8-NEXT: buffer_wbinvl1
15000 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
15001 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15002 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
15003 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
15004 ; GFX8-NEXT: s_cbranch_execnz .LBB53_1
15005 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
15006 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
15007 ; GFX8-NEXT: s_setpc_b64 s[30:31]
15009 ; GFX7-LABEL: global_agent_atomic_fmax_noret_v2bf16:
15011 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15012 ; GFX7-NEXT: s_mov_b32 s6, 0
15013 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
15014 ; GFX7-NEXT: s_mov_b32 s4, s6
15015 ; GFX7-NEXT: s_mov_b32 s5, s6
15016 ; GFX7-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
15017 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
15018 ; GFX7-NEXT: v_mul_f32_e32 v6, 1.0, v2
15019 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
15020 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v3
15021 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v6
15022 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15023 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
15024 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v4
15025 ; GFX7-NEXT: .LBB53_1: ; %atomicrmw.start
15026 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
15027 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
15028 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
15029 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
15030 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
15031 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v5
15032 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
15033 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
15034 ; GFX7-NEXT: v_alignbit_b32 v5, v5, v4, 16
15035 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v6
15036 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v7, 16
15037 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
15038 ; GFX7-NEXT: v_mov_b32_e32 v6, v4
15039 ; GFX7-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 glc
15040 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15041 ; GFX7-NEXT: buffer_wbinvl1
15042 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
15043 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15044 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
15045 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v6
15046 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
15047 ; GFX7-NEXT: s_cbranch_execnz .LBB53_1
15048 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
15049 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
15050 ; GFX7-NEXT: s_setpc_b64 s[30:31]
15052 ; GFX6-LABEL: global_agent_atomic_fmax_noret_v2bf16:
15054 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15055 ; GFX6-NEXT: s_mov_b32 s6, 0
15056 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
15057 ; GFX6-NEXT: s_mov_b32 s4, s6
15058 ; GFX6-NEXT: s_mov_b32 s5, s6
15059 ; GFX6-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
15060 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
15061 ; GFX6-NEXT: v_mul_f32_e32 v6, 1.0, v2
15062 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
15063 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v3
15064 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v6
15065 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15066 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
15067 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v4
15068 ; GFX6-NEXT: .LBB53_1: ; %atomicrmw.start
15069 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
15070 ; GFX6-NEXT: v_mul_f32_e32 v5, 1.0, v5
15071 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v4
15072 ; GFX6-NEXT: s_waitcnt expcnt(0)
15073 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
15074 ; GFX6-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
15075 ; GFX6-NEXT: v_lshrrev_b32_e32 v5, 16, v5
15076 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
15077 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
15078 ; GFX6-NEXT: v_alignbit_b32 v5, v5, v4, 16
15079 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v6
15080 ; GFX6-NEXT: v_alignbit_b32 v4, v4, v7, 16
15081 ; GFX6-NEXT: v_mov_b32_e32 v7, v5
15082 ; GFX6-NEXT: v_mov_b32_e32 v6, v4
15083 ; GFX6-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 glc
15084 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15085 ; GFX6-NEXT: buffer_wbinvl1
15086 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
15087 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15088 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
15089 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v6
15090 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
15091 ; GFX6-NEXT: s_cbranch_execnz .LBB53_1
15092 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
15093 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
15094 ; GFX6-NEXT: s_waitcnt expcnt(0)
15095 ; GFX6-NEXT: s_setpc_b64 s[30:31]
15096 %unused = atomicrmw fmax ptr addrspace(1) %ptr, <2 x bfloat> %val syncscope("agent") seq_cst
15100 define void @global_agent_atomic_fmax_noret_v2bf16__offset12b_pos(ptr addrspace(1) %ptr, <2 x bfloat> %val) #0 {
15101 ; GFX12-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_pos:
15103 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15104 ; GFX12-NEXT: s_wait_expcnt 0x0
15105 ; GFX12-NEXT: s_wait_samplecnt 0x0
15106 ; GFX12-NEXT: s_wait_bvhcnt 0x0
15107 ; GFX12-NEXT: s_wait_kmcnt 0x0
15108 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
15109 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15110 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15111 ; GFX12-NEXT: s_mov_b32 s1, 0
15112 ; GFX12-NEXT: .LBB54_1: ; %atomicrmw.start
15113 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
15114 ; GFX12-NEXT: s_wait_loadcnt 0x0
15115 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15116 ; GFX12-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15117 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15118 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v4
15119 ; GFX12-NEXT: v_max_num_f32_e32 v6, v6, v5
15120 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15121 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
15122 ; GFX12-NEXT: v_bfe_u32 v8, v6, 16, 1
15123 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v2
15124 ; GFX12-NEXT: v_or_b32_e32 v10, 0x400000, v6
15125 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
15126 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
15127 ; GFX12-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
15128 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v2, v2
15129 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15130 ; GFX12-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
15131 ; GFX12-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
15132 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
15133 ; GFX12-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
15134 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
15135 ; GFX12-NEXT: s_wait_storecnt 0x0
15136 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
15137 ; GFX12-NEXT: s_wait_loadcnt 0x0
15138 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
15139 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
15140 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
15141 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
15142 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
15143 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
15144 ; GFX12-NEXT: s_cbranch_execnz .LBB54_1
15145 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
15146 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
15147 ; GFX12-NEXT: s_setpc_b64 s[30:31]
15149 ; GFX940-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_pos:
15151 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15152 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
15153 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
15154 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15155 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
15156 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15157 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
15158 ; GFX940-NEXT: .LBB54_1: ; %atomicrmw.start
15159 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
15160 ; GFX940-NEXT: s_waitcnt vmcnt(0)
15161 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15162 ; GFX940-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15163 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
15164 ; GFX940-NEXT: v_max_f32_e32 v6, v6, v5
15165 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
15166 ; GFX940-NEXT: v_bfe_u32 v9, v6, 16, 1
15167 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
15168 ; GFX940-NEXT: v_or_b32_e32 v10, 0x400000, v6
15169 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s4
15170 ; GFX940-NEXT: v_add3_u32 v9, v9, v6, s4
15171 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
15172 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v2, v2
15173 ; GFX940-NEXT: s_nop 0
15174 ; GFX940-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
15175 ; GFX940-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[0:1]
15176 ; GFX940-NEXT: v_perm_b32 v2, v6, v2, s5
15177 ; GFX940-NEXT: buffer_wbl2 sc1
15178 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 sc0
15179 ; GFX940-NEXT: s_waitcnt vmcnt(0)
15180 ; GFX940-NEXT: buffer_inv sc1
15181 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
15182 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
15183 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
15184 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
15185 ; GFX940-NEXT: s_cbranch_execnz .LBB54_1
15186 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
15187 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
15188 ; GFX940-NEXT: s_setpc_b64 s[30:31]
15190 ; GFX11-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_pos:
15192 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15193 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
15194 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15195 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15196 ; GFX11-NEXT: s_mov_b32 s1, 0
15197 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
15198 ; GFX11-NEXT: .p2align 6
15199 ; GFX11-NEXT: .LBB54_1: ; %atomicrmw.start
15200 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
15201 ; GFX11-NEXT: s_waitcnt vmcnt(0)
15202 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15203 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15204 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15205 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v4
15206 ; GFX11-NEXT: v_max_f32_e32 v6, v6, v5
15207 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15208 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
15209 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
15210 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
15211 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
15212 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
15213 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
15214 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
15215 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
15216 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15217 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
15218 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
15219 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
15220 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
15221 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
15222 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 glc
15223 ; GFX11-NEXT: s_waitcnt vmcnt(0)
15224 ; GFX11-NEXT: buffer_gl1_inv
15225 ; GFX11-NEXT: buffer_gl0_inv
15226 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
15227 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
15228 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
15229 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
15230 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
15231 ; GFX11-NEXT: s_cbranch_execnz .LBB54_1
15232 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
15233 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
15234 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
15235 ; GFX11-NEXT: s_setpc_b64 s[30:31]
15237 ; GFX10-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_pos:
15239 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15240 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
15241 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15242 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15243 ; GFX10-NEXT: s_mov_b32 s5, 0
15244 ; GFX10-NEXT: .LBB54_1: ; %atomicrmw.start
15245 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
15246 ; GFX10-NEXT: s_waitcnt vmcnt(0)
15247 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15248 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15249 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v4
15250 ; GFX10-NEXT: v_max_f32_e32 v6, v6, v5
15251 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
15252 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
15253 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
15254 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
15255 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
15256 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
15257 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
15258 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
15259 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
15260 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
15261 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
15262 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
15263 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
15264 ; GFX10-NEXT: s_waitcnt vmcnt(0)
15265 ; GFX10-NEXT: buffer_gl1_inv
15266 ; GFX10-NEXT: buffer_gl0_inv
15267 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
15268 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
15269 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
15270 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
15271 ; GFX10-NEXT: s_cbranch_execnz .LBB54_1
15272 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
15273 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
15274 ; GFX10-NEXT: s_setpc_b64 s[30:31]
15276 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_pos:
15278 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15279 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
15280 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
15281 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15282 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
15283 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15284 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
15285 ; GFX90A-NEXT: .LBB54_1: ; %atomicrmw.start
15286 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
15287 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
15288 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15289 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15290 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
15291 ; GFX90A-NEXT: v_max_f32_e32 v6, v6, v5
15292 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
15293 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
15294 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
15295 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
15296 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s8
15297 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
15298 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
15299 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
15300 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
15301 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
15302 ; GFX90A-NEXT: v_perm_b32 v2, v6, v2, s9
15303 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
15304 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
15305 ; GFX90A-NEXT: buffer_wbinvl1
15306 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
15307 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15308 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
15309 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
15310 ; GFX90A-NEXT: s_cbranch_execnz .LBB54_1
15311 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
15312 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
15313 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
15315 ; GFX908-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_pos:
15317 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15318 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
15319 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
15320 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15321 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
15322 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15323 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
15324 ; GFX908-NEXT: .LBB54_1: ; %atomicrmw.start
15325 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
15326 ; GFX908-NEXT: s_waitcnt vmcnt(0)
15327 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15328 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15329 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
15330 ; GFX908-NEXT: v_max_f32_e32 v6, v6, v5
15331 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
15332 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
15333 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
15334 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
15335 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s8
15336 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
15337 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
15338 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
15339 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
15340 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
15341 ; GFX908-NEXT: v_perm_b32 v2, v6, v2, s9
15342 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
15343 ; GFX908-NEXT: s_waitcnt vmcnt(0)
15344 ; GFX908-NEXT: buffer_wbinvl1
15345 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
15346 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15347 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
15348 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
15349 ; GFX908-NEXT: s_cbranch_execnz .LBB54_1
15350 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
15351 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
15352 ; GFX908-NEXT: s_setpc_b64 s[30:31]
15354 ; GFX8-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_pos:
15356 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15357 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
15358 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
15359 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
15360 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
15361 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15362 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15363 ; GFX8-NEXT: .LBB54_1: ; %atomicrmw.start
15364 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
15365 ; GFX8-NEXT: s_waitcnt vmcnt(0)
15366 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15367 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15368 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
15369 ; GFX8-NEXT: v_max_f32_e32 v6, v6, v5
15370 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
15371 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
15372 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
15373 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
15374 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
15375 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
15376 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
15377 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
15378 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
15379 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
15380 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
15381 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
15382 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
15383 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
15384 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
15385 ; GFX8-NEXT: s_waitcnt vmcnt(0)
15386 ; GFX8-NEXT: buffer_wbinvl1
15387 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
15388 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15389 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
15390 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
15391 ; GFX8-NEXT: s_cbranch_execnz .LBB54_1
15392 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
15393 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
15394 ; GFX8-NEXT: s_setpc_b64 s[30:31]
15396 ; GFX7-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_pos:
15398 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15399 ; GFX7-NEXT: s_mov_b32 s6, 0
15400 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
15401 ; GFX7-NEXT: s_mov_b32 s4, s6
15402 ; GFX7-NEXT: s_mov_b32 s5, s6
15403 ; GFX7-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64 offset:2044
15404 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
15405 ; GFX7-NEXT: v_mul_f32_e32 v6, 1.0, v2
15406 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
15407 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v3
15408 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v6
15409 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15410 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
15411 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v4
15412 ; GFX7-NEXT: .LBB54_1: ; %atomicrmw.start
15413 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
15414 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
15415 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
15416 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
15417 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
15418 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v5
15419 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
15420 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
15421 ; GFX7-NEXT: v_alignbit_b32 v5, v5, v4, 16
15422 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v6
15423 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v7, 16
15424 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
15425 ; GFX7-NEXT: v_mov_b32_e32 v6, v4
15426 ; GFX7-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 offset:2044 glc
15427 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15428 ; GFX7-NEXT: buffer_wbinvl1
15429 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
15430 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15431 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
15432 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v6
15433 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
15434 ; GFX7-NEXT: s_cbranch_execnz .LBB54_1
15435 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
15436 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
15437 ; GFX7-NEXT: s_setpc_b64 s[30:31]
15439 ; GFX6-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_pos:
15441 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15442 ; GFX6-NEXT: s_mov_b32 s6, 0
15443 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
15444 ; GFX6-NEXT: s_mov_b32 s4, s6
15445 ; GFX6-NEXT: s_mov_b32 s5, s6
15446 ; GFX6-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64 offset:2044
15447 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
15448 ; GFX6-NEXT: v_mul_f32_e32 v6, 1.0, v2
15449 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
15450 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v3
15451 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v6
15452 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15453 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
15454 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v4
15455 ; GFX6-NEXT: .LBB54_1: ; %atomicrmw.start
15456 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
15457 ; GFX6-NEXT: v_mul_f32_e32 v5, 1.0, v5
15458 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v4
15459 ; GFX6-NEXT: s_waitcnt expcnt(0)
15460 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
15461 ; GFX6-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
15462 ; GFX6-NEXT: v_lshrrev_b32_e32 v5, 16, v5
15463 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
15464 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
15465 ; GFX6-NEXT: v_alignbit_b32 v5, v5, v4, 16
15466 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v6
15467 ; GFX6-NEXT: v_alignbit_b32 v4, v4, v7, 16
15468 ; GFX6-NEXT: v_mov_b32_e32 v7, v5
15469 ; GFX6-NEXT: v_mov_b32_e32 v6, v4
15470 ; GFX6-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 offset:2044 glc
15471 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15472 ; GFX6-NEXT: buffer_wbinvl1
15473 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
15474 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15475 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
15476 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v6
15477 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
15478 ; GFX6-NEXT: s_cbranch_execnz .LBB54_1
15479 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
15480 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
15481 ; GFX6-NEXT: s_waitcnt expcnt(0)
15482 ; GFX6-NEXT: s_setpc_b64 s[30:31]
15483 %gep = getelementptr <2 x bfloat>, ptr addrspace(1) %ptr, i64 511
15484 %unused = atomicrmw fmax ptr addrspace(1) %gep, <2 x bfloat> %val syncscope("agent") seq_cst
15488 define void @global_agent_atomic_fmax_noret_v2bf16__offset12b_neg(ptr addrspace(1) %ptr, <2 x bfloat> %val) #0 {
15489 ; GFX12-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_neg:
15491 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15492 ; GFX12-NEXT: s_wait_expcnt 0x0
15493 ; GFX12-NEXT: s_wait_samplecnt 0x0
15494 ; GFX12-NEXT: s_wait_bvhcnt 0x0
15495 ; GFX12-NEXT: s_wait_kmcnt 0x0
15496 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:-2048
15497 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15498 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15499 ; GFX12-NEXT: s_mov_b32 s1, 0
15500 ; GFX12-NEXT: .LBB55_1: ; %atomicrmw.start
15501 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
15502 ; GFX12-NEXT: s_wait_loadcnt 0x0
15503 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15504 ; GFX12-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15505 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15506 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v4
15507 ; GFX12-NEXT: v_max_num_f32_e32 v6, v6, v5
15508 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15509 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
15510 ; GFX12-NEXT: v_bfe_u32 v8, v6, 16, 1
15511 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v2
15512 ; GFX12-NEXT: v_or_b32_e32 v10, 0x400000, v6
15513 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
15514 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
15515 ; GFX12-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
15516 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v2, v2
15517 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15518 ; GFX12-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
15519 ; GFX12-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
15520 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
15521 ; GFX12-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
15522 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
15523 ; GFX12-NEXT: s_wait_storecnt 0x0
15524 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
15525 ; GFX12-NEXT: s_wait_loadcnt 0x0
15526 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
15527 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
15528 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
15529 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
15530 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
15531 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
15532 ; GFX12-NEXT: s_cbranch_execnz .LBB55_1
15533 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
15534 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
15535 ; GFX12-NEXT: s_setpc_b64 s[30:31]
15537 ; GFX940-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_neg:
15539 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15540 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:-2048
15541 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
15542 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15543 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
15544 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15545 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
15546 ; GFX940-NEXT: .LBB55_1: ; %atomicrmw.start
15547 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
15548 ; GFX940-NEXT: s_waitcnt vmcnt(0)
15549 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15550 ; GFX940-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15551 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
15552 ; GFX940-NEXT: v_max_f32_e32 v6, v6, v5
15553 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
15554 ; GFX940-NEXT: v_bfe_u32 v9, v6, 16, 1
15555 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
15556 ; GFX940-NEXT: v_or_b32_e32 v10, 0x400000, v6
15557 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s4
15558 ; GFX940-NEXT: v_add3_u32 v9, v9, v6, s4
15559 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
15560 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v2, v2
15561 ; GFX940-NEXT: s_nop 0
15562 ; GFX940-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
15563 ; GFX940-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[0:1]
15564 ; GFX940-NEXT: v_perm_b32 v2, v6, v2, s5
15565 ; GFX940-NEXT: buffer_wbl2 sc1
15566 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 sc0
15567 ; GFX940-NEXT: s_waitcnt vmcnt(0)
15568 ; GFX940-NEXT: buffer_inv sc1
15569 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
15570 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
15571 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
15572 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
15573 ; GFX940-NEXT: s_cbranch_execnz .LBB55_1
15574 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
15575 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
15576 ; GFX940-NEXT: s_setpc_b64 s[30:31]
15578 ; GFX11-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_neg:
15580 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15581 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:-2048
15582 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15583 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15584 ; GFX11-NEXT: s_mov_b32 s1, 0
15585 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
15586 ; GFX11-NEXT: .p2align 6
15587 ; GFX11-NEXT: .LBB55_1: ; %atomicrmw.start
15588 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
15589 ; GFX11-NEXT: s_waitcnt vmcnt(0)
15590 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15591 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15592 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15593 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v4
15594 ; GFX11-NEXT: v_max_f32_e32 v6, v6, v5
15595 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15596 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
15597 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
15598 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
15599 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
15600 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
15601 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
15602 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
15603 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
15604 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15605 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
15606 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
15607 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
15608 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
15609 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
15610 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:-2048 glc
15611 ; GFX11-NEXT: s_waitcnt vmcnt(0)
15612 ; GFX11-NEXT: buffer_gl1_inv
15613 ; GFX11-NEXT: buffer_gl0_inv
15614 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
15615 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
15616 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
15617 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
15618 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
15619 ; GFX11-NEXT: s_cbranch_execnz .LBB55_1
15620 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
15621 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
15622 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
15623 ; GFX11-NEXT: s_setpc_b64 s[30:31]
15625 ; GFX10-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_neg:
15627 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15628 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:-2048
15629 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15630 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15631 ; GFX10-NEXT: s_mov_b32 s5, 0
15632 ; GFX10-NEXT: .LBB55_1: ; %atomicrmw.start
15633 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
15634 ; GFX10-NEXT: s_waitcnt vmcnt(0)
15635 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15636 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15637 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v4
15638 ; GFX10-NEXT: v_max_f32_e32 v6, v6, v5
15639 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
15640 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
15641 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
15642 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
15643 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
15644 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
15645 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
15646 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
15647 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
15648 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
15649 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
15650 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
15651 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
15652 ; GFX10-NEXT: s_waitcnt vmcnt(0)
15653 ; GFX10-NEXT: buffer_gl1_inv
15654 ; GFX10-NEXT: buffer_gl0_inv
15655 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
15656 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
15657 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
15658 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
15659 ; GFX10-NEXT: s_cbranch_execnz .LBB55_1
15660 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
15661 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
15662 ; GFX10-NEXT: s_setpc_b64 s[30:31]
15664 ; GFX90A-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_neg:
15666 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15667 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:-2048
15668 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
15669 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15670 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
15671 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15672 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
15673 ; GFX90A-NEXT: .LBB55_1: ; %atomicrmw.start
15674 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
15675 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
15676 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15677 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15678 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
15679 ; GFX90A-NEXT: v_max_f32_e32 v6, v6, v5
15680 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
15681 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
15682 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
15683 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
15684 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s8
15685 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
15686 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
15687 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
15688 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
15689 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
15690 ; GFX90A-NEXT: v_perm_b32 v2, v6, v2, s9
15691 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
15692 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
15693 ; GFX90A-NEXT: buffer_wbinvl1
15694 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
15695 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15696 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
15697 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
15698 ; GFX90A-NEXT: s_cbranch_execnz .LBB55_1
15699 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
15700 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
15701 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
15703 ; GFX908-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_neg:
15705 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15706 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:-2048
15707 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
15708 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15709 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
15710 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15711 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
15712 ; GFX908-NEXT: .LBB55_1: ; %atomicrmw.start
15713 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
15714 ; GFX908-NEXT: s_waitcnt vmcnt(0)
15715 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15716 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15717 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
15718 ; GFX908-NEXT: v_max_f32_e32 v6, v6, v5
15719 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
15720 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
15721 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
15722 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
15723 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s8
15724 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
15725 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
15726 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
15727 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
15728 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
15729 ; GFX908-NEXT: v_perm_b32 v2, v6, v2, s9
15730 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:-2048 glc
15731 ; GFX908-NEXT: s_waitcnt vmcnt(0)
15732 ; GFX908-NEXT: buffer_wbinvl1
15733 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
15734 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15735 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
15736 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
15737 ; GFX908-NEXT: s_cbranch_execnz .LBB55_1
15738 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
15739 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
15740 ; GFX908-NEXT: s_setpc_b64 s[30:31]
15742 ; GFX8-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_neg:
15744 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15745 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff800, v0
15746 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
15747 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
15748 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
15749 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15750 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
15751 ; GFX8-NEXT: .LBB55_1: ; %atomicrmw.start
15752 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
15753 ; GFX8-NEXT: s_waitcnt vmcnt(0)
15754 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
15755 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15756 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
15757 ; GFX8-NEXT: v_max_f32_e32 v6, v6, v5
15758 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
15759 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
15760 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
15761 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
15762 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
15763 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
15764 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
15765 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
15766 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
15767 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
15768 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
15769 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
15770 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
15771 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
15772 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
15773 ; GFX8-NEXT: s_waitcnt vmcnt(0)
15774 ; GFX8-NEXT: buffer_wbinvl1
15775 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
15776 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15777 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
15778 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
15779 ; GFX8-NEXT: s_cbranch_execnz .LBB55_1
15780 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
15781 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
15782 ; GFX8-NEXT: s_setpc_b64 s[30:31]
15784 ; GFX7-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_neg:
15786 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15787 ; GFX7-NEXT: s_movk_i32 s4, 0xf800
15788 ; GFX7-NEXT: s_mov_b32 s5, -1
15789 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
15790 ; GFX7-NEXT: s_mov_b32 s6, 0
15791 ; GFX7-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
15792 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0xfffff800, v0
15793 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
15794 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v2
15795 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
15796 ; GFX7-NEXT: s_mov_b32 s4, s6
15797 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
15798 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v3
15799 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v5
15800 ; GFX7-NEXT: s_mov_b32 s5, s6
15801 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15802 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
15803 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v4
15804 ; GFX7-NEXT: .LBB55_1: ; %atomicrmw.start
15805 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
15806 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
15807 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
15808 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
15809 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
15810 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v5
15811 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
15812 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
15813 ; GFX7-NEXT: v_alignbit_b32 v5, v5, v4, 16
15814 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v6
15815 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v7, 16
15816 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
15817 ; GFX7-NEXT: v_mov_b32_e32 v6, v4
15818 ; GFX7-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 glc
15819 ; GFX7-NEXT: s_waitcnt vmcnt(0)
15820 ; GFX7-NEXT: buffer_wbinvl1
15821 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
15822 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15823 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
15824 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v6
15825 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
15826 ; GFX7-NEXT: s_cbranch_execnz .LBB55_1
15827 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
15828 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
15829 ; GFX7-NEXT: s_setpc_b64 s[30:31]
15831 ; GFX6-LABEL: global_agent_atomic_fmax_noret_v2bf16__offset12b_neg:
15833 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15834 ; GFX6-NEXT: s_movk_i32 s4, 0xf800
15835 ; GFX6-NEXT: s_mov_b32 s5, -1
15836 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
15837 ; GFX6-NEXT: s_mov_b32 s6, 0
15838 ; GFX6-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64
15839 ; GFX6-NEXT: v_add_i32_e32 v0, vcc, 0xfffff800, v0
15840 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
15841 ; GFX6-NEXT: v_mul_f32_e32 v5, 1.0, v2
15842 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
15843 ; GFX6-NEXT: s_mov_b32 s4, s6
15844 ; GFX6-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
15845 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v3
15846 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v5
15847 ; GFX6-NEXT: s_mov_b32 s5, s6
15848 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15849 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
15850 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v4
15851 ; GFX6-NEXT: .LBB55_1: ; %atomicrmw.start
15852 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
15853 ; GFX6-NEXT: v_mul_f32_e32 v5, 1.0, v5
15854 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v4
15855 ; GFX6-NEXT: s_waitcnt expcnt(0)
15856 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
15857 ; GFX6-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
15858 ; GFX6-NEXT: v_lshrrev_b32_e32 v5, 16, v5
15859 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
15860 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
15861 ; GFX6-NEXT: v_alignbit_b32 v5, v5, v4, 16
15862 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v6
15863 ; GFX6-NEXT: v_alignbit_b32 v4, v4, v7, 16
15864 ; GFX6-NEXT: v_mov_b32_e32 v7, v5
15865 ; GFX6-NEXT: v_mov_b32_e32 v6, v4
15866 ; GFX6-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 glc
15867 ; GFX6-NEXT: s_waitcnt vmcnt(0)
15868 ; GFX6-NEXT: buffer_wbinvl1
15869 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
15870 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15871 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
15872 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v6
15873 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
15874 ; GFX6-NEXT: s_cbranch_execnz .LBB55_1
15875 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
15876 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
15877 ; GFX6-NEXT: s_waitcnt expcnt(0)
15878 ; GFX6-NEXT: s_setpc_b64 s[30:31]
15879 %gep = getelementptr <2 x bfloat>, ptr addrspace(1) %ptr, i64 -512
15880 %unused = atomicrmw fmax ptr addrspace(1) %gep, <2 x bfloat> %val syncscope("agent") seq_cst
15884 define <2 x bfloat> @global_system_atomic_fmax_ret_v2bf16__offset12b_pos(ptr addrspace(1) %ptr, <2 x bfloat> %val) #0 {
15885 ; GFX12-LABEL: global_system_atomic_fmax_ret_v2bf16__offset12b_pos:
15887 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15888 ; GFX12-NEXT: s_wait_expcnt 0x0
15889 ; GFX12-NEXT: s_wait_samplecnt 0x0
15890 ; GFX12-NEXT: s_wait_bvhcnt 0x0
15891 ; GFX12-NEXT: s_wait_kmcnt 0x0
15892 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
15893 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15894 ; GFX12-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15895 ; GFX12-NEXT: s_mov_b32 s1, 0
15896 ; GFX12-NEXT: .LBB56_1: ; %atomicrmw.start
15897 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
15898 ; GFX12-NEXT: s_wait_loadcnt 0x0
15899 ; GFX12-NEXT: v_mov_b32_e32 v6, v3
15900 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
15901 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15902 ; GFX12-NEXT: v_max_num_f32_e32 v5, v5, v2
15903 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v6
15904 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15905 ; GFX12-NEXT: v_bfe_u32 v8, v5, 16, 1
15906 ; GFX12-NEXT: v_max_num_f32_e32 v3, v3, v4
15907 ; GFX12-NEXT: v_or_b32_e32 v10, 0x400000, v5
15908 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
15909 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
15910 ; GFX12-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
15911 ; GFX12-NEXT: v_bfe_u32 v7, v3, 16, 1
15912 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v3
15913 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v3, v3
15914 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
15915 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
15916 ; GFX12-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
15917 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
15918 ; GFX12-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
15919 ; GFX12-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
15920 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
15921 ; GFX12-NEXT: s_wait_storecnt 0x0
15922 ; GFX12-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[5:6], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
15923 ; GFX12-NEXT: s_wait_loadcnt 0x0
15924 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
15925 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
15926 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
15927 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
15928 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
15929 ; GFX12-NEXT: s_cbranch_execnz .LBB56_1
15930 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
15931 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
15932 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
15933 ; GFX12-NEXT: s_setpc_b64 s[30:31]
15935 ; GFX940-LABEL: global_system_atomic_fmax_ret_v2bf16__offset12b_pos:
15937 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15938 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
15939 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
15940 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15941 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
15942 ; GFX940-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15943 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
15944 ; GFX940-NEXT: .LBB56_1: ; %atomicrmw.start
15945 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
15946 ; GFX940-NEXT: s_waitcnt vmcnt(0)
15947 ; GFX940-NEXT: v_mov_b32_e32 v7, v3
15948 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 16, v7
15949 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
15950 ; GFX940-NEXT: v_max_f32_e32 v3, v3, v4
15951 ; GFX940-NEXT: v_max_f32_e32 v5, v5, v2
15952 ; GFX940-NEXT: v_bfe_u32 v6, v3, 16, 1
15953 ; GFX940-NEXT: v_bfe_u32 v9, v5, 16, 1
15954 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v3
15955 ; GFX940-NEXT: v_or_b32_e32 v10, 0x400000, v5
15956 ; GFX940-NEXT: v_add3_u32 v6, v6, v3, s4
15957 ; GFX940-NEXT: v_add3_u32 v9, v9, v5, s4
15958 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
15959 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v3, v3
15960 ; GFX940-NEXT: s_nop 0
15961 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
15962 ; GFX940-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[0:1]
15963 ; GFX940-NEXT: v_perm_b32 v6, v5, v3, s5
15964 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
15965 ; GFX940-NEXT: global_atomic_cmpswap v3, v[0:1], v[6:7], off offset:2044 sc0 sc1
15966 ; GFX940-NEXT: s_waitcnt vmcnt(0)
15967 ; GFX940-NEXT: buffer_inv sc0 sc1
15968 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
15969 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
15970 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
15971 ; GFX940-NEXT: s_cbranch_execnz .LBB56_1
15972 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
15973 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
15974 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
15975 ; GFX940-NEXT: s_setpc_b64 s[30:31]
15977 ; GFX11-LABEL: global_system_atomic_fmax_ret_v2bf16__offset12b_pos:
15979 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15980 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
15981 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15982 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15983 ; GFX11-NEXT: s_mov_b32 s1, 0
15984 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
15985 ; GFX11-NEXT: .p2align 6
15986 ; GFX11-NEXT: .LBB56_1: ; %atomicrmw.start
15987 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
15988 ; GFX11-NEXT: s_waitcnt vmcnt(0)
15989 ; GFX11-NEXT: v_mov_b32_e32 v6, v3
15990 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
15991 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15992 ; GFX11-NEXT: v_max_f32_e32 v5, v5, v2
15993 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v6
15994 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15995 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
15996 ; GFX11-NEXT: v_max_f32_e32 v3, v3, v4
15997 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
15998 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
15999 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
16000 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
16001 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
16002 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v3
16003 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v3, v3
16004 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
16005 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
16006 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
16007 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
16008 ; GFX11-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
16009 ; GFX11-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
16010 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
16011 ; GFX11-NEXT: global_atomic_cmpswap_b32 v3, v[0:1], v[5:6], off offset:2044 glc
16012 ; GFX11-NEXT: s_waitcnt vmcnt(0)
16013 ; GFX11-NEXT: buffer_gl1_inv
16014 ; GFX11-NEXT: buffer_gl0_inv
16015 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
16016 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
16017 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
16018 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
16019 ; GFX11-NEXT: s_cbranch_execnz .LBB56_1
16020 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
16021 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
16022 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
16023 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
16024 ; GFX11-NEXT: s_setpc_b64 s[30:31]
16026 ; GFX10-LABEL: global_system_atomic_fmax_ret_v2bf16__offset12b_pos:
16028 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16029 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
16030 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16031 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16032 ; GFX10-NEXT: s_mov_b32 s5, 0
16033 ; GFX10-NEXT: .LBB56_1: ; %atomicrmw.start
16034 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
16035 ; GFX10-NEXT: s_waitcnt vmcnt(0)
16036 ; GFX10-NEXT: v_mov_b32_e32 v6, v3
16037 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v6
16038 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16039 ; GFX10-NEXT: v_max_f32_e32 v3, v3, v4
16040 ; GFX10-NEXT: v_max_f32_e32 v5, v5, v2
16041 ; GFX10-NEXT: v_bfe_u32 v7, v3, 16, 1
16042 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
16043 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v3
16044 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
16045 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
16046 ; GFX10-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
16047 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
16048 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v3, v3
16049 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
16050 ; GFX10-NEXT: v_cndmask_b32_e64 v3, v7, v9, s4
16051 ; GFX10-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
16052 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
16053 ; GFX10-NEXT: global_atomic_cmpswap v3, v[0:1], v[5:6], off offset:2044 glc
16054 ; GFX10-NEXT: s_waitcnt vmcnt(0)
16055 ; GFX10-NEXT: buffer_gl1_inv
16056 ; GFX10-NEXT: buffer_gl0_inv
16057 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
16058 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
16059 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
16060 ; GFX10-NEXT: s_cbranch_execnz .LBB56_1
16061 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
16062 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
16063 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
16064 ; GFX10-NEXT: s_setpc_b64 s[30:31]
16066 ; GFX90A-LABEL: global_system_atomic_fmax_ret_v2bf16__offset12b_pos:
16068 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16069 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
16070 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
16071 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16072 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
16073 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16074 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
16075 ; GFX90A-NEXT: .LBB56_1: ; %atomicrmw.start
16076 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
16077 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
16078 ; GFX90A-NEXT: v_mov_b32_e32 v7, v3
16079 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v7
16080 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
16081 ; GFX90A-NEXT: v_max_f32_e32 v3, v3, v4
16082 ; GFX90A-NEXT: v_max_f32_e32 v5, v5, v2
16083 ; GFX90A-NEXT: v_bfe_u32 v6, v3, 16, 1
16084 ; GFX90A-NEXT: v_bfe_u32 v9, v5, 16, 1
16085 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v3
16086 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v5
16087 ; GFX90A-NEXT: v_add3_u32 v6, v6, v3, s8
16088 ; GFX90A-NEXT: v_add3_u32 v9, v9, v5, s8
16089 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
16090 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
16091 ; GFX90A-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[4:5]
16092 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
16093 ; GFX90A-NEXT: v_perm_b32 v6, v5, v3, s9
16094 ; GFX90A-NEXT: buffer_wbl2
16095 ; GFX90A-NEXT: global_atomic_cmpswap v3, v[0:1], v[6:7], off offset:2044 glc
16096 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
16097 ; GFX90A-NEXT: buffer_invl2
16098 ; GFX90A-NEXT: buffer_wbinvl1
16099 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
16100 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16101 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
16102 ; GFX90A-NEXT: s_cbranch_execnz .LBB56_1
16103 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
16104 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
16105 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
16106 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
16108 ; GFX908-LABEL: global_system_atomic_fmax_ret_v2bf16__offset12b_pos:
16110 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16111 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
16112 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
16113 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16114 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
16115 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16116 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
16117 ; GFX908-NEXT: .LBB56_1: ; %atomicrmw.start
16118 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
16119 ; GFX908-NEXT: s_waitcnt vmcnt(0)
16120 ; GFX908-NEXT: v_mov_b32_e32 v6, v3
16121 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v6
16122 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16123 ; GFX908-NEXT: v_max_f32_e32 v3, v3, v4
16124 ; GFX908-NEXT: v_max_f32_e32 v5, v5, v2
16125 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
16126 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
16127 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
16128 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
16129 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s8
16130 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
16131 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
16132 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
16133 ; GFX908-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
16134 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
16135 ; GFX908-NEXT: v_perm_b32 v5, v5, v3, s9
16136 ; GFX908-NEXT: global_atomic_cmpswap v3, v[0:1], v[5:6], off offset:2044 glc
16137 ; GFX908-NEXT: s_waitcnt vmcnt(0)
16138 ; GFX908-NEXT: buffer_wbinvl1
16139 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
16140 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16141 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
16142 ; GFX908-NEXT: s_cbranch_execnz .LBB56_1
16143 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
16144 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
16145 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
16146 ; GFX908-NEXT: s_setpc_b64 s[30:31]
16148 ; GFX8-LABEL: global_system_atomic_fmax_ret_v2bf16__offset12b_pos:
16150 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16151 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
16152 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
16153 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
16154 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
16155 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 16, v2
16156 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16157 ; GFX8-NEXT: .LBB56_1: ; %atomicrmw.start
16158 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
16159 ; GFX8-NEXT: s_waitcnt vmcnt(0)
16160 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
16161 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v6
16162 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16163 ; GFX8-NEXT: v_max_f32_e32 v0, v0, v1
16164 ; GFX8-NEXT: v_max_f32_e32 v5, v5, v2
16165 ; GFX8-NEXT: v_bfe_u32 v7, v0, 16, 1
16166 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
16167 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v0
16168 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
16169 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
16170 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
16171 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
16172 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
16173 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v0
16174 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
16175 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
16176 ; GFX8-NEXT: v_cndmask_b32_e64 v0, v7, v8, s[4:5]
16177 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
16178 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v0, 16
16179 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
16180 ; GFX8-NEXT: s_waitcnt vmcnt(0)
16181 ; GFX8-NEXT: buffer_wbinvl1
16182 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
16183 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16184 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
16185 ; GFX8-NEXT: s_cbranch_execnz .LBB56_1
16186 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
16187 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
16188 ; GFX8-NEXT: s_setpc_b64 s[30:31]
16190 ; GFX7-LABEL: global_system_atomic_fmax_ret_v2bf16__offset12b_pos:
16192 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16193 ; GFX7-NEXT: s_mov_b32 s6, 0
16194 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
16195 ; GFX7-NEXT: s_mov_b32 s4, s6
16196 ; GFX7-NEXT: s_mov_b32 s5, s6
16197 ; GFX7-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
16198 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
16199 ; GFX7-NEXT: v_mul_f32_e32 v6, 1.0, v2
16200 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
16201 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
16202 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16203 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v5
16204 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
16205 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16206 ; GFX7-NEXT: .LBB56_1: ; %atomicrmw.start
16207 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
16208 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
16209 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
16210 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
16211 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v3
16212 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
16213 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v4
16214 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v5
16215 ; GFX7-NEXT: v_alignbit_b32 v3, v2, v3, 16
16216 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v6
16217 ; GFX7-NEXT: v_alignbit_b32 v2, v2, v7, 16
16218 ; GFX7-NEXT: v_mov_b32_e32 v7, v3
16219 ; GFX7-NEXT: v_mov_b32_e32 v6, v2
16220 ; GFX7-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 offset:2044 glc
16221 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16222 ; GFX7-NEXT: buffer_wbinvl1
16223 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v3
16224 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
16225 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
16226 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v6
16227 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
16228 ; GFX7-NEXT: s_cbranch_execnz .LBB56_1
16229 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
16230 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
16231 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
16232 ; GFX7-NEXT: v_mov_b32_e32 v1, v2
16233 ; GFX7-NEXT: s_setpc_b64 s[30:31]
16235 ; GFX6-LABEL: global_system_atomic_fmax_ret_v2bf16__offset12b_pos:
16237 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16238 ; GFX6-NEXT: s_mov_b32 s6, 0
16239 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
16240 ; GFX6-NEXT: s_mov_b32 s4, s6
16241 ; GFX6-NEXT: s_mov_b32 s5, s6
16242 ; GFX6-NEXT: buffer_load_dword v5, v[0:1], s[4:7], 0 addr64 offset:2044
16243 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
16244 ; GFX6-NEXT: v_mul_f32_e32 v6, 1.0, v2
16245 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
16246 ; GFX6-NEXT: v_and_b32_e32 v4, 0xffff0000, v3
16247 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16248 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v5
16249 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v5
16250 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16251 ; GFX6-NEXT: .LBB56_1: ; %atomicrmw.start
16252 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
16253 ; GFX6-NEXT: v_mul_f32_e32 v2, 1.0, v2
16254 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
16255 ; GFX6-NEXT: s_waitcnt expcnt(0)
16256 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
16257 ; GFX6-NEXT: v_and_b32_e32 v7, 0xffff0000, v3
16258 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v2
16259 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v4
16260 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v5
16261 ; GFX6-NEXT: v_alignbit_b32 v3, v2, v3, 16
16262 ; GFX6-NEXT: v_lshrrev_b32_e32 v2, 16, v6
16263 ; GFX6-NEXT: v_alignbit_b32 v2, v2, v7, 16
16264 ; GFX6-NEXT: v_mov_b32_e32 v7, v3
16265 ; GFX6-NEXT: v_mov_b32_e32 v6, v2
16266 ; GFX6-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 offset:2044 glc
16267 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16268 ; GFX6-NEXT: buffer_wbinvl1
16269 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v6, v3
16270 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
16271 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
16272 ; GFX6-NEXT: v_lshlrev_b32_e32 v3, 16, v6
16273 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
16274 ; GFX6-NEXT: s_cbranch_execnz .LBB56_1
16275 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
16276 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
16277 ; GFX6-NEXT: v_mov_b32_e32 v0, v3
16278 ; GFX6-NEXT: v_mov_b32_e32 v1, v2
16279 ; GFX6-NEXT: s_waitcnt expcnt(0)
16280 ; GFX6-NEXT: s_setpc_b64 s[30:31]
16281 %gep = getelementptr <2 x bfloat>, ptr addrspace(1) %ptr, i64 511
16282 %result = atomicrmw fmax ptr addrspace(1) %gep, <2 x bfloat> %val seq_cst
16283 ret <2 x bfloat> %result
16286 define void @global_system_atomic_fmax_noret_v2bf16__offset12b_pos(ptr addrspace(1) %ptr, <2 x bfloat> %val) #0 {
16287 ; GFX12-LABEL: global_system_atomic_fmax_noret_v2bf16__offset12b_pos:
16289 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
16290 ; GFX12-NEXT: s_wait_expcnt 0x0
16291 ; GFX12-NEXT: s_wait_samplecnt 0x0
16292 ; GFX12-NEXT: s_wait_bvhcnt 0x0
16293 ; GFX12-NEXT: s_wait_kmcnt 0x0
16294 ; GFX12-NEXT: global_load_b32 v3, v[0:1], off offset:2044
16295 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16296 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16297 ; GFX12-NEXT: s_mov_b32 s1, 0
16298 ; GFX12-NEXT: .LBB57_1: ; %atomicrmw.start
16299 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
16300 ; GFX12-NEXT: s_wait_loadcnt 0x0
16301 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16302 ; GFX12-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16303 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16304 ; GFX12-NEXT: v_max_num_f32_e32 v2, v2, v4
16305 ; GFX12-NEXT: v_max_num_f32_e32 v6, v6, v5
16306 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16307 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
16308 ; GFX12-NEXT: v_bfe_u32 v8, v6, 16, 1
16309 ; GFX12-NEXT: v_or_b32_e32 v9, 0x400000, v2
16310 ; GFX12-NEXT: v_or_b32_e32 v10, 0x400000, v6
16311 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
16312 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
16313 ; GFX12-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
16314 ; GFX12-NEXT: v_cmp_u_f32_e64 s0, v2, v2
16315 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16316 ; GFX12-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
16317 ; GFX12-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
16318 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
16319 ; GFX12-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
16320 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
16321 ; GFX12-NEXT: s_wait_storecnt 0x0
16322 ; GFX12-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
16323 ; GFX12-NEXT: s_wait_loadcnt 0x0
16324 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
16325 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
16326 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
16327 ; GFX12-NEXT: s_or_b32 s1, vcc_lo, s1
16328 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
16329 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
16330 ; GFX12-NEXT: s_cbranch_execnz .LBB57_1
16331 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
16332 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s1
16333 ; GFX12-NEXT: s_setpc_b64 s[30:31]
16335 ; GFX940-LABEL: global_system_atomic_fmax_noret_v2bf16__offset12b_pos:
16337 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16338 ; GFX940-NEXT: global_load_dword v3, v[0:1], off offset:2044
16339 ; GFX940-NEXT: s_mov_b64 s[2:3], 0
16340 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16341 ; GFX940-NEXT: s_movk_i32 s4, 0x7fff
16342 ; GFX940-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16343 ; GFX940-NEXT: s_mov_b32 s5, 0x7060302
16344 ; GFX940-NEXT: .LBB57_1: ; %atomicrmw.start
16345 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
16346 ; GFX940-NEXT: s_waitcnt vmcnt(0)
16347 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16348 ; GFX940-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16349 ; GFX940-NEXT: v_max_f32_e32 v2, v2, v4
16350 ; GFX940-NEXT: v_max_f32_e32 v6, v6, v5
16351 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
16352 ; GFX940-NEXT: v_bfe_u32 v9, v6, 16, 1
16353 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
16354 ; GFX940-NEXT: v_or_b32_e32 v10, 0x400000, v6
16355 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s4
16356 ; GFX940-NEXT: v_add3_u32 v9, v9, v6, s4
16357 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16358 ; GFX940-NEXT: v_cmp_u_f32_e64 s[0:1], v2, v2
16359 ; GFX940-NEXT: s_nop 0
16360 ; GFX940-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16361 ; GFX940-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[0:1]
16362 ; GFX940-NEXT: v_perm_b32 v2, v6, v2, s5
16363 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
16364 ; GFX940-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 sc0 sc1
16365 ; GFX940-NEXT: s_waitcnt vmcnt(0)
16366 ; GFX940-NEXT: buffer_inv sc0 sc1
16367 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16368 ; GFX940-NEXT: s_or_b64 s[2:3], vcc, s[2:3]
16369 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
16370 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[2:3]
16371 ; GFX940-NEXT: s_cbranch_execnz .LBB57_1
16372 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
16373 ; GFX940-NEXT: s_or_b64 exec, exec, s[2:3]
16374 ; GFX940-NEXT: s_setpc_b64 s[30:31]
16376 ; GFX11-LABEL: global_system_atomic_fmax_noret_v2bf16__offset12b_pos:
16378 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16379 ; GFX11-NEXT: global_load_b32 v3, v[0:1], off offset:2044
16380 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16381 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16382 ; GFX11-NEXT: s_mov_b32 s1, 0
16383 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
16384 ; GFX11-NEXT: .p2align 6
16385 ; GFX11-NEXT: .LBB57_1: ; %atomicrmw.start
16386 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
16387 ; GFX11-NEXT: s_waitcnt vmcnt(0)
16388 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16389 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16390 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16391 ; GFX11-NEXT: v_max_f32_e32 v2, v2, v4
16392 ; GFX11-NEXT: v_max_f32_e32 v6, v6, v5
16393 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16394 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
16395 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
16396 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
16397 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
16398 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
16399 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
16400 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
16401 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
16402 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16403 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
16404 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
16405 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
16406 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
16407 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
16408 ; GFX11-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], v[2:3], off offset:2044 glc
16409 ; GFX11-NEXT: s_waitcnt vmcnt(0)
16410 ; GFX11-NEXT: buffer_gl1_inv
16411 ; GFX11-NEXT: buffer_gl0_inv
16412 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
16413 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
16414 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
16415 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
16416 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
16417 ; GFX11-NEXT: s_cbranch_execnz .LBB57_1
16418 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
16419 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
16420 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
16421 ; GFX11-NEXT: s_setpc_b64 s[30:31]
16423 ; GFX10-LABEL: global_system_atomic_fmax_noret_v2bf16__offset12b_pos:
16425 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16426 ; GFX10-NEXT: global_load_dword v3, v[0:1], off offset:2044
16427 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16428 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16429 ; GFX10-NEXT: s_mov_b32 s5, 0
16430 ; GFX10-NEXT: .LBB57_1: ; %atomicrmw.start
16431 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
16432 ; GFX10-NEXT: s_waitcnt vmcnt(0)
16433 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16434 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16435 ; GFX10-NEXT: v_max_f32_e32 v2, v2, v4
16436 ; GFX10-NEXT: v_max_f32_e32 v6, v6, v5
16437 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
16438 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
16439 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
16440 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
16441 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
16442 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
16443 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
16444 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
16445 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
16446 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
16447 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
16448 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
16449 ; GFX10-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
16450 ; GFX10-NEXT: s_waitcnt vmcnt(0)
16451 ; GFX10-NEXT: buffer_gl1_inv
16452 ; GFX10-NEXT: buffer_gl0_inv
16453 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
16454 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
16455 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
16456 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
16457 ; GFX10-NEXT: s_cbranch_execnz .LBB57_1
16458 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
16459 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
16460 ; GFX10-NEXT: s_setpc_b64 s[30:31]
16462 ; GFX90A-LABEL: global_system_atomic_fmax_noret_v2bf16__offset12b_pos:
16464 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16465 ; GFX90A-NEXT: global_load_dword v3, v[0:1], off offset:2044
16466 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
16467 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16468 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
16469 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16470 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
16471 ; GFX90A-NEXT: .LBB57_1: ; %atomicrmw.start
16472 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
16473 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
16474 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16475 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16476 ; GFX90A-NEXT: v_max_f32_e32 v2, v2, v4
16477 ; GFX90A-NEXT: v_max_f32_e32 v6, v6, v5
16478 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
16479 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
16480 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
16481 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
16482 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s8
16483 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
16484 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16485 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16486 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16487 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16488 ; GFX90A-NEXT: v_perm_b32 v2, v6, v2, s9
16489 ; GFX90A-NEXT: buffer_wbl2
16490 ; GFX90A-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
16491 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
16492 ; GFX90A-NEXT: buffer_invl2
16493 ; GFX90A-NEXT: buffer_wbinvl1
16494 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16495 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16496 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
16497 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
16498 ; GFX90A-NEXT: s_cbranch_execnz .LBB57_1
16499 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
16500 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
16501 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
16503 ; GFX908-LABEL: global_system_atomic_fmax_noret_v2bf16__offset12b_pos:
16505 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16506 ; GFX908-NEXT: global_load_dword v3, v[0:1], off offset:2044
16507 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
16508 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16509 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
16510 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16511 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
16512 ; GFX908-NEXT: .LBB57_1: ; %atomicrmw.start
16513 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
16514 ; GFX908-NEXT: s_waitcnt vmcnt(0)
16515 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16516 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16517 ; GFX908-NEXT: v_max_f32_e32 v2, v2, v4
16518 ; GFX908-NEXT: v_max_f32_e32 v6, v6, v5
16519 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
16520 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
16521 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
16522 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
16523 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s8
16524 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
16525 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16526 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16527 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16528 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16529 ; GFX908-NEXT: v_perm_b32 v2, v6, v2, s9
16530 ; GFX908-NEXT: global_atomic_cmpswap v2, v[0:1], v[2:3], off offset:2044 glc
16531 ; GFX908-NEXT: s_waitcnt vmcnt(0)
16532 ; GFX908-NEXT: buffer_wbinvl1
16533 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16534 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16535 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
16536 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
16537 ; GFX908-NEXT: s_cbranch_execnz .LBB57_1
16538 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
16539 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
16540 ; GFX908-NEXT: s_setpc_b64 s[30:31]
16542 ; GFX8-LABEL: global_system_atomic_fmax_noret_v2bf16__offset12b_pos:
16544 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16545 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
16546 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
16547 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
16548 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
16549 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16550 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16551 ; GFX8-NEXT: .LBB57_1: ; %atomicrmw.start
16552 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
16553 ; GFX8-NEXT: s_waitcnt vmcnt(0)
16554 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16555 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16556 ; GFX8-NEXT: v_max_f32_e32 v2, v2, v4
16557 ; GFX8-NEXT: v_max_f32_e32 v6, v6, v5
16558 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
16559 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
16560 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
16561 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
16562 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
16563 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
16564 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
16565 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16566 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
16567 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16568 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16569 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16570 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
16571 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
16572 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
16573 ; GFX8-NEXT: s_waitcnt vmcnt(0)
16574 ; GFX8-NEXT: buffer_wbinvl1
16575 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16576 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16577 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
16578 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
16579 ; GFX8-NEXT: s_cbranch_execnz .LBB57_1
16580 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
16581 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
16582 ; GFX8-NEXT: s_setpc_b64 s[30:31]
16584 ; GFX7-LABEL: global_system_atomic_fmax_noret_v2bf16__offset12b_pos:
16586 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16587 ; GFX7-NEXT: s_mov_b32 s6, 0
16588 ; GFX7-NEXT: s_mov_b32 s7, 0xf000
16589 ; GFX7-NEXT: s_mov_b32 s4, s6
16590 ; GFX7-NEXT: s_mov_b32 s5, s6
16591 ; GFX7-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64 offset:2044
16592 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
16593 ; GFX7-NEXT: v_mul_f32_e32 v6, 1.0, v2
16594 ; GFX7-NEXT: s_mov_b64 s[8:9], 0
16595 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v3
16596 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v6
16597 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16598 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
16599 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v4
16600 ; GFX7-NEXT: .LBB57_1: ; %atomicrmw.start
16601 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
16602 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
16603 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
16604 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
16605 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
16606 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v5
16607 ; GFX7-NEXT: v_max_f32_e32 v6, v6, v2
16608 ; GFX7-NEXT: v_max_f32_e32 v7, v7, v3
16609 ; GFX7-NEXT: v_alignbit_b32 v5, v5, v4, 16
16610 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v6
16611 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v7, 16
16612 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
16613 ; GFX7-NEXT: v_mov_b32_e32 v6, v4
16614 ; GFX7-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 offset:2044 glc
16615 ; GFX7-NEXT: s_waitcnt vmcnt(0)
16616 ; GFX7-NEXT: buffer_wbinvl1
16617 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
16618 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16619 ; GFX7-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
16620 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v6
16621 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[8:9]
16622 ; GFX7-NEXT: s_cbranch_execnz .LBB57_1
16623 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
16624 ; GFX7-NEXT: s_or_b64 exec, exec, s[8:9]
16625 ; GFX7-NEXT: s_setpc_b64 s[30:31]
16627 ; GFX6-LABEL: global_system_atomic_fmax_noret_v2bf16__offset12b_pos:
16629 ; GFX6-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16630 ; GFX6-NEXT: s_mov_b32 s6, 0
16631 ; GFX6-NEXT: s_mov_b32 s7, 0xf000
16632 ; GFX6-NEXT: s_mov_b32 s4, s6
16633 ; GFX6-NEXT: s_mov_b32 s5, s6
16634 ; GFX6-NEXT: buffer_load_dword v4, v[0:1], s[4:7], 0 addr64 offset:2044
16635 ; GFX6-NEXT: v_mul_f32_e32 v3, 1.0, v3
16636 ; GFX6-NEXT: v_mul_f32_e32 v6, 1.0, v2
16637 ; GFX6-NEXT: s_mov_b64 s[8:9], 0
16638 ; GFX6-NEXT: v_and_b32_e32 v2, 0xffff0000, v3
16639 ; GFX6-NEXT: v_and_b32_e32 v3, 0xffff0000, v6
16640 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16641 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
16642 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v4
16643 ; GFX6-NEXT: .LBB57_1: ; %atomicrmw.start
16644 ; GFX6-NEXT: ; =>This Inner Loop Header: Depth=1
16645 ; GFX6-NEXT: v_mul_f32_e32 v5, 1.0, v5
16646 ; GFX6-NEXT: v_mul_f32_e32 v4, 1.0, v4
16647 ; GFX6-NEXT: s_waitcnt expcnt(0)
16648 ; GFX6-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
16649 ; GFX6-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
16650 ; GFX6-NEXT: v_lshrrev_b32_e32 v5, 16, v5
16651 ; GFX6-NEXT: v_max_f32_e32 v6, v6, v2
16652 ; GFX6-NEXT: v_max_f32_e32 v7, v7, v3
16653 ; GFX6-NEXT: v_alignbit_b32 v5, v5, v4, 16
16654 ; GFX6-NEXT: v_lshrrev_b32_e32 v4, 16, v6
16655 ; GFX6-NEXT: v_alignbit_b32 v4, v4, v7, 16
16656 ; GFX6-NEXT: v_mov_b32_e32 v7, v5
16657 ; GFX6-NEXT: v_mov_b32_e32 v6, v4
16658 ; GFX6-NEXT: buffer_atomic_cmpswap v[6:7], v[0:1], s[4:7], 0 addr64 offset:2044 glc
16659 ; GFX6-NEXT: s_waitcnt vmcnt(0)
16660 ; GFX6-NEXT: buffer_wbinvl1
16661 ; GFX6-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
16662 ; GFX6-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16663 ; GFX6-NEXT: s_or_b64 s[8:9], vcc, s[8:9]
16664 ; GFX6-NEXT: v_lshlrev_b32_e32 v4, 16, v6
16665 ; GFX6-NEXT: s_andn2_b64 exec, exec, s[8:9]
16666 ; GFX6-NEXT: s_cbranch_execnz .LBB57_1
16667 ; GFX6-NEXT: ; %bb.2: ; %atomicrmw.end
16668 ; GFX6-NEXT: s_or_b64 exec, exec, s[8:9]
16669 ; GFX6-NEXT: s_waitcnt expcnt(0)
16670 ; GFX6-NEXT: s_setpc_b64 s[30:31]
16671 %gep = getelementptr <2 x bfloat>, ptr addrspace(1) %ptr, i64 511
16672 %unused = atomicrmw fmax ptr addrspace(1) %gep, <2 x bfloat> %val seq_cst
16676 attributes #0 = { nounwind "amdgpu-unsafe-fp-atomics"="true" }
16677 attributes #1 = { nounwind "denormal-fp-math-f32"="preserve-sign,preserve-sign" "amdgpu-unsafe-fp-atomics"="true" }