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
11 ; --------------------------------------------------------------------
13 ; --------------------------------------------------------------------
15 define float @flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
16 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
18 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
19 ; GFX12-NEXT: s_wait_expcnt 0x0
20 ; GFX12-NEXT: s_wait_samplecnt 0x0
21 ; GFX12-NEXT: s_wait_bvhcnt 0x0
22 ; GFX12-NEXT: s_wait_kmcnt 0x0
23 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
24 ; GFX12-NEXT: s_wait_storecnt 0x0
25 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
26 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
27 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
28 ; GFX12-NEXT: s_setpc_b64 s[30:31]
30 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
32 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
33 ; GFX940-NEXT: buffer_wbl2 sc1
34 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 sc0
35 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
36 ; GFX940-NEXT: buffer_inv sc1
37 ; GFX940-NEXT: s_setpc_b64 s[30:31]
39 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
41 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
42 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
43 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 glc
44 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
45 ; GFX11-NEXT: buffer_gl1_inv
46 ; GFX11-NEXT: buffer_gl0_inv
47 ; GFX11-NEXT: s_setpc_b64 s[30:31]
49 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
51 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
52 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
53 ; GFX10-NEXT: s_mov_b32 s4, 0
54 ; GFX10-NEXT: .LBB0_1: ; %atomicrmw.start
55 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
56 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
57 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
58 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
59 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
60 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
61 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
62 ; GFX10-NEXT: buffer_gl1_inv
63 ; GFX10-NEXT: buffer_gl0_inv
64 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
65 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
66 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
67 ; GFX10-NEXT: s_cbranch_execnz .LBB0_1
68 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
69 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
70 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
71 ; GFX10-NEXT: s_setpc_b64 s[30:31]
73 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
75 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
76 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
77 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
78 ; GFX90A-NEXT: ; implicit-def: $vgpr3
79 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
80 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
81 ; GFX90A-NEXT: s_cbranch_execz .LBB0_6
82 ; GFX90A-NEXT: ; %bb.1: ; %atomicrmw.check.private
83 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
84 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
85 ; GFX90A-NEXT: ; implicit-def: $vgpr3
86 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
87 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
88 ; GFX90A-NEXT: s_cbranch_execz .LBB0_3
89 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.global
90 ; GFX90A-NEXT: global_atomic_add_f32 v3, v[0:1], v2, off glc
91 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
92 ; GFX90A-NEXT: buffer_wbinvl1
93 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
94 ; GFX90A-NEXT: ; implicit-def: $vgpr2
95 ; GFX90A-NEXT: .LBB0_3: ; %Flow
96 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
97 ; GFX90A-NEXT: s_cbranch_execz .LBB0_5
98 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.private
99 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
100 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
101 ; GFX90A-NEXT: buffer_load_dword v3, v0, s[0:3], 0 offen
102 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
103 ; GFX90A-NEXT: v_add_f32_e32 v1, v3, v2
104 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
105 ; GFX90A-NEXT: .LBB0_5: ; %Flow1
106 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
107 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
108 ; GFX90A-NEXT: ; implicit-def: $vgpr2
109 ; GFX90A-NEXT: .LBB0_6: ; %Flow2
110 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
111 ; GFX90A-NEXT: s_cbranch_execz .LBB0_8
112 ; GFX90A-NEXT: ; %bb.7: ; %atomicrmw.shared
113 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
114 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
115 ; GFX90A-NEXT: ds_add_rtn_f32 v3, v0, v2
116 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
117 ; GFX90A-NEXT: .LBB0_8: ; %atomicrmw.phi
118 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
119 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
120 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
121 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
123 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
125 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
126 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
127 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
128 ; GFX908-NEXT: .LBB0_1: ; %atomicrmw.start
129 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
130 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
131 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
132 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
133 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
134 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
135 ; GFX908-NEXT: buffer_wbinvl1
136 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
137 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
138 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
139 ; GFX908-NEXT: s_cbranch_execnz .LBB0_1
140 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
141 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
142 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
143 ; GFX908-NEXT: s_setpc_b64 s[30:31]
145 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
147 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
148 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
149 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
150 ; GFX8-NEXT: .LBB0_1: ; %atomicrmw.start
151 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
152 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
153 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
154 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
155 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
156 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
157 ; GFX8-NEXT: buffer_wbinvl1
158 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
159 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
160 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
161 ; GFX8-NEXT: s_cbranch_execnz .LBB0_1
162 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
163 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
164 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
165 ; GFX8-NEXT: s_setpc_b64 s[30:31]
167 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
169 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
170 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
171 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
172 ; GFX7-NEXT: .LBB0_1: ; %atomicrmw.start
173 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
174 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
175 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
176 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
177 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
178 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
179 ; GFX7-NEXT: buffer_wbinvl1
180 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
181 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
182 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
183 ; GFX7-NEXT: s_cbranch_execnz .LBB0_1
184 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
185 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
186 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
187 ; GFX7-NEXT: s_setpc_b64 s[30:31]
188 %result = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
192 define float @flat_agent_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
193 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
195 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
196 ; GFX12-NEXT: s_wait_expcnt 0x0
197 ; GFX12-NEXT: s_wait_samplecnt 0x0
198 ; GFX12-NEXT: s_wait_bvhcnt 0x0
199 ; GFX12-NEXT: s_wait_kmcnt 0x0
200 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
201 ; GFX12-NEXT: s_wait_storecnt 0x0
202 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
203 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
204 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
205 ; GFX12-NEXT: s_setpc_b64 s[30:31]
207 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
209 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
210 ; GFX940-NEXT: buffer_wbl2 sc1
211 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:2044 sc0
212 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
213 ; GFX940-NEXT: buffer_inv sc1
214 ; GFX940-NEXT: s_setpc_b64 s[30:31]
216 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
218 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
219 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
220 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:2044 glc
221 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
222 ; GFX11-NEXT: buffer_gl1_inv
223 ; GFX11-NEXT: buffer_gl0_inv
224 ; GFX11-NEXT: s_setpc_b64 s[30:31]
226 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
228 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
229 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fc, v0
230 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
231 ; GFX10-NEXT: s_mov_b32 s4, 0
232 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
233 ; GFX10-NEXT: .LBB1_1: ; %atomicrmw.start
234 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
235 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
236 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
237 ; GFX10-NEXT: v_add_f32_e32 v0, v1, v2
238 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
239 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
240 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
241 ; GFX10-NEXT: buffer_gl1_inv
242 ; GFX10-NEXT: buffer_gl0_inv
243 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
244 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
245 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
246 ; GFX10-NEXT: s_cbranch_execnz .LBB1_1
247 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
248 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
249 ; GFX10-NEXT: s_setpc_b64 s[30:31]
251 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
253 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
254 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fc, v0
255 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v1, vcc
256 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
257 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v5
258 ; GFX90A-NEXT: ; implicit-def: $vgpr0
259 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
260 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
261 ; GFX90A-NEXT: s_cbranch_execnz .LBB1_3
262 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
263 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
264 ; GFX90A-NEXT: s_cbranch_execnz .LBB1_8
265 ; GFX90A-NEXT: .LBB1_2: ; %atomicrmw.phi
266 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
267 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
268 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
269 ; GFX90A-NEXT: .LBB1_3: ; %atomicrmw.check.private
270 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
271 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v5
272 ; GFX90A-NEXT: ; implicit-def: $vgpr0
273 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
274 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
275 ; GFX90A-NEXT: s_cbranch_execz .LBB1_5
276 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
277 ; GFX90A-NEXT: global_atomic_add_f32 v0, v[4:5], v2, off glc
278 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
279 ; GFX90A-NEXT: buffer_wbinvl1
280 ; GFX90A-NEXT: ; implicit-def: $vgpr4_vgpr5
281 ; GFX90A-NEXT: ; implicit-def: $vgpr2
282 ; GFX90A-NEXT: .LBB1_5: ; %Flow
283 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
284 ; GFX90A-NEXT: s_cbranch_execz .LBB1_7
285 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
286 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
287 ; GFX90A-NEXT: v_cndmask_b32_e32 v1, -1, v4, vcc
288 ; GFX90A-NEXT: buffer_load_dword v0, v1, s[0:3], 0 offen
289 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
290 ; GFX90A-NEXT: v_add_f32_e32 v2, v0, v2
291 ; GFX90A-NEXT: buffer_store_dword v2, v1, s[0:3], 0 offen
292 ; GFX90A-NEXT: .LBB1_7: ; %Flow1
293 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
294 ; GFX90A-NEXT: ; implicit-def: $vgpr4_vgpr5
295 ; GFX90A-NEXT: ; implicit-def: $vgpr2
296 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
297 ; GFX90A-NEXT: s_cbranch_execz .LBB1_2
298 ; GFX90A-NEXT: .LBB1_8: ; %atomicrmw.shared
299 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
300 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v4, vcc
301 ; GFX90A-NEXT: ds_add_rtn_f32 v0, v0, v2
302 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
303 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
304 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
305 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
307 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
309 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
310 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
311 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
312 ; GFX908-NEXT: .LBB1_1: ; %atomicrmw.start
313 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
314 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
315 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
316 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
317 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
318 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
319 ; GFX908-NEXT: buffer_wbinvl1
320 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
321 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
322 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
323 ; GFX908-NEXT: s_cbranch_execnz .LBB1_1
324 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
325 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
326 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
327 ; GFX908-NEXT: s_setpc_b64 s[30:31]
329 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
331 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
332 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
333 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
334 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
335 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
336 ; GFX8-NEXT: .LBB1_1: ; %atomicrmw.start
337 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
338 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
339 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
340 ; GFX8-NEXT: v_add_f32_e32 v0, v1, v2
341 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
342 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
343 ; GFX8-NEXT: buffer_wbinvl1
344 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
345 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
346 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
347 ; GFX8-NEXT: s_cbranch_execnz .LBB1_1
348 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
349 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
350 ; GFX8-NEXT: s_setpc_b64 s[30:31]
352 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
354 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
355 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0x7fc, v0
356 ; GFX7-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
357 ; GFX7-NEXT: flat_load_dword v0, v[3:4]
358 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
359 ; GFX7-NEXT: .LBB1_1: ; %atomicrmw.start
360 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
361 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
362 ; GFX7-NEXT: v_mov_b32_e32 v1, v0
363 ; GFX7-NEXT: v_add_f32_e32 v0, v1, v2
364 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
365 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
366 ; GFX7-NEXT: buffer_wbinvl1
367 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
368 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
369 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
370 ; GFX7-NEXT: s_cbranch_execnz .LBB1_1
371 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
372 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
373 ; GFX7-NEXT: s_setpc_b64 s[30:31]
374 %gep = getelementptr float, ptr %ptr, i64 511
375 %result = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
379 define float @flat_agent_atomic_fadd_ret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
380 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
382 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
383 ; GFX12-NEXT: s_wait_expcnt 0x0
384 ; GFX12-NEXT: s_wait_samplecnt 0x0
385 ; GFX12-NEXT: s_wait_bvhcnt 0x0
386 ; GFX12-NEXT: s_wait_kmcnt 0x0
387 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
388 ; GFX12-NEXT: s_wait_storecnt 0x0
389 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
390 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
391 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
392 ; GFX12-NEXT: s_setpc_b64 s[30:31]
394 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
396 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
397 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
398 ; GFX940-NEXT: s_nop 1
399 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
400 ; GFX940-NEXT: buffer_wbl2 sc1
401 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 sc0
402 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
403 ; GFX940-NEXT: buffer_inv sc1
404 ; GFX940-NEXT: s_setpc_b64 s[30:31]
406 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
408 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
409 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
410 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
411 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
412 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 glc
413 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
414 ; GFX11-NEXT: buffer_gl1_inv
415 ; GFX11-NEXT: buffer_gl0_inv
416 ; GFX11-NEXT: s_setpc_b64 s[30:31]
418 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
420 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
421 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
422 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, -1, v1, vcc_lo
423 ; GFX10-NEXT: s_mov_b32 s4, 0
424 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
425 ; GFX10-NEXT: .LBB2_1: ; %atomicrmw.start
426 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
427 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
428 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
429 ; GFX10-NEXT: v_add_f32_e32 v0, v1, v2
430 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
431 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
432 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
433 ; GFX10-NEXT: buffer_gl1_inv
434 ; GFX10-NEXT: buffer_gl0_inv
435 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
436 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
437 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
438 ; GFX10-NEXT: s_cbranch_execnz .LBB2_1
439 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
440 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
441 ; GFX10-NEXT: s_setpc_b64 s[30:31]
443 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
445 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
446 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
447 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, -1, v1, vcc
448 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
449 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v5
450 ; GFX90A-NEXT: ; implicit-def: $vgpr0
451 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
452 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
453 ; GFX90A-NEXT: s_cbranch_execnz .LBB2_3
454 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
455 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
456 ; GFX90A-NEXT: s_cbranch_execnz .LBB2_8
457 ; GFX90A-NEXT: .LBB2_2: ; %atomicrmw.phi
458 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
459 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
460 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
461 ; GFX90A-NEXT: .LBB2_3: ; %atomicrmw.check.private
462 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
463 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v5
464 ; GFX90A-NEXT: ; implicit-def: $vgpr0
465 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
466 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
467 ; GFX90A-NEXT: s_cbranch_execz .LBB2_5
468 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
469 ; GFX90A-NEXT: global_atomic_add_f32 v0, v[4:5], v2, off glc
470 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
471 ; GFX90A-NEXT: buffer_wbinvl1
472 ; GFX90A-NEXT: ; implicit-def: $vgpr4_vgpr5
473 ; GFX90A-NEXT: ; implicit-def: $vgpr2
474 ; GFX90A-NEXT: .LBB2_5: ; %Flow
475 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
476 ; GFX90A-NEXT: s_cbranch_execz .LBB2_7
477 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
478 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
479 ; GFX90A-NEXT: v_cndmask_b32_e32 v1, -1, v4, vcc
480 ; GFX90A-NEXT: buffer_load_dword v0, v1, s[0:3], 0 offen
481 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
482 ; GFX90A-NEXT: v_add_f32_e32 v2, v0, v2
483 ; GFX90A-NEXT: buffer_store_dword v2, v1, s[0:3], 0 offen
484 ; GFX90A-NEXT: .LBB2_7: ; %Flow1
485 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
486 ; GFX90A-NEXT: ; implicit-def: $vgpr4_vgpr5
487 ; GFX90A-NEXT: ; implicit-def: $vgpr2
488 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
489 ; GFX90A-NEXT: s_cbranch_execz .LBB2_2
490 ; GFX90A-NEXT: .LBB2_8: ; %atomicrmw.shared
491 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
492 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v4, vcc
493 ; GFX90A-NEXT: ds_add_rtn_f32 v0, v0, v2
494 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
495 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
496 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
497 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
499 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
501 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
502 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
503 ; GFX908-NEXT: v_addc_co_u32_e32 v4, vcc, -1, v1, vcc
504 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
505 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
506 ; GFX908-NEXT: flat_load_dword v0, v[0:1]
507 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
508 ; GFX908-NEXT: .LBB2_1: ; %atomicrmw.start
509 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
510 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
511 ; GFX908-NEXT: v_mov_b32_e32 v1, v0
512 ; GFX908-NEXT: v_add_f32_e32 v0, v1, v2
513 ; GFX908-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
514 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
515 ; GFX908-NEXT: buffer_wbinvl1
516 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
517 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
518 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
519 ; GFX908-NEXT: s_cbranch_execnz .LBB2_1
520 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
521 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
522 ; GFX908-NEXT: s_setpc_b64 s[30:31]
524 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
526 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
527 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
528 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
529 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
530 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
531 ; GFX8-NEXT: .LBB2_1: ; %atomicrmw.start
532 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
533 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
534 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
535 ; GFX8-NEXT: v_add_f32_e32 v0, v1, v2
536 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
537 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
538 ; GFX8-NEXT: buffer_wbinvl1
539 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
540 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
541 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
542 ; GFX8-NEXT: s_cbranch_execnz .LBB2_1
543 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
544 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
545 ; GFX8-NEXT: s_setpc_b64 s[30:31]
547 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
549 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
550 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0xfffff800, v0
551 ; GFX7-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
552 ; GFX7-NEXT: flat_load_dword v0, v[3:4]
553 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
554 ; GFX7-NEXT: .LBB2_1: ; %atomicrmw.start
555 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
556 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
557 ; GFX7-NEXT: v_mov_b32_e32 v1, v0
558 ; GFX7-NEXT: v_add_f32_e32 v0, v1, v2
559 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
560 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
561 ; GFX7-NEXT: buffer_wbinvl1
562 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
563 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
564 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
565 ; GFX7-NEXT: s_cbranch_execnz .LBB2_1
566 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
567 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
568 ; GFX7-NEXT: s_setpc_b64 s[30:31]
569 %gep = getelementptr float, ptr %ptr, i64 -512
570 %result = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
574 define void @flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
575 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
577 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
578 ; GFX12-NEXT: s_wait_expcnt 0x0
579 ; GFX12-NEXT: s_wait_samplecnt 0x0
580 ; GFX12-NEXT: s_wait_bvhcnt 0x0
581 ; GFX12-NEXT: s_wait_kmcnt 0x0
582 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
583 ; GFX12-NEXT: s_wait_storecnt 0x0
584 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 scope:SCOPE_DEV
585 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
586 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
587 ; GFX12-NEXT: s_setpc_b64 s[30:31]
589 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
591 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
592 ; GFX940-NEXT: buffer_wbl2 sc1
593 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2
594 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
595 ; GFX940-NEXT: buffer_inv sc1
596 ; GFX940-NEXT: s_setpc_b64 s[30:31]
598 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
600 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
601 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
602 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2
603 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
604 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
605 ; GFX11-NEXT: buffer_gl1_inv
606 ; GFX11-NEXT: buffer_gl0_inv
607 ; GFX11-NEXT: s_setpc_b64 s[30:31]
609 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
611 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
612 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
613 ; GFX10-NEXT: s_mov_b32 s4, 0
614 ; GFX10-NEXT: .LBB3_1: ; %atomicrmw.start
615 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
616 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
617 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
618 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
619 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
620 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
621 ; GFX10-NEXT: buffer_gl1_inv
622 ; GFX10-NEXT: buffer_gl0_inv
623 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
624 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
625 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
626 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
627 ; GFX10-NEXT: s_cbranch_execnz .LBB3_1
628 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
629 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
630 ; GFX10-NEXT: s_setpc_b64 s[30:31]
632 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
633 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
634 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
635 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
636 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
637 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
638 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
639 ; GFX90A-NEXT: s_cbranch_execnz .LBB3_3
640 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
641 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
642 ; GFX90A-NEXT: s_cbranch_execnz .LBB3_8
643 ; GFX90A-NEXT: .LBB3_2: ; %atomicrmw.phi
644 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
645 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
646 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
647 ; GFX90A-NEXT: .LBB3_3: ; %atomicrmw.check.private
648 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
649 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
650 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
651 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
652 ; GFX90A-NEXT: s_cbranch_execz .LBB3_5
653 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
654 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
655 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
656 ; GFX90A-NEXT: buffer_wbinvl1
657 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
658 ; GFX90A-NEXT: ; implicit-def: $vgpr2
659 ; GFX90A-NEXT: .LBB3_5: ; %Flow
660 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
661 ; GFX90A-NEXT: s_cbranch_execz .LBB3_7
662 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
663 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
664 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
665 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
666 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
667 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
668 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
669 ; GFX90A-NEXT: .LBB3_7: ; %Flow1
670 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
671 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
672 ; GFX90A-NEXT: ; implicit-def: $vgpr2
673 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
674 ; GFX90A-NEXT: s_cbranch_execz .LBB3_2
675 ; GFX90A-NEXT: .LBB3_8: ; %atomicrmw.shared
676 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
677 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
678 ; GFX90A-NEXT: ds_add_f32 v0, v2
679 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
680 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
681 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
682 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
684 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
685 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
686 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
687 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
688 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
689 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
690 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
691 ; GFX908-NEXT: s_cbranch_execnz .LBB3_3
692 ; GFX908-NEXT: ; %bb.1: ; %Flow2
693 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
694 ; GFX908-NEXT: s_cbranch_execnz .LBB3_8
695 ; GFX908-NEXT: .LBB3_2: ; %atomicrmw.phi
696 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
697 ; GFX908-NEXT: s_waitcnt vmcnt(0)
698 ; GFX908-NEXT: s_setpc_b64 s[30:31]
699 ; GFX908-NEXT: .LBB3_3: ; %atomicrmw.check.private
700 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
701 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
702 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
703 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
704 ; GFX908-NEXT: s_cbranch_execz .LBB3_5
705 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
706 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
707 ; GFX908-NEXT: s_waitcnt vmcnt(0)
708 ; GFX908-NEXT: buffer_wbinvl1
709 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
710 ; GFX908-NEXT: ; implicit-def: $vgpr2
711 ; GFX908-NEXT: .LBB3_5: ; %Flow
712 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
713 ; GFX908-NEXT: s_cbranch_execz .LBB3_7
714 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
715 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
716 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
717 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
718 ; GFX908-NEXT: s_waitcnt vmcnt(0)
719 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
720 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
721 ; GFX908-NEXT: .LBB3_7: ; %Flow1
722 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
723 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
724 ; GFX908-NEXT: ; implicit-def: $vgpr2
725 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
726 ; GFX908-NEXT: s_cbranch_execz .LBB3_2
727 ; GFX908-NEXT: .LBB3_8: ; %atomicrmw.shared
728 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
729 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
730 ; GFX908-NEXT: ds_add_f32 v0, v2
731 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
732 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
733 ; GFX908-NEXT: s_waitcnt vmcnt(0)
734 ; GFX908-NEXT: s_setpc_b64 s[30:31]
736 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
738 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
739 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
740 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
741 ; GFX8-NEXT: .LBB3_1: ; %atomicrmw.start
742 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
743 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
744 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
745 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
746 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
747 ; GFX8-NEXT: buffer_wbinvl1
748 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
749 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
750 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
751 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
752 ; GFX8-NEXT: s_cbranch_execnz .LBB3_1
753 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
754 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
755 ; GFX8-NEXT: s_setpc_b64 s[30:31]
757 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
759 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
760 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
761 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
762 ; GFX7-NEXT: .LBB3_1: ; %atomicrmw.start
763 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
764 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
765 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
766 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
767 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
768 ; GFX7-NEXT: buffer_wbinvl1
769 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
770 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
771 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
772 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
773 ; GFX7-NEXT: s_cbranch_execnz .LBB3_1
774 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
775 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
776 ; GFX7-NEXT: s_setpc_b64 s[30:31]
777 %unused = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
781 define void @flat_agent_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
782 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
784 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
785 ; GFX12-NEXT: s_wait_expcnt 0x0
786 ; GFX12-NEXT: s_wait_samplecnt 0x0
787 ; GFX12-NEXT: s_wait_bvhcnt 0x0
788 ; GFX12-NEXT: s_wait_kmcnt 0x0
789 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
790 ; GFX12-NEXT: s_wait_storecnt 0x0
791 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044 scope:SCOPE_DEV
792 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
793 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
794 ; GFX12-NEXT: s_setpc_b64 s[30:31]
796 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
798 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
799 ; GFX940-NEXT: buffer_wbl2 sc1
800 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
801 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
802 ; GFX940-NEXT: buffer_inv sc1
803 ; GFX940-NEXT: s_setpc_b64 s[30:31]
805 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
807 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
808 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
809 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
810 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
811 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
812 ; GFX11-NEXT: buffer_gl1_inv
813 ; GFX11-NEXT: buffer_gl0_inv
814 ; GFX11-NEXT: s_setpc_b64 s[30:31]
816 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
818 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
819 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
820 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
821 ; GFX10-NEXT: s_mov_b32 s4, 0
822 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
823 ; GFX10-NEXT: .LBB4_1: ; %atomicrmw.start
824 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
825 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
826 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
827 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
828 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
829 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
830 ; GFX10-NEXT: buffer_gl1_inv
831 ; GFX10-NEXT: buffer_gl0_inv
832 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
833 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
834 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
835 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
836 ; GFX10-NEXT: s_cbranch_execnz .LBB4_1
837 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
838 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
839 ; GFX10-NEXT: s_setpc_b64 s[30:31]
841 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
842 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
843 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
844 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
845 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
846 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
847 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
848 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
849 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
850 ; GFX90A-NEXT: s_cbranch_execnz .LBB4_3
851 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
852 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
853 ; GFX90A-NEXT: s_cbranch_execnz .LBB4_8
854 ; GFX90A-NEXT: .LBB4_2: ; %atomicrmw.phi
855 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
856 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
857 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
858 ; GFX90A-NEXT: .LBB4_3: ; %atomicrmw.check.private
859 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
860 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
861 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
862 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
863 ; GFX90A-NEXT: s_cbranch_execz .LBB4_5
864 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
865 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
866 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
867 ; GFX90A-NEXT: buffer_wbinvl1
868 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
869 ; GFX90A-NEXT: ; implicit-def: $vgpr2
870 ; GFX90A-NEXT: .LBB4_5: ; %Flow
871 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
872 ; GFX90A-NEXT: s_cbranch_execz .LBB4_7
873 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
874 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
875 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
876 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
877 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
878 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
879 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
880 ; GFX90A-NEXT: .LBB4_7: ; %Flow1
881 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
882 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
883 ; GFX90A-NEXT: ; implicit-def: $vgpr2
884 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
885 ; GFX90A-NEXT: s_cbranch_execz .LBB4_2
886 ; GFX90A-NEXT: .LBB4_8: ; %atomicrmw.shared
887 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
888 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
889 ; GFX90A-NEXT: ds_add_f32 v0, v2
890 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
891 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
892 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
893 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
895 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
896 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
897 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
898 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
899 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
900 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
901 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
902 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
903 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
904 ; GFX908-NEXT: s_cbranch_execnz .LBB4_3
905 ; GFX908-NEXT: ; %bb.1: ; %Flow2
906 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
907 ; GFX908-NEXT: s_cbranch_execnz .LBB4_8
908 ; GFX908-NEXT: .LBB4_2: ; %atomicrmw.phi
909 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
910 ; GFX908-NEXT: s_waitcnt vmcnt(0)
911 ; GFX908-NEXT: s_setpc_b64 s[30:31]
912 ; GFX908-NEXT: .LBB4_3: ; %atomicrmw.check.private
913 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
914 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
915 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
916 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
917 ; GFX908-NEXT: s_cbranch_execz .LBB4_5
918 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
919 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
920 ; GFX908-NEXT: s_waitcnt vmcnt(0)
921 ; GFX908-NEXT: buffer_wbinvl1
922 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
923 ; GFX908-NEXT: ; implicit-def: $vgpr2
924 ; GFX908-NEXT: .LBB4_5: ; %Flow
925 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
926 ; GFX908-NEXT: s_cbranch_execz .LBB4_7
927 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
928 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
929 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
930 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
931 ; GFX908-NEXT: s_waitcnt vmcnt(0)
932 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
933 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
934 ; GFX908-NEXT: .LBB4_7: ; %Flow1
935 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
936 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
937 ; GFX908-NEXT: ; implicit-def: $vgpr2
938 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
939 ; GFX908-NEXT: s_cbranch_execz .LBB4_2
940 ; GFX908-NEXT: .LBB4_8: ; %atomicrmw.shared
941 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
942 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
943 ; GFX908-NEXT: ds_add_f32 v0, v2
944 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
945 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
946 ; GFX908-NEXT: s_waitcnt vmcnt(0)
947 ; GFX908-NEXT: s_setpc_b64 s[30:31]
949 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
951 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
952 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
953 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
954 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
955 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
956 ; GFX8-NEXT: .LBB4_1: ; %atomicrmw.start
957 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
958 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
959 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
960 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
961 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
962 ; GFX8-NEXT: buffer_wbinvl1
963 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
964 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
965 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
966 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
967 ; GFX8-NEXT: s_cbranch_execnz .LBB4_1
968 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
969 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
970 ; GFX8-NEXT: s_setpc_b64 s[30:31]
972 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
974 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
975 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
976 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
977 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
978 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
979 ; GFX7-NEXT: .LBB4_1: ; %atomicrmw.start
980 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
981 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
982 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
983 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
984 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
985 ; GFX7-NEXT: buffer_wbinvl1
986 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
987 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
988 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
989 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
990 ; GFX7-NEXT: s_cbranch_execnz .LBB4_1
991 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
992 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
993 ; GFX7-NEXT: s_setpc_b64 s[30:31]
994 %gep = getelementptr float, ptr %ptr, i64 511
995 %unused = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
999 define void @flat_agent_atomic_fadd_noret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
1000 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1002 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1003 ; GFX12-NEXT: s_wait_expcnt 0x0
1004 ; GFX12-NEXT: s_wait_samplecnt 0x0
1005 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1006 ; GFX12-NEXT: s_wait_kmcnt 0x0
1007 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
1008 ; GFX12-NEXT: s_wait_storecnt 0x0
1009 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:-2048 scope:SCOPE_DEV
1010 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
1011 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
1012 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1014 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1016 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1017 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
1018 ; GFX940-NEXT: s_nop 1
1019 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
1020 ; GFX940-NEXT: buffer_wbl2 sc1
1021 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2
1022 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1023 ; GFX940-NEXT: buffer_inv sc1
1024 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1026 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1028 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1029 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
1030 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
1031 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1032 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2
1033 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1034 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1035 ; GFX11-NEXT: buffer_gl1_inv
1036 ; GFX11-NEXT: buffer_gl0_inv
1037 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1039 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1041 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1042 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
1043 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
1044 ; GFX10-NEXT: s_mov_b32 s4, 0
1045 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
1046 ; GFX10-NEXT: .LBB5_1: ; %atomicrmw.start
1047 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1048 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1049 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
1050 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1051 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1052 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1053 ; GFX10-NEXT: buffer_gl1_inv
1054 ; GFX10-NEXT: buffer_gl0_inv
1055 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1056 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
1057 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1058 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1059 ; GFX10-NEXT: s_cbranch_execnz .LBB5_1
1060 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1061 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1062 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1064 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1065 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
1066 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1067 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
1068 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
1069 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
1070 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
1071 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
1072 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
1073 ; GFX90A-NEXT: s_cbranch_execnz .LBB5_3
1074 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
1075 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
1076 ; GFX90A-NEXT: s_cbranch_execnz .LBB5_8
1077 ; GFX90A-NEXT: .LBB5_2: ; %atomicrmw.phi
1078 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1079 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1080 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1081 ; GFX90A-NEXT: .LBB5_3: ; %atomicrmw.check.private
1082 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
1083 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
1084 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
1085 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
1086 ; GFX90A-NEXT: s_cbranch_execz .LBB5_5
1087 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
1088 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
1089 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1090 ; GFX90A-NEXT: buffer_wbinvl1
1091 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
1092 ; GFX90A-NEXT: ; implicit-def: $vgpr2
1093 ; GFX90A-NEXT: .LBB5_5: ; %Flow
1094 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
1095 ; GFX90A-NEXT: s_cbranch_execz .LBB5_7
1096 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
1097 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1098 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
1099 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
1100 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1101 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
1102 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
1103 ; GFX90A-NEXT: .LBB5_7: ; %Flow1
1104 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
1105 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
1106 ; GFX90A-NEXT: ; implicit-def: $vgpr2
1107 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
1108 ; GFX90A-NEXT: s_cbranch_execz .LBB5_2
1109 ; GFX90A-NEXT: .LBB5_8: ; %atomicrmw.shared
1110 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1111 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
1112 ; GFX90A-NEXT: ds_add_f32 v0, v2
1113 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
1114 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1115 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1116 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1118 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1119 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
1120 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1121 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
1122 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
1123 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
1124 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
1125 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
1126 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
1127 ; GFX908-NEXT: s_cbranch_execnz .LBB5_3
1128 ; GFX908-NEXT: ; %bb.1: ; %Flow2
1129 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
1130 ; GFX908-NEXT: s_cbranch_execnz .LBB5_8
1131 ; GFX908-NEXT: .LBB5_2: ; %atomicrmw.phi
1132 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1133 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1134 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1135 ; GFX908-NEXT: .LBB5_3: ; %atomicrmw.check.private
1136 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
1137 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
1138 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
1139 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
1140 ; GFX908-NEXT: s_cbranch_execz .LBB5_5
1141 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
1142 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
1143 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1144 ; GFX908-NEXT: buffer_wbinvl1
1145 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
1146 ; GFX908-NEXT: ; implicit-def: $vgpr2
1147 ; GFX908-NEXT: .LBB5_5: ; %Flow
1148 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
1149 ; GFX908-NEXT: s_cbranch_execz .LBB5_7
1150 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
1151 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1152 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
1153 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
1154 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1155 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
1156 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
1157 ; GFX908-NEXT: .LBB5_7: ; %Flow1
1158 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
1159 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
1160 ; GFX908-NEXT: ; implicit-def: $vgpr2
1161 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
1162 ; GFX908-NEXT: s_cbranch_execz .LBB5_2
1163 ; GFX908-NEXT: .LBB5_8: ; %atomicrmw.shared
1164 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1165 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
1166 ; GFX908-NEXT: ds_add_f32 v0, v2
1167 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
1168 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1169 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1170 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1172 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1174 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1175 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff800, v0
1176 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
1177 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
1178 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1179 ; GFX8-NEXT: .LBB5_1: ; %atomicrmw.start
1180 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1181 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1182 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
1183 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1184 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1185 ; GFX8-NEXT: buffer_wbinvl1
1186 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1187 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1188 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
1189 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1190 ; GFX8-NEXT: s_cbranch_execnz .LBB5_1
1191 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1192 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1193 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1195 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1197 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1198 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0xfffff800, v0
1199 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
1200 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
1201 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
1202 ; GFX7-NEXT: .LBB5_1: ; %atomicrmw.start
1203 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1204 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1205 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
1206 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1207 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1208 ; GFX7-NEXT: buffer_wbinvl1
1209 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1210 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1211 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
1212 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
1213 ; GFX7-NEXT: s_cbranch_execnz .LBB5_1
1214 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1215 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
1216 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1217 %gep = getelementptr float, ptr %ptr, i64 -512
1218 %unused = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
1222 define float @flat_system_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
1223 ; GFX12-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1225 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1226 ; GFX12-NEXT: s_wait_expcnt 0x0
1227 ; GFX12-NEXT: s_wait_samplecnt 0x0
1228 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1229 ; GFX12-NEXT: s_wait_kmcnt 0x0
1230 ; GFX12-NEXT: flat_load_b32 v3, v[0:1] offset:2044
1231 ; GFX12-NEXT: s_mov_b32 s0, 0
1232 ; GFX12-NEXT: .LBB6_1: ; %atomicrmw.start
1233 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
1234 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1235 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
1236 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
1237 ; GFX12-NEXT: v_add_f32_e32 v3, v4, v2
1238 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
1239 ; GFX12-NEXT: s_wait_storecnt 0x0
1240 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
1241 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1242 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
1243 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1244 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
1245 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1246 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1247 ; GFX12-NEXT: s_cbranch_execnz .LBB6_1
1248 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
1249 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
1250 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
1251 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1253 ; GFX940-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1255 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1256 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
1257 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:2044 sc0 sc1
1258 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1259 ; GFX940-NEXT: buffer_inv sc0 sc1
1260 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1262 ; GFX11-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1264 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1265 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2044
1266 ; GFX11-NEXT: s_mov_b32 s0, 0
1267 ; GFX11-NEXT: .LBB6_1: ; %atomicrmw.start
1268 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
1269 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1270 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
1271 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
1272 ; GFX11-NEXT: v_add_f32_e32 v3, v4, v2
1273 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1274 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
1275 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1276 ; GFX11-NEXT: buffer_gl1_inv
1277 ; GFX11-NEXT: buffer_gl0_inv
1278 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1279 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
1280 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1281 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1282 ; GFX11-NEXT: s_cbranch_execnz .LBB6_1
1283 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
1284 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
1285 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
1286 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1288 ; GFX10-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1290 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1291 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fc, v0
1292 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
1293 ; GFX10-NEXT: s_mov_b32 s4, 0
1294 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
1295 ; GFX10-NEXT: .LBB6_1: ; %atomicrmw.start
1296 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1297 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1298 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
1299 ; GFX10-NEXT: v_add_f32_e32 v0, v1, v2
1300 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1301 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
1302 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1303 ; GFX10-NEXT: buffer_gl1_inv
1304 ; GFX10-NEXT: buffer_gl0_inv
1305 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
1306 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1307 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1308 ; GFX10-NEXT: s_cbranch_execnz .LBB6_1
1309 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1310 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1311 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1313 ; GFX90A-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1315 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1316 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2044
1317 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1318 ; GFX90A-NEXT: .LBB6_1: ; %atomicrmw.start
1319 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1320 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1321 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
1322 ; GFX90A-NEXT: v_add_f32_e32 v4, v5, v2
1323 ; GFX90A-NEXT: buffer_wbl2
1324 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
1325 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1326 ; GFX90A-NEXT: buffer_invl2
1327 ; GFX90A-NEXT: buffer_wbinvl1
1328 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1329 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1330 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1331 ; GFX90A-NEXT: s_cbranch_execnz .LBB6_1
1332 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1333 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1334 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
1335 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1337 ; GFX908-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1339 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1340 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
1341 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1342 ; GFX908-NEXT: .LBB6_1: ; %atomicrmw.start
1343 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1344 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1345 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
1346 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
1347 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
1348 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1349 ; GFX908-NEXT: buffer_wbinvl1
1350 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1351 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1352 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1353 ; GFX908-NEXT: s_cbranch_execnz .LBB6_1
1354 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1355 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1356 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
1357 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1359 ; GFX8-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1361 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1362 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
1363 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
1364 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
1365 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1366 ; GFX8-NEXT: .LBB6_1: ; %atomicrmw.start
1367 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1368 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1369 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
1370 ; GFX8-NEXT: v_add_f32_e32 v0, v1, v2
1371 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
1372 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1373 ; GFX8-NEXT: buffer_wbinvl1
1374 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
1375 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1376 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1377 ; GFX8-NEXT: s_cbranch_execnz .LBB6_1
1378 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1379 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1380 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1382 ; GFX7-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1384 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1385 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0x7fc, v0
1386 ; GFX7-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
1387 ; GFX7-NEXT: flat_load_dword v0, v[3:4]
1388 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
1389 ; GFX7-NEXT: .LBB6_1: ; %atomicrmw.start
1390 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1391 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1392 ; GFX7-NEXT: v_mov_b32_e32 v1, v0
1393 ; GFX7-NEXT: v_add_f32_e32 v0, v1, v2
1394 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
1395 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1396 ; GFX7-NEXT: buffer_wbinvl1
1397 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
1398 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1399 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
1400 ; GFX7-NEXT: s_cbranch_execnz .LBB6_1
1401 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1402 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
1403 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1404 %gep = getelementptr float, ptr %ptr, i64 511
1405 %result = atomicrmw fadd ptr %gep, float %val seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
1409 define void @flat_system_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
1410 ; GFX12-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1412 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1413 ; GFX12-NEXT: s_wait_expcnt 0x0
1414 ; GFX12-NEXT: s_wait_samplecnt 0x0
1415 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1416 ; GFX12-NEXT: s_wait_kmcnt 0x0
1417 ; GFX12-NEXT: flat_load_b32 v4, v[0:1] offset:2044
1418 ; GFX12-NEXT: s_mov_b32 s0, 0
1419 ; GFX12-NEXT: .LBB7_1: ; %atomicrmw.start
1420 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
1421 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1422 ; GFX12-NEXT: v_add_f32_e32 v3, v4, v2
1423 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
1424 ; GFX12-NEXT: s_wait_storecnt 0x0
1425 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
1426 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1427 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
1428 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1429 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
1430 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
1431 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1432 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1433 ; GFX12-NEXT: s_cbranch_execnz .LBB7_1
1434 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
1435 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
1436 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1438 ; GFX940-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1440 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1441 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
1442 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044 sc1
1443 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1444 ; GFX940-NEXT: buffer_inv sc0 sc1
1445 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1447 ; GFX11-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1449 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1450 ; GFX11-NEXT: flat_load_b32 v4, v[0:1] offset:2044
1451 ; GFX11-NEXT: s_mov_b32 s0, 0
1452 ; GFX11-NEXT: .LBB7_1: ; %atomicrmw.start
1453 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
1454 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1455 ; GFX11-NEXT: v_add_f32_e32 v3, v4, v2
1456 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1457 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
1458 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1459 ; GFX11-NEXT: buffer_gl1_inv
1460 ; GFX11-NEXT: buffer_gl0_inv
1461 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1462 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
1463 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
1464 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1465 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1466 ; GFX11-NEXT: s_cbranch_execnz .LBB7_1
1467 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
1468 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
1469 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1471 ; GFX10-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1473 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1474 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
1475 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1476 ; GFX10-NEXT: s_mov_b32 s4, 0
1477 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
1478 ; GFX10-NEXT: .LBB7_1: ; %atomicrmw.start
1479 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1480 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1481 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
1482 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1483 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1484 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1485 ; GFX10-NEXT: buffer_gl1_inv
1486 ; GFX10-NEXT: buffer_gl0_inv
1487 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1488 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
1489 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1490 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1491 ; GFX10-NEXT: s_cbranch_execnz .LBB7_1
1492 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1493 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1494 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1496 ; GFX90A-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1498 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1499 ; GFX90A-NEXT: flat_load_dword v5, v[0:1] offset:2044
1500 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1501 ; GFX90A-NEXT: .LBB7_1: ; %atomicrmw.start
1502 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1503 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1504 ; GFX90A-NEXT: v_add_f32_e32 v4, v5, v2
1505 ; GFX90A-NEXT: buffer_wbl2
1506 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
1507 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1508 ; GFX90A-NEXT: buffer_invl2
1509 ; GFX90A-NEXT: buffer_wbinvl1
1510 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1511 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1512 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
1513 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1514 ; GFX90A-NEXT: s_cbranch_execnz .LBB7_1
1515 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1516 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1517 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1519 ; GFX908-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1521 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1522 ; GFX908-NEXT: flat_load_dword v4, v[0:1] offset:2044
1523 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1524 ; GFX908-NEXT: .LBB7_1: ; %atomicrmw.start
1525 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1526 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1527 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
1528 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
1529 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1530 ; GFX908-NEXT: buffer_wbinvl1
1531 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1532 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1533 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
1534 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1535 ; GFX908-NEXT: s_cbranch_execnz .LBB7_1
1536 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1537 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1538 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1540 ; GFX8-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1542 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1543 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
1544 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1545 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
1546 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1547 ; GFX8-NEXT: .LBB7_1: ; %atomicrmw.start
1548 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1549 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1550 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
1551 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1552 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1553 ; GFX8-NEXT: buffer_wbinvl1
1554 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1555 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1556 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
1557 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1558 ; GFX8-NEXT: s_cbranch_execnz .LBB7_1
1559 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1560 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1561 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1563 ; GFX7-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1565 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1566 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
1567 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1568 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
1569 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
1570 ; GFX7-NEXT: .LBB7_1: ; %atomicrmw.start
1571 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1572 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1573 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
1574 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1575 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1576 ; GFX7-NEXT: buffer_wbinvl1
1577 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1578 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1579 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
1580 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
1581 ; GFX7-NEXT: s_cbranch_execnz .LBB7_1
1582 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1583 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
1584 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1585 %gep = getelementptr float, ptr %ptr, i64 511
1586 %unused = atomicrmw fadd ptr %gep, float %val seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
1590 define void @flat_agent_atomic_fadd_noret_f32_maybe_remote(ptr %ptr, float %val) {
1591 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32_maybe_remote:
1593 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1594 ; GFX12-NEXT: s_wait_expcnt 0x0
1595 ; GFX12-NEXT: s_wait_samplecnt 0x0
1596 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1597 ; GFX12-NEXT: s_wait_kmcnt 0x0
1598 ; GFX12-NEXT: flat_load_b32 v4, v[0:1] offset:2044
1599 ; GFX12-NEXT: s_mov_b32 s0, 0
1600 ; GFX12-NEXT: .LBB8_1: ; %atomicrmw.start
1601 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
1602 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1603 ; GFX12-NEXT: v_add_f32_e32 v3, v4, v2
1604 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
1605 ; GFX12-NEXT: s_wait_storecnt 0x0
1606 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
1607 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1608 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
1609 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1610 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
1611 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
1612 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1613 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1614 ; GFX12-NEXT: s_cbranch_execnz .LBB8_1
1615 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
1616 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
1617 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1619 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32_maybe_remote:
1621 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1622 ; GFX940-NEXT: buffer_wbl2 sc1
1623 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
1624 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1625 ; GFX940-NEXT: buffer_inv sc1
1626 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1628 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32_maybe_remote:
1630 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1631 ; GFX11-NEXT: flat_load_b32 v4, v[0:1] offset:2044
1632 ; GFX11-NEXT: s_mov_b32 s0, 0
1633 ; GFX11-NEXT: .LBB8_1: ; %atomicrmw.start
1634 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
1635 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1636 ; GFX11-NEXT: v_add_f32_e32 v3, v4, v2
1637 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1638 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
1639 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1640 ; GFX11-NEXT: buffer_gl1_inv
1641 ; GFX11-NEXT: buffer_gl0_inv
1642 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1643 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
1644 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
1645 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
1646 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
1647 ; GFX11-NEXT: s_cbranch_execnz .LBB8_1
1648 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
1649 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
1650 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1652 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32_maybe_remote:
1654 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1655 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
1656 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1657 ; GFX10-NEXT: s_mov_b32 s4, 0
1658 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
1659 ; GFX10-NEXT: .LBB8_1: ; %atomicrmw.start
1660 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1661 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1662 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
1663 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1664 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1665 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1666 ; GFX10-NEXT: buffer_gl1_inv
1667 ; GFX10-NEXT: buffer_gl0_inv
1668 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1669 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
1670 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1671 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1672 ; GFX10-NEXT: s_cbranch_execnz .LBB8_1
1673 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1674 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1675 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1677 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32_maybe_remote:
1679 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1680 ; GFX90A-NEXT: flat_load_dword v5, v[0:1] offset:2044
1681 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
1682 ; GFX90A-NEXT: .LBB8_1: ; %atomicrmw.start
1683 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
1684 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1685 ; GFX90A-NEXT: v_add_f32_e32 v4, v5, v2
1686 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
1687 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1688 ; GFX90A-NEXT: buffer_wbinvl1
1689 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
1690 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1691 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
1692 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
1693 ; GFX90A-NEXT: s_cbranch_execnz .LBB8_1
1694 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
1695 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1696 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1698 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32_maybe_remote:
1700 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1701 ; GFX908-NEXT: flat_load_dword v4, v[0:1] offset:2044
1702 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
1703 ; GFX908-NEXT: .LBB8_1: ; %atomicrmw.start
1704 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
1705 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1706 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
1707 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
1708 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1709 ; GFX908-NEXT: buffer_wbinvl1
1710 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1711 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1712 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
1713 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
1714 ; GFX908-NEXT: s_cbranch_execnz .LBB8_1
1715 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
1716 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1717 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1719 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32_maybe_remote:
1721 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1722 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
1723 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1724 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
1725 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1726 ; GFX8-NEXT: .LBB8_1: ; %atomicrmw.start
1727 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1728 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1729 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
1730 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1731 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1732 ; GFX8-NEXT: buffer_wbinvl1
1733 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1734 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1735 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
1736 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1737 ; GFX8-NEXT: s_cbranch_execnz .LBB8_1
1738 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1739 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1740 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1742 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32_maybe_remote:
1744 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1745 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
1746 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1747 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
1748 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
1749 ; GFX7-NEXT: .LBB8_1: ; %atomicrmw.start
1750 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1751 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1752 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
1753 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1754 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1755 ; GFX7-NEXT: buffer_wbinvl1
1756 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1757 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1758 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
1759 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
1760 ; GFX7-NEXT: s_cbranch_execnz .LBB8_1
1761 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1762 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
1763 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1764 %gep = getelementptr float, ptr %ptr, i64 511
1765 %unused = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst
1769 define void @flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory(ptr %ptr, float %val) #0 {
1770 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory:
1772 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1773 ; GFX12-NEXT: s_wait_expcnt 0x0
1774 ; GFX12-NEXT: s_wait_samplecnt 0x0
1775 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1776 ; GFX12-NEXT: s_wait_kmcnt 0x0
1777 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
1778 ; GFX12-NEXT: s_wait_storecnt 0x0
1779 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044 scope:SCOPE_DEV
1780 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
1781 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
1782 ; GFX12-NEXT: s_setpc_b64 s[30:31]
1784 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory:
1786 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1787 ; GFX940-NEXT: buffer_wbl2 sc1
1788 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
1789 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1790 ; GFX940-NEXT: buffer_inv sc1
1791 ; GFX940-NEXT: s_setpc_b64 s[30:31]
1793 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory:
1795 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1796 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1797 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
1798 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1799 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
1800 ; GFX11-NEXT: buffer_gl1_inv
1801 ; GFX11-NEXT: buffer_gl0_inv
1802 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1804 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory:
1806 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1807 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
1808 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1809 ; GFX10-NEXT: s_mov_b32 s4, 0
1810 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
1811 ; GFX10-NEXT: .LBB9_1: ; %atomicrmw.start
1812 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
1813 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1814 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
1815 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
1816 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1817 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1818 ; GFX10-NEXT: buffer_gl1_inv
1819 ; GFX10-NEXT: buffer_gl0_inv
1820 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
1821 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
1822 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
1823 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
1824 ; GFX10-NEXT: s_cbranch_execnz .LBB9_1
1825 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
1826 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
1827 ; GFX10-NEXT: s_setpc_b64 s[30:31]
1829 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory:
1830 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
1831 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1832 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
1833 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1834 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
1835 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
1836 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
1837 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
1838 ; GFX90A-NEXT: s_cbranch_execnz .LBB9_3
1839 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
1840 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
1841 ; GFX90A-NEXT: s_cbranch_execnz .LBB9_8
1842 ; GFX90A-NEXT: .LBB9_2: ; %atomicrmw.phi
1843 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1844 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1845 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1846 ; GFX90A-NEXT: .LBB9_3: ; %atomicrmw.check.private
1847 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
1848 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
1849 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
1850 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
1851 ; GFX90A-NEXT: s_cbranch_execz .LBB9_5
1852 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
1853 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
1854 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1855 ; GFX90A-NEXT: buffer_wbinvl1
1856 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
1857 ; GFX90A-NEXT: ; implicit-def: $vgpr2
1858 ; GFX90A-NEXT: .LBB9_5: ; %Flow
1859 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
1860 ; GFX90A-NEXT: s_cbranch_execz .LBB9_7
1861 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
1862 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1863 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
1864 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
1865 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1866 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
1867 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
1868 ; GFX90A-NEXT: .LBB9_7: ; %Flow1
1869 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
1870 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
1871 ; GFX90A-NEXT: ; implicit-def: $vgpr2
1872 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
1873 ; GFX90A-NEXT: s_cbranch_execz .LBB9_2
1874 ; GFX90A-NEXT: .LBB9_8: ; %atomicrmw.shared
1875 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1876 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
1877 ; GFX90A-NEXT: ds_add_f32 v0, v2
1878 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
1879 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
1880 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
1881 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
1883 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory:
1884 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
1885 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1886 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
1887 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1888 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
1889 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
1890 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
1891 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
1892 ; GFX908-NEXT: s_cbranch_execnz .LBB9_3
1893 ; GFX908-NEXT: ; %bb.1: ; %Flow2
1894 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
1895 ; GFX908-NEXT: s_cbranch_execnz .LBB9_8
1896 ; GFX908-NEXT: .LBB9_2: ; %atomicrmw.phi
1897 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1898 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1899 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1900 ; GFX908-NEXT: .LBB9_3: ; %atomicrmw.check.private
1901 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
1902 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
1903 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
1904 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
1905 ; GFX908-NEXT: s_cbranch_execz .LBB9_5
1906 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
1907 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
1908 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1909 ; GFX908-NEXT: buffer_wbinvl1
1910 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
1911 ; GFX908-NEXT: ; implicit-def: $vgpr2
1912 ; GFX908-NEXT: .LBB9_5: ; %Flow
1913 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
1914 ; GFX908-NEXT: s_cbranch_execz .LBB9_7
1915 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
1916 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1917 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
1918 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
1919 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1920 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
1921 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
1922 ; GFX908-NEXT: .LBB9_7: ; %Flow1
1923 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
1924 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
1925 ; GFX908-NEXT: ; implicit-def: $vgpr2
1926 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
1927 ; GFX908-NEXT: s_cbranch_execz .LBB9_2
1928 ; GFX908-NEXT: .LBB9_8: ; %atomicrmw.shared
1929 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
1930 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
1931 ; GFX908-NEXT: ds_add_f32 v0, v2
1932 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
1933 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
1934 ; GFX908-NEXT: s_waitcnt vmcnt(0)
1935 ; GFX908-NEXT: s_setpc_b64 s[30:31]
1937 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory:
1939 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1940 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
1941 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1942 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
1943 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
1944 ; GFX8-NEXT: .LBB9_1: ; %atomicrmw.start
1945 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
1946 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1947 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
1948 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1949 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1950 ; GFX8-NEXT: buffer_wbinvl1
1951 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1952 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1953 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
1954 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
1955 ; GFX8-NEXT: s_cbranch_execnz .LBB9_1
1956 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
1957 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
1958 ; GFX8-NEXT: s_setpc_b64 s[30:31]
1960 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory:
1962 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1963 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
1964 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1965 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
1966 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
1967 ; GFX7-NEXT: .LBB9_1: ; %atomicrmw.start
1968 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
1969 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1970 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
1971 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
1972 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1973 ; GFX7-NEXT: buffer_wbinvl1
1974 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
1975 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
1976 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
1977 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
1978 ; GFX7-NEXT: s_cbranch_execnz .LBB9_1
1979 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
1980 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
1981 ; GFX7-NEXT: s_setpc_b64 s[30:31]
1982 %gep = getelementptr float, ptr %ptr, i64 511
1983 %unused = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
1987 define void @flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
1988 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
1990 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
1991 ; GFX12-NEXT: s_wait_expcnt 0x0
1992 ; GFX12-NEXT: s_wait_samplecnt 0x0
1993 ; GFX12-NEXT: s_wait_bvhcnt 0x0
1994 ; GFX12-NEXT: s_wait_kmcnt 0x0
1995 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
1996 ; GFX12-NEXT: s_wait_storecnt 0x0
1997 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044 scope:SCOPE_DEV
1998 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
1999 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
2000 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2002 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
2004 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2005 ; GFX940-NEXT: buffer_wbl2 sc1
2006 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
2007 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2008 ; GFX940-NEXT: buffer_inv sc1
2009 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2011 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
2013 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2014 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2015 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
2016 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2017 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2018 ; GFX11-NEXT: buffer_gl1_inv
2019 ; GFX11-NEXT: buffer_gl0_inv
2020 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2022 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
2024 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2025 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
2026 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
2027 ; GFX10-NEXT: s_mov_b32 s4, 0
2028 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
2029 ; GFX10-NEXT: .LBB10_1: ; %atomicrmw.start
2030 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2031 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2032 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
2033 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2034 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2035 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2036 ; GFX10-NEXT: buffer_gl1_inv
2037 ; GFX10-NEXT: buffer_gl0_inv
2038 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2039 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
2040 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2041 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2042 ; GFX10-NEXT: s_cbranch_execnz .LBB10_1
2043 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2044 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2045 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2047 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
2048 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
2049 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2050 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
2051 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2052 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
2053 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
2054 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
2055 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
2056 ; GFX90A-NEXT: s_cbranch_execnz .LBB10_3
2057 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
2058 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2059 ; GFX90A-NEXT: s_cbranch_execnz .LBB10_8
2060 ; GFX90A-NEXT: .LBB10_2: ; %atomicrmw.phi
2061 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2062 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2063 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2064 ; GFX90A-NEXT: .LBB10_3: ; %atomicrmw.check.private
2065 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
2066 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
2067 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
2068 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
2069 ; GFX90A-NEXT: s_cbranch_execz .LBB10_5
2070 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
2071 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
2072 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2073 ; GFX90A-NEXT: buffer_wbinvl1
2074 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
2075 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2076 ; GFX90A-NEXT: .LBB10_5: ; %Flow
2077 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
2078 ; GFX90A-NEXT: s_cbranch_execz .LBB10_7
2079 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
2080 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2081 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2082 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
2083 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2084 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
2085 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
2086 ; GFX90A-NEXT: .LBB10_7: ; %Flow1
2087 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
2088 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
2089 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2090 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2091 ; GFX90A-NEXT: s_cbranch_execz .LBB10_2
2092 ; GFX90A-NEXT: .LBB10_8: ; %atomicrmw.shared
2093 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2094 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2095 ; GFX90A-NEXT: ds_add_f32 v0, v2
2096 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2097 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2098 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2099 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2101 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
2102 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
2103 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2104 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
2105 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2106 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
2107 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
2108 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
2109 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
2110 ; GFX908-NEXT: s_cbranch_execnz .LBB10_3
2111 ; GFX908-NEXT: ; %bb.1: ; %Flow2
2112 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2113 ; GFX908-NEXT: s_cbranch_execnz .LBB10_8
2114 ; GFX908-NEXT: .LBB10_2: ; %atomicrmw.phi
2115 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2116 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2117 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2118 ; GFX908-NEXT: .LBB10_3: ; %atomicrmw.check.private
2119 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
2120 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
2121 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
2122 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
2123 ; GFX908-NEXT: s_cbranch_execz .LBB10_5
2124 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
2125 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
2126 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2127 ; GFX908-NEXT: buffer_wbinvl1
2128 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
2129 ; GFX908-NEXT: ; implicit-def: $vgpr2
2130 ; GFX908-NEXT: .LBB10_5: ; %Flow
2131 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
2132 ; GFX908-NEXT: s_cbranch_execz .LBB10_7
2133 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
2134 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2135 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2136 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
2137 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2138 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
2139 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
2140 ; GFX908-NEXT: .LBB10_7: ; %Flow1
2141 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
2142 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
2143 ; GFX908-NEXT: ; implicit-def: $vgpr2
2144 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2145 ; GFX908-NEXT: s_cbranch_execz .LBB10_2
2146 ; GFX908-NEXT: .LBB10_8: ; %atomicrmw.shared
2147 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2148 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2149 ; GFX908-NEXT: ds_add_f32 v0, v2
2150 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
2151 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2152 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2153 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2155 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
2157 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2158 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
2159 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2160 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
2161 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2162 ; GFX8-NEXT: .LBB10_1: ; %atomicrmw.start
2163 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2164 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2165 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
2166 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2167 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2168 ; GFX8-NEXT: buffer_wbinvl1
2169 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2170 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2171 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
2172 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2173 ; GFX8-NEXT: s_cbranch_execnz .LBB10_1
2174 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2175 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2176 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2178 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32___amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
2180 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2181 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
2182 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2183 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
2184 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
2185 ; GFX7-NEXT: .LBB10_1: ; %atomicrmw.start
2186 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2187 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2188 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
2189 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2190 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2191 ; GFX7-NEXT: buffer_wbinvl1
2192 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2193 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2194 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
2195 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
2196 ; GFX7-NEXT: s_cbranch_execnz .LBB10_1
2197 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2198 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
2199 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2200 %gep = getelementptr float, ptr %ptr, i64 511
2201 %unused = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
2205 define void @flat_agent_atomic_fadd_noret_f32_amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
2206 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32_amdgpu_ignore_denormal_mode:
2208 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2209 ; GFX12-NEXT: s_wait_expcnt 0x0
2210 ; GFX12-NEXT: s_wait_samplecnt 0x0
2211 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2212 ; GFX12-NEXT: s_wait_kmcnt 0x0
2213 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
2214 ; GFX12-NEXT: s_wait_storecnt 0x0
2215 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044 scope:SCOPE_DEV
2216 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
2217 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
2218 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2220 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32_amdgpu_ignore_denormal_mode:
2222 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2223 ; GFX940-NEXT: buffer_wbl2 sc1
2224 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
2225 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2226 ; GFX940-NEXT: buffer_inv sc1
2227 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2229 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32_amdgpu_ignore_denormal_mode:
2231 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2232 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2233 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
2234 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2235 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2236 ; GFX11-NEXT: buffer_gl1_inv
2237 ; GFX11-NEXT: buffer_gl0_inv
2238 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2240 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32_amdgpu_ignore_denormal_mode:
2242 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2243 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
2244 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
2245 ; GFX10-NEXT: s_mov_b32 s4, 0
2246 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
2247 ; GFX10-NEXT: .LBB11_1: ; %atomicrmw.start
2248 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2249 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2250 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
2251 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2252 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2253 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2254 ; GFX10-NEXT: buffer_gl1_inv
2255 ; GFX10-NEXT: buffer_gl0_inv
2256 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2257 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
2258 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2259 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2260 ; GFX10-NEXT: s_cbranch_execnz .LBB11_1
2261 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2262 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2263 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2265 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32_amdgpu_ignore_denormal_mode:
2266 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
2267 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2268 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
2269 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2270 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
2271 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
2272 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
2273 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
2274 ; GFX90A-NEXT: s_cbranch_execnz .LBB11_3
2275 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
2276 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2277 ; GFX90A-NEXT: s_cbranch_execnz .LBB11_8
2278 ; GFX90A-NEXT: .LBB11_2: ; %atomicrmw.phi
2279 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2280 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2281 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2282 ; GFX90A-NEXT: .LBB11_3: ; %atomicrmw.check.private
2283 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
2284 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
2285 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
2286 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
2287 ; GFX90A-NEXT: s_cbranch_execz .LBB11_5
2288 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
2289 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
2290 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2291 ; GFX90A-NEXT: buffer_wbinvl1
2292 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
2293 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2294 ; GFX90A-NEXT: .LBB11_5: ; %Flow
2295 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
2296 ; GFX90A-NEXT: s_cbranch_execz .LBB11_7
2297 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
2298 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2299 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2300 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
2301 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2302 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
2303 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
2304 ; GFX90A-NEXT: .LBB11_7: ; %Flow1
2305 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
2306 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
2307 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2308 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2309 ; GFX90A-NEXT: s_cbranch_execz .LBB11_2
2310 ; GFX90A-NEXT: .LBB11_8: ; %atomicrmw.shared
2311 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2312 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2313 ; GFX90A-NEXT: ds_add_f32 v0, v2
2314 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2315 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2316 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2317 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2319 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32_amdgpu_ignore_denormal_mode:
2320 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
2321 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2322 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
2323 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2324 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
2325 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
2326 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
2327 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
2328 ; GFX908-NEXT: s_cbranch_execnz .LBB11_3
2329 ; GFX908-NEXT: ; %bb.1: ; %Flow2
2330 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2331 ; GFX908-NEXT: s_cbranch_execnz .LBB11_8
2332 ; GFX908-NEXT: .LBB11_2: ; %atomicrmw.phi
2333 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2334 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2335 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2336 ; GFX908-NEXT: .LBB11_3: ; %atomicrmw.check.private
2337 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
2338 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
2339 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
2340 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
2341 ; GFX908-NEXT: s_cbranch_execz .LBB11_5
2342 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
2343 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
2344 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2345 ; GFX908-NEXT: buffer_wbinvl1
2346 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
2347 ; GFX908-NEXT: ; implicit-def: $vgpr2
2348 ; GFX908-NEXT: .LBB11_5: ; %Flow
2349 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
2350 ; GFX908-NEXT: s_cbranch_execz .LBB11_7
2351 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
2352 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2353 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2354 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
2355 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2356 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
2357 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
2358 ; GFX908-NEXT: .LBB11_7: ; %Flow1
2359 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
2360 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
2361 ; GFX908-NEXT: ; implicit-def: $vgpr2
2362 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2363 ; GFX908-NEXT: s_cbranch_execz .LBB11_2
2364 ; GFX908-NEXT: .LBB11_8: ; %atomicrmw.shared
2365 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2366 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2367 ; GFX908-NEXT: ds_add_f32 v0, v2
2368 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
2369 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2370 ; GFX908-NEXT: s_waitcnt vmcnt(0)
2371 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2373 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32_amdgpu_ignore_denormal_mode:
2375 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2376 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
2377 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2378 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
2379 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2380 ; GFX8-NEXT: .LBB11_1: ; %atomicrmw.start
2381 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2382 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2383 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
2384 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2385 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2386 ; GFX8-NEXT: buffer_wbinvl1
2387 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2388 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2389 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
2390 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2391 ; GFX8-NEXT: s_cbranch_execnz .LBB11_1
2392 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2393 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2394 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2396 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32_amdgpu_ignore_denormal_mode:
2398 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2399 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
2400 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
2401 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
2402 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
2403 ; GFX7-NEXT: .LBB11_1: ; %atomicrmw.start
2404 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2405 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2406 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
2407 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2408 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2409 ; GFX7-NEXT: buffer_wbinvl1
2410 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2411 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2412 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
2413 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
2414 ; GFX7-NEXT: s_cbranch_execnz .LBB11_1
2415 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2416 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
2417 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2418 %gep = getelementptr float, ptr %ptr, i64 511
2419 %unused = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.ignore.denormal.mode !0
2423 ; --------------------------------------------------------------------
2424 ; float with ftz/daz
2425 ; --------------------------------------------------------------------
2427 define float @flat_agent_atomic_fadd_ret_f32__ftz__amdgpu_no_fine_grained_memory(ptr %ptr, float %val) #1 {
2428 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__ftz__amdgpu_no_fine_grained_memory:
2430 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2431 ; GFX12-NEXT: s_wait_expcnt 0x0
2432 ; GFX12-NEXT: s_wait_samplecnt 0x0
2433 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2434 ; GFX12-NEXT: s_wait_kmcnt 0x0
2435 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
2436 ; GFX12-NEXT: s_wait_storecnt 0x0
2437 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
2438 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2439 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
2440 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2442 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__ftz__amdgpu_no_fine_grained_memory:
2444 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2445 ; GFX940-NEXT: buffer_wbl2 sc1
2446 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 sc0
2447 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2448 ; GFX940-NEXT: buffer_inv sc1
2449 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2451 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__ftz__amdgpu_no_fine_grained_memory:
2453 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2454 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2455 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 glc
2456 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2457 ; GFX11-NEXT: buffer_gl1_inv
2458 ; GFX11-NEXT: buffer_gl0_inv
2459 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2461 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__ftz__amdgpu_no_fine_grained_memory:
2463 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2464 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
2465 ; GFX10-NEXT: s_mov_b32 s4, 0
2466 ; GFX10-NEXT: .LBB12_1: ; %atomicrmw.start
2467 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2468 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2469 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
2470 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
2471 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2472 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2473 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2474 ; GFX10-NEXT: buffer_gl1_inv
2475 ; GFX10-NEXT: buffer_gl0_inv
2476 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
2477 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2478 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2479 ; GFX10-NEXT: s_cbranch_execnz .LBB12_1
2480 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2481 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2482 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
2483 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2485 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__ftz__amdgpu_no_fine_grained_memory:
2487 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2488 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
2489 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
2490 ; GFX90A-NEXT: ; implicit-def: $vgpr3
2491 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
2492 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
2493 ; GFX90A-NEXT: s_cbranch_execz .LBB12_6
2494 ; GFX90A-NEXT: ; %bb.1: ; %atomicrmw.check.private
2495 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
2496 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
2497 ; GFX90A-NEXT: ; implicit-def: $vgpr3
2498 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
2499 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
2500 ; GFX90A-NEXT: s_cbranch_execz .LBB12_3
2501 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.global
2502 ; GFX90A-NEXT: global_atomic_add_f32 v3, v[0:1], v2, off glc
2503 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2504 ; GFX90A-NEXT: buffer_wbinvl1
2505 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
2506 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2507 ; GFX90A-NEXT: .LBB12_3: ; %Flow
2508 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
2509 ; GFX90A-NEXT: s_cbranch_execz .LBB12_5
2510 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.private
2511 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2512 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2513 ; GFX90A-NEXT: buffer_load_dword v3, v0, s[0:3], 0 offen
2514 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2515 ; GFX90A-NEXT: v_add_f32_e32 v1, v3, v2
2516 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
2517 ; GFX90A-NEXT: .LBB12_5: ; %Flow1
2518 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
2519 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
2520 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2521 ; GFX90A-NEXT: .LBB12_6: ; %Flow2
2522 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2523 ; GFX90A-NEXT: s_cbranch_execz .LBB12_8
2524 ; GFX90A-NEXT: ; %bb.7: ; %atomicrmw.shared
2525 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
2526 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
2527 ; GFX90A-NEXT: ds_add_rtn_f32 v3, v0, v2
2528 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2529 ; GFX90A-NEXT: .LBB12_8: ; %atomicrmw.phi
2530 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2531 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
2532 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2533 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2535 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__ftz__amdgpu_no_fine_grained_memory:
2537 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2538 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
2539 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2540 ; GFX908-NEXT: .LBB12_1: ; %atomicrmw.start
2541 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2542 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2543 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
2544 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
2545 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2546 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2547 ; GFX908-NEXT: buffer_wbinvl1
2548 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2549 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2550 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2551 ; GFX908-NEXT: s_cbranch_execnz .LBB12_1
2552 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2553 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2554 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
2555 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2557 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__ftz__amdgpu_no_fine_grained_memory:
2559 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2560 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
2561 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2562 ; GFX8-NEXT: .LBB12_1: ; %atomicrmw.start
2563 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2564 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2565 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
2566 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
2567 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2568 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2569 ; GFX8-NEXT: buffer_wbinvl1
2570 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2571 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2572 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2573 ; GFX8-NEXT: s_cbranch_execnz .LBB12_1
2574 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2575 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2576 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
2577 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2579 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__ftz__amdgpu_no_fine_grained_memory:
2581 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2582 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
2583 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
2584 ; GFX7-NEXT: .LBB12_1: ; %atomicrmw.start
2585 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2586 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2587 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
2588 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
2589 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
2590 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2591 ; GFX7-NEXT: buffer_wbinvl1
2592 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2593 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2594 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
2595 ; GFX7-NEXT: s_cbranch_execnz .LBB12_1
2596 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2597 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
2598 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
2599 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2600 %result = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
2604 define float @flat_agent_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory(ptr %ptr, float %val) #1 {
2605 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
2607 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2608 ; GFX12-NEXT: s_wait_expcnt 0x0
2609 ; GFX12-NEXT: s_wait_samplecnt 0x0
2610 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2611 ; GFX12-NEXT: s_wait_kmcnt 0x0
2612 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
2613 ; GFX12-NEXT: s_wait_storecnt 0x0
2614 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
2615 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2616 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
2617 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2619 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
2621 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2622 ; GFX940-NEXT: buffer_wbl2 sc1
2623 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:2044 sc0
2624 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2625 ; GFX940-NEXT: buffer_inv sc1
2626 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2628 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
2630 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2631 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2632 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:2044 glc
2633 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2634 ; GFX11-NEXT: buffer_gl1_inv
2635 ; GFX11-NEXT: buffer_gl0_inv
2636 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2638 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
2640 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2641 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fc, v0
2642 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
2643 ; GFX10-NEXT: s_mov_b32 s4, 0
2644 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
2645 ; GFX10-NEXT: .LBB13_1: ; %atomicrmw.start
2646 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2647 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2648 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
2649 ; GFX10-NEXT: v_add_f32_e32 v0, v1, v2
2650 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2651 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
2652 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2653 ; GFX10-NEXT: buffer_gl1_inv
2654 ; GFX10-NEXT: buffer_gl0_inv
2655 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
2656 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2657 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2658 ; GFX10-NEXT: s_cbranch_execnz .LBB13_1
2659 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2660 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2661 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2663 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
2665 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2666 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fc, v0
2667 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v1, vcc
2668 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
2669 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v5
2670 ; GFX90A-NEXT: ; implicit-def: $vgpr0
2671 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
2672 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
2673 ; GFX90A-NEXT: s_cbranch_execnz .LBB13_3
2674 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
2675 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2676 ; GFX90A-NEXT: s_cbranch_execnz .LBB13_8
2677 ; GFX90A-NEXT: .LBB13_2: ; %atomicrmw.phi
2678 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2679 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2680 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2681 ; GFX90A-NEXT: .LBB13_3: ; %atomicrmw.check.private
2682 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
2683 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v5
2684 ; GFX90A-NEXT: ; implicit-def: $vgpr0
2685 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
2686 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
2687 ; GFX90A-NEXT: s_cbranch_execz .LBB13_5
2688 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
2689 ; GFX90A-NEXT: global_atomic_add_f32 v0, v[4:5], v2, off glc
2690 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2691 ; GFX90A-NEXT: buffer_wbinvl1
2692 ; GFX90A-NEXT: ; implicit-def: $vgpr4_vgpr5
2693 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2694 ; GFX90A-NEXT: .LBB13_5: ; %Flow
2695 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
2696 ; GFX90A-NEXT: s_cbranch_execz .LBB13_7
2697 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
2698 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
2699 ; GFX90A-NEXT: v_cndmask_b32_e32 v1, -1, v4, vcc
2700 ; GFX90A-NEXT: buffer_load_dword v0, v1, s[0:3], 0 offen
2701 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2702 ; GFX90A-NEXT: v_add_f32_e32 v2, v0, v2
2703 ; GFX90A-NEXT: buffer_store_dword v2, v1, s[0:3], 0 offen
2704 ; GFX90A-NEXT: .LBB13_7: ; %Flow1
2705 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
2706 ; GFX90A-NEXT: ; implicit-def: $vgpr4_vgpr5
2707 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2708 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2709 ; GFX90A-NEXT: s_cbranch_execz .LBB13_2
2710 ; GFX90A-NEXT: .LBB13_8: ; %atomicrmw.shared
2711 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
2712 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v4, vcc
2713 ; GFX90A-NEXT: ds_add_rtn_f32 v0, v0, v2
2714 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2715 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2716 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2717 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2719 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
2721 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2722 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
2723 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2724 ; GFX908-NEXT: .LBB13_1: ; %atomicrmw.start
2725 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2726 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2727 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
2728 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
2729 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
2730 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2731 ; GFX908-NEXT: buffer_wbinvl1
2732 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
2733 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2734 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2735 ; GFX908-NEXT: s_cbranch_execnz .LBB13_1
2736 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2737 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2738 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
2739 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2741 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
2743 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2744 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
2745 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
2746 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
2747 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2748 ; GFX8-NEXT: .LBB13_1: ; %atomicrmw.start
2749 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2750 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2751 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
2752 ; GFX8-NEXT: v_add_f32_e32 v0, v1, v2
2753 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
2754 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2755 ; GFX8-NEXT: buffer_wbinvl1
2756 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
2757 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2758 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2759 ; GFX8-NEXT: s_cbranch_execnz .LBB13_1
2760 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2761 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2762 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2764 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
2766 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2767 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0x7fc, v0
2768 ; GFX7-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
2769 ; GFX7-NEXT: flat_load_dword v0, v[3:4]
2770 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
2771 ; GFX7-NEXT: .LBB13_1: ; %atomicrmw.start
2772 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2773 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2774 ; GFX7-NEXT: v_mov_b32_e32 v1, v0
2775 ; GFX7-NEXT: v_add_f32_e32 v0, v1, v2
2776 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
2777 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2778 ; GFX7-NEXT: buffer_wbinvl1
2779 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
2780 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2781 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
2782 ; GFX7-NEXT: s_cbranch_execnz .LBB13_1
2783 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2784 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
2785 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2786 %gep = getelementptr float, ptr %ptr, i64 511
2787 %result = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
2791 define float @flat_agent_atomic_fadd_ret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory(ptr %ptr, float %val) #1 {
2792 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
2794 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2795 ; GFX12-NEXT: s_wait_expcnt 0x0
2796 ; GFX12-NEXT: s_wait_samplecnt 0x0
2797 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2798 ; GFX12-NEXT: s_wait_kmcnt 0x0
2799 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
2800 ; GFX12-NEXT: s_wait_storecnt 0x0
2801 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
2802 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2803 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
2804 ; GFX12-NEXT: s_setpc_b64 s[30:31]
2806 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
2808 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2809 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
2810 ; GFX940-NEXT: s_nop 1
2811 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
2812 ; GFX940-NEXT: buffer_wbl2 sc1
2813 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 sc0
2814 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2815 ; GFX940-NEXT: buffer_inv sc1
2816 ; GFX940-NEXT: s_setpc_b64 s[30:31]
2818 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
2820 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2821 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
2822 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
2823 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
2824 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 glc
2825 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2826 ; GFX11-NEXT: buffer_gl1_inv
2827 ; GFX11-NEXT: buffer_gl0_inv
2828 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2830 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
2832 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2833 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
2834 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, -1, v1, vcc_lo
2835 ; GFX10-NEXT: s_mov_b32 s4, 0
2836 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
2837 ; GFX10-NEXT: .LBB14_1: ; %atomicrmw.start
2838 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2839 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2840 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
2841 ; GFX10-NEXT: v_add_f32_e32 v0, v1, v2
2842 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
2843 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
2844 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2845 ; GFX10-NEXT: buffer_gl1_inv
2846 ; GFX10-NEXT: buffer_gl0_inv
2847 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
2848 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
2849 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
2850 ; GFX10-NEXT: s_cbranch_execnz .LBB14_1
2851 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
2852 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
2853 ; GFX10-NEXT: s_setpc_b64 s[30:31]
2855 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
2857 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2858 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
2859 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, -1, v1, vcc
2860 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
2861 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v5
2862 ; GFX90A-NEXT: ; implicit-def: $vgpr0
2863 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
2864 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
2865 ; GFX90A-NEXT: s_cbranch_execnz .LBB14_3
2866 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
2867 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2868 ; GFX90A-NEXT: s_cbranch_execnz .LBB14_8
2869 ; GFX90A-NEXT: .LBB14_2: ; %atomicrmw.phi
2870 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2871 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2872 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2873 ; GFX90A-NEXT: .LBB14_3: ; %atomicrmw.check.private
2874 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
2875 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v5
2876 ; GFX90A-NEXT: ; implicit-def: $vgpr0
2877 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
2878 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
2879 ; GFX90A-NEXT: s_cbranch_execz .LBB14_5
2880 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
2881 ; GFX90A-NEXT: global_atomic_add_f32 v0, v[4:5], v2, off glc
2882 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2883 ; GFX90A-NEXT: buffer_wbinvl1
2884 ; GFX90A-NEXT: ; implicit-def: $vgpr4_vgpr5
2885 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2886 ; GFX90A-NEXT: .LBB14_5: ; %Flow
2887 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
2888 ; GFX90A-NEXT: s_cbranch_execz .LBB14_7
2889 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
2890 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
2891 ; GFX90A-NEXT: v_cndmask_b32_e32 v1, -1, v4, vcc
2892 ; GFX90A-NEXT: buffer_load_dword v0, v1, s[0:3], 0 offen
2893 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2894 ; GFX90A-NEXT: v_add_f32_e32 v2, v0, v2
2895 ; GFX90A-NEXT: buffer_store_dword v2, v1, s[0:3], 0 offen
2896 ; GFX90A-NEXT: .LBB14_7: ; %Flow1
2897 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
2898 ; GFX90A-NEXT: ; implicit-def: $vgpr4_vgpr5
2899 ; GFX90A-NEXT: ; implicit-def: $vgpr2
2900 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
2901 ; GFX90A-NEXT: s_cbranch_execz .LBB14_2
2902 ; GFX90A-NEXT: .LBB14_8: ; %atomicrmw.shared
2903 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[4:5]
2904 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v4, vcc
2905 ; GFX90A-NEXT: ds_add_rtn_f32 v0, v0, v2
2906 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
2907 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
2908 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
2909 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
2911 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
2913 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2914 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
2915 ; GFX908-NEXT: v_addc_co_u32_e32 v4, vcc, -1, v1, vcc
2916 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
2917 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
2918 ; GFX908-NEXT: flat_load_dword v0, v[0:1]
2919 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
2920 ; GFX908-NEXT: .LBB14_1: ; %atomicrmw.start
2921 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
2922 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2923 ; GFX908-NEXT: v_mov_b32_e32 v1, v0
2924 ; GFX908-NEXT: v_add_f32_e32 v0, v1, v2
2925 ; GFX908-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
2926 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2927 ; GFX908-NEXT: buffer_wbinvl1
2928 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
2929 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2930 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
2931 ; GFX908-NEXT: s_cbranch_execnz .LBB14_1
2932 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
2933 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
2934 ; GFX908-NEXT: s_setpc_b64 s[30:31]
2936 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
2938 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2939 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
2940 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
2941 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
2942 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
2943 ; GFX8-NEXT: .LBB14_1: ; %atomicrmw.start
2944 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2945 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2946 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
2947 ; GFX8-NEXT: v_add_f32_e32 v0, v1, v2
2948 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
2949 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2950 ; GFX8-NEXT: buffer_wbinvl1
2951 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
2952 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2953 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
2954 ; GFX8-NEXT: s_cbranch_execnz .LBB14_1
2955 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
2956 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
2957 ; GFX8-NEXT: s_setpc_b64 s[30:31]
2959 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
2961 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2962 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0xfffff800, v0
2963 ; GFX7-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
2964 ; GFX7-NEXT: flat_load_dword v0, v[3:4]
2965 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
2966 ; GFX7-NEXT: .LBB14_1: ; %atomicrmw.start
2967 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
2968 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2969 ; GFX7-NEXT: v_mov_b32_e32 v1, v0
2970 ; GFX7-NEXT: v_add_f32_e32 v0, v1, v2
2971 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
2972 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2973 ; GFX7-NEXT: buffer_wbinvl1
2974 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
2975 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
2976 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
2977 ; GFX7-NEXT: s_cbranch_execnz .LBB14_1
2978 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
2979 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
2980 ; GFX7-NEXT: s_setpc_b64 s[30:31]
2981 %gep = getelementptr float, ptr %ptr, i64 -512
2982 %result = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
2986 define void @flat_agent_atomic_fadd_noret_f32__ftz__amdgpu_no_fine_grained_memory(ptr %ptr, float %val) #1 {
2987 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__ftz__amdgpu_no_fine_grained_memory:
2989 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
2990 ; GFX12-NEXT: s_wait_expcnt 0x0
2991 ; GFX12-NEXT: s_wait_samplecnt 0x0
2992 ; GFX12-NEXT: s_wait_bvhcnt 0x0
2993 ; GFX12-NEXT: s_wait_kmcnt 0x0
2994 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
2995 ; GFX12-NEXT: s_wait_storecnt 0x0
2996 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 scope:SCOPE_DEV
2997 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
2998 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
2999 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3001 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__ftz__amdgpu_no_fine_grained_memory:
3003 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3004 ; GFX940-NEXT: buffer_wbl2 sc1
3005 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2
3006 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3007 ; GFX940-NEXT: buffer_inv sc1
3008 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3010 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__ftz__amdgpu_no_fine_grained_memory:
3012 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3013 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3014 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2
3015 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
3016 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3017 ; GFX11-NEXT: buffer_gl1_inv
3018 ; GFX11-NEXT: buffer_gl0_inv
3019 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3021 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__ftz__amdgpu_no_fine_grained_memory:
3023 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3024 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
3025 ; GFX10-NEXT: s_mov_b32 s4, 0
3026 ; GFX10-NEXT: .LBB15_1: ; %atomicrmw.start
3027 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
3028 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3029 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
3030 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3031 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3032 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3033 ; GFX10-NEXT: buffer_gl1_inv
3034 ; GFX10-NEXT: buffer_gl0_inv
3035 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
3036 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
3037 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
3038 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
3039 ; GFX10-NEXT: s_cbranch_execnz .LBB15_1
3040 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
3041 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
3042 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3044 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__ftz__amdgpu_no_fine_grained_memory:
3045 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
3046 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3047 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
3048 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
3049 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
3050 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
3051 ; GFX90A-NEXT: s_cbranch_execnz .LBB15_3
3052 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
3053 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3054 ; GFX90A-NEXT: s_cbranch_execnz .LBB15_8
3055 ; GFX90A-NEXT: .LBB15_2: ; %atomicrmw.phi
3056 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3057 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3058 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3059 ; GFX90A-NEXT: .LBB15_3: ; %atomicrmw.check.private
3060 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
3061 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
3062 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
3063 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
3064 ; GFX90A-NEXT: s_cbranch_execz .LBB15_5
3065 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
3066 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
3067 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3068 ; GFX90A-NEXT: buffer_wbinvl1
3069 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
3070 ; GFX90A-NEXT: ; implicit-def: $vgpr2
3071 ; GFX90A-NEXT: .LBB15_5: ; %Flow
3072 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
3073 ; GFX90A-NEXT: s_cbranch_execz .LBB15_7
3074 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
3075 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3076 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3077 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
3078 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3079 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
3080 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
3081 ; GFX90A-NEXT: .LBB15_7: ; %Flow1
3082 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
3083 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
3084 ; GFX90A-NEXT: ; implicit-def: $vgpr2
3085 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3086 ; GFX90A-NEXT: s_cbranch_execz .LBB15_2
3087 ; GFX90A-NEXT: .LBB15_8: ; %atomicrmw.shared
3088 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3089 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3090 ; GFX90A-NEXT: ds_add_f32 v0, v2
3091 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
3092 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3093 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3094 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3096 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__ftz__amdgpu_no_fine_grained_memory:
3097 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
3098 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3099 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
3100 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
3101 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
3102 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
3103 ; GFX908-NEXT: s_cbranch_execnz .LBB15_3
3104 ; GFX908-NEXT: ; %bb.1: ; %Flow2
3105 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3106 ; GFX908-NEXT: s_cbranch_execnz .LBB15_8
3107 ; GFX908-NEXT: .LBB15_2: ; %atomicrmw.phi
3108 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3109 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3110 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3111 ; GFX908-NEXT: .LBB15_3: ; %atomicrmw.check.private
3112 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
3113 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
3114 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
3115 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
3116 ; GFX908-NEXT: s_cbranch_execz .LBB15_5
3117 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
3118 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
3119 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3120 ; GFX908-NEXT: buffer_wbinvl1
3121 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
3122 ; GFX908-NEXT: ; implicit-def: $vgpr2
3123 ; GFX908-NEXT: .LBB15_5: ; %Flow
3124 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
3125 ; GFX908-NEXT: s_cbranch_execz .LBB15_7
3126 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
3127 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3128 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3129 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
3130 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3131 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
3132 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
3133 ; GFX908-NEXT: .LBB15_7: ; %Flow1
3134 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
3135 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
3136 ; GFX908-NEXT: ; implicit-def: $vgpr2
3137 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3138 ; GFX908-NEXT: s_cbranch_execz .LBB15_2
3139 ; GFX908-NEXT: .LBB15_8: ; %atomicrmw.shared
3140 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3141 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3142 ; GFX908-NEXT: ds_add_f32 v0, v2
3143 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
3144 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3145 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3146 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3148 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__ftz__amdgpu_no_fine_grained_memory:
3150 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3151 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
3152 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3153 ; GFX8-NEXT: .LBB15_1: ; %atomicrmw.start
3154 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3155 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3156 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
3157 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3158 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3159 ; GFX8-NEXT: buffer_wbinvl1
3160 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3161 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3162 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
3163 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3164 ; GFX8-NEXT: s_cbranch_execnz .LBB15_1
3165 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3166 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3167 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3169 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__ftz__amdgpu_no_fine_grained_memory:
3171 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3172 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
3173 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
3174 ; GFX7-NEXT: .LBB15_1: ; %atomicrmw.start
3175 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
3176 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3177 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
3178 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3179 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3180 ; GFX7-NEXT: buffer_wbinvl1
3181 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3182 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3183 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
3184 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
3185 ; GFX7-NEXT: s_cbranch_execnz .LBB15_1
3186 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
3187 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
3188 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3189 %unused = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
3193 define void @flat_agent_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory(ptr %ptr, float %val) #1 {
3194 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3196 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3197 ; GFX12-NEXT: s_wait_expcnt 0x0
3198 ; GFX12-NEXT: s_wait_samplecnt 0x0
3199 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3200 ; GFX12-NEXT: s_wait_kmcnt 0x0
3201 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
3202 ; GFX12-NEXT: s_wait_storecnt 0x0
3203 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044 scope:SCOPE_DEV
3204 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
3205 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
3206 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3208 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3210 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3211 ; GFX940-NEXT: buffer_wbl2 sc1
3212 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
3213 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3214 ; GFX940-NEXT: buffer_inv sc1
3215 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3217 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3219 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3220 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3221 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044
3222 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
3223 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3224 ; GFX11-NEXT: buffer_gl1_inv
3225 ; GFX11-NEXT: buffer_gl0_inv
3226 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3228 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3230 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3231 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
3232 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
3233 ; GFX10-NEXT: s_mov_b32 s4, 0
3234 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
3235 ; GFX10-NEXT: .LBB16_1: ; %atomicrmw.start
3236 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
3237 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3238 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
3239 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3240 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3241 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3242 ; GFX10-NEXT: buffer_gl1_inv
3243 ; GFX10-NEXT: buffer_gl0_inv
3244 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
3245 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
3246 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
3247 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
3248 ; GFX10-NEXT: s_cbranch_execnz .LBB16_1
3249 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
3250 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
3251 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3253 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3254 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
3255 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3256 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
3257 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
3258 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
3259 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
3260 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
3261 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
3262 ; GFX90A-NEXT: s_cbranch_execnz .LBB16_3
3263 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
3264 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3265 ; GFX90A-NEXT: s_cbranch_execnz .LBB16_8
3266 ; GFX90A-NEXT: .LBB16_2: ; %atomicrmw.phi
3267 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3268 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3269 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3270 ; GFX90A-NEXT: .LBB16_3: ; %atomicrmw.check.private
3271 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
3272 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
3273 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
3274 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
3275 ; GFX90A-NEXT: s_cbranch_execz .LBB16_5
3276 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
3277 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
3278 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3279 ; GFX90A-NEXT: buffer_wbinvl1
3280 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
3281 ; GFX90A-NEXT: ; implicit-def: $vgpr2
3282 ; GFX90A-NEXT: .LBB16_5: ; %Flow
3283 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
3284 ; GFX90A-NEXT: s_cbranch_execz .LBB16_7
3285 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
3286 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3287 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3288 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
3289 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3290 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
3291 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
3292 ; GFX90A-NEXT: .LBB16_7: ; %Flow1
3293 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
3294 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
3295 ; GFX90A-NEXT: ; implicit-def: $vgpr2
3296 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3297 ; GFX90A-NEXT: s_cbranch_execz .LBB16_2
3298 ; GFX90A-NEXT: .LBB16_8: ; %atomicrmw.shared
3299 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3300 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3301 ; GFX90A-NEXT: ds_add_f32 v0, v2
3302 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
3303 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3304 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3305 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3307 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3308 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
3309 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3310 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0x7fc, v0
3311 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
3312 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
3313 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
3314 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
3315 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
3316 ; GFX908-NEXT: s_cbranch_execnz .LBB16_3
3317 ; GFX908-NEXT: ; %bb.1: ; %Flow2
3318 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3319 ; GFX908-NEXT: s_cbranch_execnz .LBB16_8
3320 ; GFX908-NEXT: .LBB16_2: ; %atomicrmw.phi
3321 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3322 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3323 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3324 ; GFX908-NEXT: .LBB16_3: ; %atomicrmw.check.private
3325 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
3326 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
3327 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
3328 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
3329 ; GFX908-NEXT: s_cbranch_execz .LBB16_5
3330 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
3331 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
3332 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3333 ; GFX908-NEXT: buffer_wbinvl1
3334 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
3335 ; GFX908-NEXT: ; implicit-def: $vgpr2
3336 ; GFX908-NEXT: .LBB16_5: ; %Flow
3337 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
3338 ; GFX908-NEXT: s_cbranch_execz .LBB16_7
3339 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
3340 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3341 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3342 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
3343 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3344 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
3345 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
3346 ; GFX908-NEXT: .LBB16_7: ; %Flow1
3347 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
3348 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
3349 ; GFX908-NEXT: ; implicit-def: $vgpr2
3350 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3351 ; GFX908-NEXT: s_cbranch_execz .LBB16_2
3352 ; GFX908-NEXT: .LBB16_8: ; %atomicrmw.shared
3353 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3354 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3355 ; GFX908-NEXT: ds_add_f32 v0, v2
3356 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
3357 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3358 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3359 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3361 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3363 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3364 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
3365 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
3366 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
3367 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3368 ; GFX8-NEXT: .LBB16_1: ; %atomicrmw.start
3369 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3370 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3371 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
3372 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3373 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3374 ; GFX8-NEXT: buffer_wbinvl1
3375 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3376 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3377 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
3378 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3379 ; GFX8-NEXT: s_cbranch_execnz .LBB16_1
3380 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3381 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3382 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3384 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3386 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3387 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
3388 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
3389 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
3390 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
3391 ; GFX7-NEXT: .LBB16_1: ; %atomicrmw.start
3392 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
3393 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3394 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
3395 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3396 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3397 ; GFX7-NEXT: buffer_wbinvl1
3398 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3399 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3400 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
3401 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
3402 ; GFX7-NEXT: s_cbranch_execnz .LBB16_1
3403 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
3404 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
3405 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3406 %gep = getelementptr float, ptr %ptr, i64 511
3407 %unused = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
3411 define void @flat_agent_atomic_fadd_noret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory(ptr %ptr, float %val) #1 {
3412 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
3414 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3415 ; GFX12-NEXT: s_wait_expcnt 0x0
3416 ; GFX12-NEXT: s_wait_samplecnt 0x0
3417 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3418 ; GFX12-NEXT: s_wait_kmcnt 0x0
3419 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
3420 ; GFX12-NEXT: s_wait_storecnt 0x0
3421 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:-2048 scope:SCOPE_DEV
3422 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
3423 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
3424 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3426 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
3428 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3429 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
3430 ; GFX940-NEXT: s_nop 1
3431 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
3432 ; GFX940-NEXT: buffer_wbl2 sc1
3433 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2
3434 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3435 ; GFX940-NEXT: buffer_inv sc1
3436 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3438 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
3440 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3441 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
3442 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
3443 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3444 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2
3445 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
3446 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3447 ; GFX11-NEXT: buffer_gl1_inv
3448 ; GFX11-NEXT: buffer_gl0_inv
3449 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3451 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
3453 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3454 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
3455 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
3456 ; GFX10-NEXT: s_mov_b32 s4, 0
3457 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
3458 ; GFX10-NEXT: .LBB17_1: ; %atomicrmw.start
3459 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
3460 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3461 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
3462 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3463 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3464 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3465 ; GFX10-NEXT: buffer_gl1_inv
3466 ; GFX10-NEXT: buffer_gl0_inv
3467 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
3468 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
3469 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
3470 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
3471 ; GFX10-NEXT: s_cbranch_execnz .LBB17_1
3472 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
3473 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
3474 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3476 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
3477 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
3478 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3479 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
3480 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
3481 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
3482 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
3483 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
3484 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
3485 ; GFX90A-NEXT: s_cbranch_execnz .LBB17_3
3486 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
3487 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3488 ; GFX90A-NEXT: s_cbranch_execnz .LBB17_8
3489 ; GFX90A-NEXT: .LBB17_2: ; %atomicrmw.phi
3490 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3491 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3492 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3493 ; GFX90A-NEXT: .LBB17_3: ; %atomicrmw.check.private
3494 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
3495 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
3496 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
3497 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
3498 ; GFX90A-NEXT: s_cbranch_execz .LBB17_5
3499 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
3500 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
3501 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3502 ; GFX90A-NEXT: buffer_wbinvl1
3503 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
3504 ; GFX90A-NEXT: ; implicit-def: $vgpr2
3505 ; GFX90A-NEXT: .LBB17_5: ; %Flow
3506 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
3507 ; GFX90A-NEXT: s_cbranch_execz .LBB17_7
3508 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
3509 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3510 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3511 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
3512 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3513 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
3514 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
3515 ; GFX90A-NEXT: .LBB17_7: ; %Flow1
3516 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
3517 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
3518 ; GFX90A-NEXT: ; implicit-def: $vgpr2
3519 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3520 ; GFX90A-NEXT: s_cbranch_execz .LBB17_2
3521 ; GFX90A-NEXT: .LBB17_8: ; %atomicrmw.shared
3522 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3523 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3524 ; GFX90A-NEXT: ds_add_f32 v0, v2
3525 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
3526 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3527 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
3528 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3530 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
3531 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
3532 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3533 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
3534 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
3535 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
3536 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
3537 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
3538 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
3539 ; GFX908-NEXT: s_cbranch_execnz .LBB17_3
3540 ; GFX908-NEXT: ; %bb.1: ; %Flow2
3541 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3542 ; GFX908-NEXT: s_cbranch_execnz .LBB17_8
3543 ; GFX908-NEXT: .LBB17_2: ; %atomicrmw.phi
3544 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3545 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3546 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3547 ; GFX908-NEXT: .LBB17_3: ; %atomicrmw.check.private
3548 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
3549 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
3550 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
3551 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
3552 ; GFX908-NEXT: s_cbranch_execz .LBB17_5
3553 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
3554 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
3555 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3556 ; GFX908-NEXT: buffer_wbinvl1
3557 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
3558 ; GFX908-NEXT: ; implicit-def: $vgpr2
3559 ; GFX908-NEXT: .LBB17_5: ; %Flow
3560 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
3561 ; GFX908-NEXT: s_cbranch_execz .LBB17_7
3562 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
3563 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3564 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3565 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
3566 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3567 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
3568 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
3569 ; GFX908-NEXT: .LBB17_7: ; %Flow1
3570 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
3571 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
3572 ; GFX908-NEXT: ; implicit-def: $vgpr2
3573 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
3574 ; GFX908-NEXT: s_cbranch_execz .LBB17_2
3575 ; GFX908-NEXT: .LBB17_8: ; %atomicrmw.shared
3576 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
3577 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
3578 ; GFX908-NEXT: ds_add_f32 v0, v2
3579 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
3580 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3581 ; GFX908-NEXT: s_waitcnt vmcnt(0)
3582 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3584 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
3586 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3587 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff800, v0
3588 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
3589 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
3590 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3591 ; GFX8-NEXT: .LBB17_1: ; %atomicrmw.start
3592 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3593 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3594 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
3595 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3596 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3597 ; GFX8-NEXT: buffer_wbinvl1
3598 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3599 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3600 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
3601 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3602 ; GFX8-NEXT: s_cbranch_execnz .LBB17_1
3603 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3604 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3605 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3607 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__offset12b_neg__ftz__amdgpu_no_fine_grained_memory:
3609 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3610 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0xfffff800, v0
3611 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
3612 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
3613 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
3614 ; GFX7-NEXT: .LBB17_1: ; %atomicrmw.start
3615 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
3616 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3617 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
3618 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3619 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3620 ; GFX7-NEXT: buffer_wbinvl1
3621 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3622 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3623 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
3624 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
3625 ; GFX7-NEXT: s_cbranch_execnz .LBB17_1
3626 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
3627 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
3628 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3629 %gep = getelementptr float, ptr %ptr, i64 -512
3630 %unused = atomicrmw fadd ptr %gep, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
3634 define float @flat_system_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory(ptr %ptr, float %val) #1 {
3635 ; GFX12-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3637 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3638 ; GFX12-NEXT: s_wait_expcnt 0x0
3639 ; GFX12-NEXT: s_wait_samplecnt 0x0
3640 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3641 ; GFX12-NEXT: s_wait_kmcnt 0x0
3642 ; GFX12-NEXT: flat_load_b32 v3, v[0:1] offset:2044
3643 ; GFX12-NEXT: s_mov_b32 s0, 0
3644 ; GFX12-NEXT: .LBB18_1: ; %atomicrmw.start
3645 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3646 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3647 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
3648 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
3649 ; GFX12-NEXT: v_add_f32_e32 v3, v4, v2
3650 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
3651 ; GFX12-NEXT: s_wait_storecnt 0x0
3652 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
3653 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3654 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
3655 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
3656 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3657 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3658 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3659 ; GFX12-NEXT: s_cbranch_execnz .LBB18_1
3660 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3661 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3662 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
3663 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3665 ; GFX940-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3667 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3668 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
3669 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:2044 sc0 sc1
3670 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3671 ; GFX940-NEXT: buffer_inv sc0 sc1
3672 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3674 ; GFX11-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3676 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3677 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2044
3678 ; GFX11-NEXT: s_mov_b32 s0, 0
3679 ; GFX11-NEXT: .LBB18_1: ; %atomicrmw.start
3680 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
3681 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3682 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
3683 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
3684 ; GFX11-NEXT: v_add_f32_e32 v3, v4, v2
3685 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3686 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
3687 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3688 ; GFX11-NEXT: buffer_gl1_inv
3689 ; GFX11-NEXT: buffer_gl0_inv
3690 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
3691 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3692 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3693 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3694 ; GFX11-NEXT: s_cbranch_execnz .LBB18_1
3695 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3696 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3697 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
3698 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3700 ; GFX10-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3702 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3703 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fc, v0
3704 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
3705 ; GFX10-NEXT: s_mov_b32 s4, 0
3706 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
3707 ; GFX10-NEXT: .LBB18_1: ; %atomicrmw.start
3708 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
3709 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3710 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
3711 ; GFX10-NEXT: v_add_f32_e32 v0, v1, v2
3712 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3713 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
3714 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3715 ; GFX10-NEXT: buffer_gl1_inv
3716 ; GFX10-NEXT: buffer_gl0_inv
3717 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
3718 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
3719 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
3720 ; GFX10-NEXT: s_cbranch_execnz .LBB18_1
3721 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
3722 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
3723 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3725 ; GFX90A-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3727 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3728 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2044
3729 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
3730 ; GFX90A-NEXT: .LBB18_1: ; %atomicrmw.start
3731 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
3732 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3733 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
3734 ; GFX90A-NEXT: v_add_f32_e32 v4, v5, v2
3735 ; GFX90A-NEXT: buffer_wbl2
3736 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
3737 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3738 ; GFX90A-NEXT: buffer_invl2
3739 ; GFX90A-NEXT: buffer_wbinvl1
3740 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
3741 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3742 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
3743 ; GFX90A-NEXT: s_cbranch_execnz .LBB18_1
3744 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
3745 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3746 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
3747 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3749 ; GFX908-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3751 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3752 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
3753 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3754 ; GFX908-NEXT: .LBB18_1: ; %atomicrmw.start
3755 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3756 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3757 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
3758 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
3759 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
3760 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3761 ; GFX908-NEXT: buffer_wbinvl1
3762 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3763 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3764 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3765 ; GFX908-NEXT: s_cbranch_execnz .LBB18_1
3766 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3767 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3768 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
3769 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3771 ; GFX8-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3773 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3774 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
3775 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
3776 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
3777 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3778 ; GFX8-NEXT: .LBB18_1: ; %atomicrmw.start
3779 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3780 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3781 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
3782 ; GFX8-NEXT: v_add_f32_e32 v0, v1, v2
3783 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
3784 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3785 ; GFX8-NEXT: buffer_wbinvl1
3786 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
3787 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3788 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3789 ; GFX8-NEXT: s_cbranch_execnz .LBB18_1
3790 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3791 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3792 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3794 ; GFX7-LABEL: flat_system_atomic_fadd_ret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3796 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3797 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0x7fc, v0
3798 ; GFX7-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
3799 ; GFX7-NEXT: flat_load_dword v0, v[3:4]
3800 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
3801 ; GFX7-NEXT: .LBB18_1: ; %atomicrmw.start
3802 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
3803 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3804 ; GFX7-NEXT: v_mov_b32_e32 v1, v0
3805 ; GFX7-NEXT: v_add_f32_e32 v0, v1, v2
3806 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
3807 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3808 ; GFX7-NEXT: buffer_wbinvl1
3809 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
3810 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3811 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
3812 ; GFX7-NEXT: s_cbranch_execnz .LBB18_1
3813 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
3814 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
3815 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3816 %gep = getelementptr float, ptr %ptr, i64 511
3817 %result = atomicrmw fadd ptr %gep, float %val seq_cst, !amdgpu.no.fine.grained.memory !0
3821 define void @flat_system_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory(ptr %ptr, float %val) #1 {
3822 ; GFX12-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3824 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3825 ; GFX12-NEXT: s_wait_expcnt 0x0
3826 ; GFX12-NEXT: s_wait_samplecnt 0x0
3827 ; GFX12-NEXT: s_wait_bvhcnt 0x0
3828 ; GFX12-NEXT: s_wait_kmcnt 0x0
3829 ; GFX12-NEXT: flat_load_b32 v4, v[0:1] offset:2044
3830 ; GFX12-NEXT: s_mov_b32 s0, 0
3831 ; GFX12-NEXT: .LBB19_1: ; %atomicrmw.start
3832 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
3833 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3834 ; GFX12-NEXT: v_add_f32_e32 v3, v4, v2
3835 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
3836 ; GFX12-NEXT: s_wait_storecnt 0x0
3837 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
3838 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
3839 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
3840 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
3841 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
3842 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
3843 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3844 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3845 ; GFX12-NEXT: s_cbranch_execnz .LBB19_1
3846 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
3847 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
3848 ; GFX12-NEXT: s_setpc_b64 s[30:31]
3850 ; GFX940-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3852 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3853 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
3854 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044 sc1
3855 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3856 ; GFX940-NEXT: buffer_inv sc0 sc1
3857 ; GFX940-NEXT: s_setpc_b64 s[30:31]
3859 ; GFX11-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3861 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3862 ; GFX11-NEXT: flat_load_b32 v4, v[0:1] offset:2044
3863 ; GFX11-NEXT: s_mov_b32 s0, 0
3864 ; GFX11-NEXT: .LBB19_1: ; %atomicrmw.start
3865 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
3866 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3867 ; GFX11-NEXT: v_add_f32_e32 v3, v4, v2
3868 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
3869 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
3870 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3871 ; GFX11-NEXT: buffer_gl1_inv
3872 ; GFX11-NEXT: buffer_gl0_inv
3873 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
3874 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
3875 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3876 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
3877 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
3878 ; GFX11-NEXT: s_cbranch_execnz .LBB19_1
3879 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
3880 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
3881 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3883 ; GFX10-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3885 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3886 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
3887 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
3888 ; GFX10-NEXT: s_mov_b32 s4, 0
3889 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
3890 ; GFX10-NEXT: .LBB19_1: ; %atomicrmw.start
3891 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
3892 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3893 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
3894 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
3895 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3896 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3897 ; GFX10-NEXT: buffer_gl1_inv
3898 ; GFX10-NEXT: buffer_gl0_inv
3899 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
3900 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
3901 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
3902 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
3903 ; GFX10-NEXT: s_cbranch_execnz .LBB19_1
3904 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
3905 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
3906 ; GFX10-NEXT: s_setpc_b64 s[30:31]
3908 ; GFX90A-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3910 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3911 ; GFX90A-NEXT: flat_load_dword v5, v[0:1] offset:2044
3912 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
3913 ; GFX90A-NEXT: .LBB19_1: ; %atomicrmw.start
3914 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
3915 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3916 ; GFX90A-NEXT: v_add_f32_e32 v4, v5, v2
3917 ; GFX90A-NEXT: buffer_wbl2
3918 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
3919 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3920 ; GFX90A-NEXT: buffer_invl2
3921 ; GFX90A-NEXT: buffer_wbinvl1
3922 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
3923 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3924 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
3925 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
3926 ; GFX90A-NEXT: s_cbranch_execnz .LBB19_1
3927 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
3928 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
3929 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
3931 ; GFX908-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3933 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3934 ; GFX908-NEXT: flat_load_dword v4, v[0:1] offset:2044
3935 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
3936 ; GFX908-NEXT: .LBB19_1: ; %atomicrmw.start
3937 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
3938 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3939 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
3940 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
3941 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3942 ; GFX908-NEXT: buffer_wbinvl1
3943 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3944 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3945 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
3946 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
3947 ; GFX908-NEXT: s_cbranch_execnz .LBB19_1
3948 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
3949 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
3950 ; GFX908-NEXT: s_setpc_b64 s[30:31]
3952 ; GFX8-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3954 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3955 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
3956 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
3957 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
3958 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
3959 ; GFX8-NEXT: .LBB19_1: ; %atomicrmw.start
3960 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
3961 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3962 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
3963 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3964 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3965 ; GFX8-NEXT: buffer_wbinvl1
3966 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3967 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3968 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
3969 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
3970 ; GFX8-NEXT: s_cbranch_execnz .LBB19_1
3971 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
3972 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
3973 ; GFX8-NEXT: s_setpc_b64 s[30:31]
3975 ; GFX7-LABEL: flat_system_atomic_fadd_noret_f32__offset12b_pos__ftz__amdgpu_no_fine_grained_memory:
3977 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3978 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
3979 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
3980 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
3981 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
3982 ; GFX7-NEXT: .LBB19_1: ; %atomicrmw.start
3983 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
3984 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3985 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
3986 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
3987 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3988 ; GFX7-NEXT: buffer_wbinvl1
3989 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
3990 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
3991 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
3992 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
3993 ; GFX7-NEXT: s_cbranch_execnz .LBB19_1
3994 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
3995 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
3996 ; GFX7-NEXT: s_setpc_b64 s[30:31]
3997 %gep = getelementptr float, ptr %ptr, i64 511
3998 %unused = atomicrmw fadd ptr %gep, float %val seq_cst, !amdgpu.no.fine.grained.memory !0
4002 define float @flat_agent_atomic_fadd_ret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
4003 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4005 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4006 ; GFX12-NEXT: s_wait_expcnt 0x0
4007 ; GFX12-NEXT: s_wait_samplecnt 0x0
4008 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4009 ; GFX12-NEXT: s_wait_kmcnt 0x0
4010 ; GFX12-NEXT: flat_load_b32 v3, v[0:1] offset:2044
4011 ; GFX12-NEXT: s_mov_b32 s0, 0
4012 ; GFX12-NEXT: .LBB20_1: ; %atomicrmw.start
4013 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
4014 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4015 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
4016 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
4017 ; GFX12-NEXT: v_add_f32_e32 v3, v4, v2
4018 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
4019 ; GFX12-NEXT: s_wait_storecnt 0x0
4020 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
4021 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4022 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
4023 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
4024 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
4025 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4026 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4027 ; GFX12-NEXT: s_cbranch_execnz .LBB20_1
4028 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
4029 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
4030 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
4031 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4033 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4035 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4036 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
4037 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 offset:2044 sc0 sc1
4038 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4039 ; GFX940-NEXT: buffer_inv sc0 sc1
4040 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4042 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4044 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4045 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2044
4046 ; GFX11-NEXT: s_mov_b32 s0, 0
4047 ; GFX11-NEXT: .LBB20_1: ; %atomicrmw.start
4048 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
4049 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4050 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
4051 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
4052 ; GFX11-NEXT: v_add_f32_e32 v3, v4, v2
4053 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4054 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
4055 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4056 ; GFX11-NEXT: buffer_gl1_inv
4057 ; GFX11-NEXT: buffer_gl0_inv
4058 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
4059 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
4060 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4061 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4062 ; GFX11-NEXT: s_cbranch_execnz .LBB20_1
4063 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
4064 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
4065 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
4066 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4068 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4070 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4071 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fc, v0
4072 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
4073 ; GFX10-NEXT: s_mov_b32 s4, 0
4074 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
4075 ; GFX10-NEXT: .LBB20_1: ; %atomicrmw.start
4076 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4077 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4078 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
4079 ; GFX10-NEXT: v_add_f32_e32 v0, v1, v2
4080 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4081 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
4082 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4083 ; GFX10-NEXT: buffer_gl1_inv
4084 ; GFX10-NEXT: buffer_gl0_inv
4085 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
4086 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4087 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4088 ; GFX10-NEXT: s_cbranch_execnz .LBB20_1
4089 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4090 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4091 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4093 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4095 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4096 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2044
4097 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
4098 ; GFX90A-NEXT: .LBB20_1: ; %atomicrmw.start
4099 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
4100 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4101 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
4102 ; GFX90A-NEXT: v_add_f32_e32 v4, v5, v2
4103 ; GFX90A-NEXT: buffer_wbl2
4104 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
4105 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4106 ; GFX90A-NEXT: buffer_invl2
4107 ; GFX90A-NEXT: buffer_wbinvl1
4108 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
4109 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4110 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
4111 ; GFX90A-NEXT: s_cbranch_execnz .LBB20_1
4112 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
4113 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4114 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
4115 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4117 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4119 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4120 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
4121 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4122 ; GFX908-NEXT: .LBB20_1: ; %atomicrmw.start
4123 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4124 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4125 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
4126 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
4127 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
4128 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4129 ; GFX908-NEXT: buffer_wbinvl1
4130 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4131 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4132 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4133 ; GFX908-NEXT: s_cbranch_execnz .LBB20_1
4134 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4135 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4136 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
4137 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4139 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4141 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4142 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
4143 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
4144 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
4145 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4146 ; GFX8-NEXT: .LBB20_1: ; %atomicrmw.start
4147 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4148 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4149 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
4150 ; GFX8-NEXT: v_add_f32_e32 v0, v1, v2
4151 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
4152 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4153 ; GFX8-NEXT: buffer_wbinvl1
4154 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
4155 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4156 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4157 ; GFX8-NEXT: s_cbranch_execnz .LBB20_1
4158 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4159 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4160 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4162 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4164 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4165 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0x7fc, v0
4166 ; GFX7-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
4167 ; GFX7-NEXT: flat_load_dword v0, v[3:4]
4168 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
4169 ; GFX7-NEXT: .LBB20_1: ; %atomicrmw.start
4170 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4171 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4172 ; GFX7-NEXT: v_mov_b32_e32 v1, v0
4173 ; GFX7-NEXT: v_add_f32_e32 v0, v1, v2
4174 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
4175 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4176 ; GFX7-NEXT: buffer_wbinvl1
4177 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
4178 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4179 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
4180 ; GFX7-NEXT: s_cbranch_execnz .LBB20_1
4181 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4182 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
4183 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4184 %gep = getelementptr float, ptr %ptr, i64 511
4185 %result = atomicrmw fadd ptr %gep, float %val seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
4189 define void @flat_agent_atomic_fadd_noret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
4190 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4192 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4193 ; GFX12-NEXT: s_wait_expcnt 0x0
4194 ; GFX12-NEXT: s_wait_samplecnt 0x0
4195 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4196 ; GFX12-NEXT: s_wait_kmcnt 0x0
4197 ; GFX12-NEXT: flat_load_b32 v4, v[0:1] offset:2044
4198 ; GFX12-NEXT: s_mov_b32 s0, 0
4199 ; GFX12-NEXT: .LBB21_1: ; %atomicrmw.start
4200 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
4201 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4202 ; GFX12-NEXT: v_add_f32_e32 v3, v4, v2
4203 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
4204 ; GFX12-NEXT: s_wait_storecnt 0x0
4205 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
4206 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4207 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
4208 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
4209 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
4210 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
4211 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4212 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4213 ; GFX12-NEXT: s_cbranch_execnz .LBB21_1
4214 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
4215 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
4216 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4218 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4220 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4221 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
4222 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2 offset:2044 sc1
4223 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4224 ; GFX940-NEXT: buffer_inv sc0 sc1
4225 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4227 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4229 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4230 ; GFX11-NEXT: flat_load_b32 v4, v[0:1] offset:2044
4231 ; GFX11-NEXT: s_mov_b32 s0, 0
4232 ; GFX11-NEXT: .LBB21_1: ; %atomicrmw.start
4233 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
4234 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4235 ; GFX11-NEXT: v_add_f32_e32 v3, v4, v2
4236 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4237 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
4238 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4239 ; GFX11-NEXT: buffer_gl1_inv
4240 ; GFX11-NEXT: buffer_gl0_inv
4241 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
4242 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
4243 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
4244 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
4245 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
4246 ; GFX11-NEXT: s_cbranch_execnz .LBB21_1
4247 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
4248 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
4249 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4251 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4253 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4254 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
4255 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
4256 ; GFX10-NEXT: s_mov_b32 s4, 0
4257 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
4258 ; GFX10-NEXT: .LBB21_1: ; %atomicrmw.start
4259 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4260 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4261 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
4262 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4263 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4264 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4265 ; GFX10-NEXT: buffer_gl1_inv
4266 ; GFX10-NEXT: buffer_gl0_inv
4267 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
4268 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
4269 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4270 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4271 ; GFX10-NEXT: s_cbranch_execnz .LBB21_1
4272 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4273 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4274 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4276 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4278 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4279 ; GFX90A-NEXT: flat_load_dword v5, v[0:1] offset:2044
4280 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
4281 ; GFX90A-NEXT: .LBB21_1: ; %atomicrmw.start
4282 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
4283 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4284 ; GFX90A-NEXT: v_add_f32_e32 v4, v5, v2
4285 ; GFX90A-NEXT: buffer_wbl2
4286 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
4287 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4288 ; GFX90A-NEXT: buffer_invl2
4289 ; GFX90A-NEXT: buffer_wbinvl1
4290 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
4291 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4292 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
4293 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
4294 ; GFX90A-NEXT: s_cbranch_execnz .LBB21_1
4295 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
4296 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4297 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4299 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4301 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4302 ; GFX908-NEXT: flat_load_dword v4, v[0:1] offset:2044
4303 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4304 ; GFX908-NEXT: .LBB21_1: ; %atomicrmw.start
4305 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4306 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4307 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
4308 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
4309 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4310 ; GFX908-NEXT: buffer_wbinvl1
4311 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4312 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4313 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
4314 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4315 ; GFX908-NEXT: s_cbranch_execnz .LBB21_1
4316 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4317 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4318 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4320 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4322 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4323 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
4324 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
4325 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
4326 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4327 ; GFX8-NEXT: .LBB21_1: ; %atomicrmw.start
4328 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4329 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4330 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
4331 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4332 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4333 ; GFX8-NEXT: buffer_wbinvl1
4334 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4335 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4336 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
4337 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4338 ; GFX8-NEXT: s_cbranch_execnz .LBB21_1
4339 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4340 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4341 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4343 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__ieee__amdgpu_no_fine_grained_memory__amdgpu_ignore_denormal_mode:
4345 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4346 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
4347 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
4348 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
4349 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
4350 ; GFX7-NEXT: .LBB21_1: ; %atomicrmw.start
4351 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4352 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4353 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
4354 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4355 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4356 ; GFX7-NEXT: buffer_wbinvl1
4357 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4358 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4359 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
4360 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
4361 ; GFX7-NEXT: s_cbranch_execnz .LBB21_1
4362 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4363 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
4364 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4365 %gep = getelementptr float, ptr %ptr, i64 511
4366 %unused = atomicrmw fadd ptr %gep, float %val seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
4370 define float @flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
4371 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4373 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4374 ; GFX12-NEXT: s_wait_expcnt 0x0
4375 ; GFX12-NEXT: s_wait_samplecnt 0x0
4376 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4377 ; GFX12-NEXT: s_wait_kmcnt 0x0
4378 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
4379 ; GFX12-NEXT: s_wait_storecnt 0x0
4380 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
4381 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4382 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
4383 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4385 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4387 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4388 ; GFX940-NEXT: buffer_wbl2 sc1
4389 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 sc0
4390 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4391 ; GFX940-NEXT: buffer_inv sc1
4392 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4394 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4396 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4397 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4398 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 glc
4399 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4400 ; GFX11-NEXT: buffer_gl1_inv
4401 ; GFX11-NEXT: buffer_gl0_inv
4402 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4404 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4406 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4407 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
4408 ; GFX10-NEXT: s_mov_b32 s4, 0
4409 ; GFX10-NEXT: .LBB22_1: ; %atomicrmw.start
4410 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4411 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4412 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
4413 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
4414 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4415 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4416 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4417 ; GFX10-NEXT: buffer_gl1_inv
4418 ; GFX10-NEXT: buffer_gl0_inv
4419 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
4420 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4421 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4422 ; GFX10-NEXT: s_cbranch_execnz .LBB22_1
4423 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4424 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4425 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
4426 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4428 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4430 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4431 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
4432 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
4433 ; GFX90A-NEXT: ; implicit-def: $vgpr3
4434 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
4435 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
4436 ; GFX90A-NEXT: s_cbranch_execz .LBB22_6
4437 ; GFX90A-NEXT: ; %bb.1: ; %atomicrmw.check.private
4438 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
4439 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
4440 ; GFX90A-NEXT: ; implicit-def: $vgpr3
4441 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
4442 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
4443 ; GFX90A-NEXT: s_cbranch_execz .LBB22_3
4444 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.global
4445 ; GFX90A-NEXT: global_atomic_add_f32 v3, v[0:1], v2, off glc
4446 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4447 ; GFX90A-NEXT: buffer_wbinvl1
4448 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
4449 ; GFX90A-NEXT: ; implicit-def: $vgpr2
4450 ; GFX90A-NEXT: .LBB22_3: ; %Flow
4451 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
4452 ; GFX90A-NEXT: s_cbranch_execz .LBB22_5
4453 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.private
4454 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
4455 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
4456 ; GFX90A-NEXT: buffer_load_dword v3, v0, s[0:3], 0 offen
4457 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4458 ; GFX90A-NEXT: v_add_f32_e32 v1, v3, v2
4459 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
4460 ; GFX90A-NEXT: .LBB22_5: ; %Flow1
4461 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
4462 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
4463 ; GFX90A-NEXT: ; implicit-def: $vgpr2
4464 ; GFX90A-NEXT: .LBB22_6: ; %Flow2
4465 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
4466 ; GFX90A-NEXT: s_cbranch_execz .LBB22_8
4467 ; GFX90A-NEXT: ; %bb.7: ; %atomicrmw.shared
4468 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
4469 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
4470 ; GFX90A-NEXT: ds_add_rtn_f32 v3, v0, v2
4471 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4472 ; GFX90A-NEXT: .LBB22_8: ; %atomicrmw.phi
4473 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4474 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
4475 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4476 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4478 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4480 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4481 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
4482 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4483 ; GFX908-NEXT: .LBB22_1: ; %atomicrmw.start
4484 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4485 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4486 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
4487 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
4488 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4489 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4490 ; GFX908-NEXT: buffer_wbinvl1
4491 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4492 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4493 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4494 ; GFX908-NEXT: s_cbranch_execnz .LBB22_1
4495 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4496 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4497 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
4498 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4500 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4502 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4503 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
4504 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4505 ; GFX8-NEXT: .LBB22_1: ; %atomicrmw.start
4506 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4507 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4508 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
4509 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
4510 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4511 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4512 ; GFX8-NEXT: buffer_wbinvl1
4513 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4514 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4515 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4516 ; GFX8-NEXT: s_cbranch_execnz .LBB22_1
4517 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4518 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4519 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
4520 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4522 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4524 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4525 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
4526 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
4527 ; GFX7-NEXT: .LBB22_1: ; %atomicrmw.start
4528 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4529 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4530 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
4531 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
4532 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4533 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4534 ; GFX7-NEXT: buffer_wbinvl1
4535 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4536 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4537 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
4538 ; GFX7-NEXT: s_cbranch_execnz .LBB22_1
4539 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4540 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
4541 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
4542 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4543 %result = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.remote.memory !0, !amdgpu.ignore.denormal.mode !0
4547 define void @flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
4548 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4550 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4551 ; GFX12-NEXT: s_wait_expcnt 0x0
4552 ; GFX12-NEXT: s_wait_samplecnt 0x0
4553 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4554 ; GFX12-NEXT: s_wait_kmcnt 0x0
4555 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
4556 ; GFX12-NEXT: s_wait_storecnt 0x0
4557 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 scope:SCOPE_DEV
4558 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
4559 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
4560 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4562 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4564 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4565 ; GFX940-NEXT: buffer_wbl2 sc1
4566 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2
4567 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4568 ; GFX940-NEXT: buffer_inv sc1
4569 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4571 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4573 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4574 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4575 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2
4576 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4577 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4578 ; GFX11-NEXT: buffer_gl1_inv
4579 ; GFX11-NEXT: buffer_gl0_inv
4580 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4582 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4584 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4585 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
4586 ; GFX10-NEXT: s_mov_b32 s4, 0
4587 ; GFX10-NEXT: .LBB23_1: ; %atomicrmw.start
4588 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4589 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4590 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
4591 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4592 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4593 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4594 ; GFX10-NEXT: buffer_gl1_inv
4595 ; GFX10-NEXT: buffer_gl0_inv
4596 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
4597 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
4598 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4599 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4600 ; GFX10-NEXT: s_cbranch_execnz .LBB23_1
4601 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4602 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4603 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4605 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4606 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
4607 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4608 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
4609 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
4610 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
4611 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
4612 ; GFX90A-NEXT: s_cbranch_execnz .LBB23_3
4613 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
4614 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
4615 ; GFX90A-NEXT: s_cbranch_execnz .LBB23_8
4616 ; GFX90A-NEXT: .LBB23_2: ; %atomicrmw.phi
4617 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4618 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4619 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4620 ; GFX90A-NEXT: .LBB23_3: ; %atomicrmw.check.private
4621 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
4622 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
4623 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
4624 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
4625 ; GFX90A-NEXT: s_cbranch_execz .LBB23_5
4626 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
4627 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
4628 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4629 ; GFX90A-NEXT: buffer_wbinvl1
4630 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
4631 ; GFX90A-NEXT: ; implicit-def: $vgpr2
4632 ; GFX90A-NEXT: .LBB23_5: ; %Flow
4633 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
4634 ; GFX90A-NEXT: s_cbranch_execz .LBB23_7
4635 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
4636 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
4637 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
4638 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
4639 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4640 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
4641 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
4642 ; GFX90A-NEXT: .LBB23_7: ; %Flow1
4643 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
4644 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
4645 ; GFX90A-NEXT: ; implicit-def: $vgpr2
4646 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
4647 ; GFX90A-NEXT: s_cbranch_execz .LBB23_2
4648 ; GFX90A-NEXT: .LBB23_8: ; %atomicrmw.shared
4649 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
4650 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
4651 ; GFX90A-NEXT: ds_add_f32 v0, v2
4652 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4653 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4654 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4655 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4657 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4658 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
4659 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4660 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
4661 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
4662 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
4663 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
4664 ; GFX908-NEXT: s_cbranch_execnz .LBB23_3
4665 ; GFX908-NEXT: ; %bb.1: ; %Flow2
4666 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
4667 ; GFX908-NEXT: s_cbranch_execnz .LBB23_8
4668 ; GFX908-NEXT: .LBB23_2: ; %atomicrmw.phi
4669 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4670 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4671 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4672 ; GFX908-NEXT: .LBB23_3: ; %atomicrmw.check.private
4673 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
4674 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
4675 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
4676 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
4677 ; GFX908-NEXT: s_cbranch_execz .LBB23_5
4678 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
4679 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
4680 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4681 ; GFX908-NEXT: buffer_wbinvl1
4682 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
4683 ; GFX908-NEXT: ; implicit-def: $vgpr2
4684 ; GFX908-NEXT: .LBB23_5: ; %Flow
4685 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
4686 ; GFX908-NEXT: s_cbranch_execz .LBB23_7
4687 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
4688 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
4689 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
4690 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
4691 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4692 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
4693 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
4694 ; GFX908-NEXT: .LBB23_7: ; %Flow1
4695 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
4696 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
4697 ; GFX908-NEXT: ; implicit-def: $vgpr2
4698 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
4699 ; GFX908-NEXT: s_cbranch_execz .LBB23_2
4700 ; GFX908-NEXT: .LBB23_8: ; %atomicrmw.shared
4701 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
4702 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
4703 ; GFX908-NEXT: ds_add_f32 v0, v2
4704 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
4705 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4706 ; GFX908-NEXT: s_waitcnt vmcnt(0)
4707 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4709 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4711 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4712 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
4713 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4714 ; GFX8-NEXT: .LBB23_1: ; %atomicrmw.start
4715 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4716 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4717 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
4718 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4719 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4720 ; GFX8-NEXT: buffer_wbinvl1
4721 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4722 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4723 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
4724 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4725 ; GFX8-NEXT: s_cbranch_execnz .LBB23_1
4726 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4727 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4728 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4730 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
4732 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4733 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
4734 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
4735 ; GFX7-NEXT: .LBB23_1: ; %atomicrmw.start
4736 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4737 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4738 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
4739 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4740 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4741 ; GFX7-NEXT: buffer_wbinvl1
4742 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4743 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4744 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
4745 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
4746 ; GFX7-NEXT: s_cbranch_execnz .LBB23_1
4747 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4748 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
4749 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4750 %unused = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.remote.memory !0, !amdgpu.ignore.denormal.mode !0
4754 define float @flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory(ptr %ptr, float %val) #0 {
4755 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory:
4757 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4758 ; GFX12-NEXT: s_wait_expcnt 0x0
4759 ; GFX12-NEXT: s_wait_samplecnt 0x0
4760 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4761 ; GFX12-NEXT: s_wait_kmcnt 0x0
4762 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
4763 ; GFX12-NEXT: s_wait_storecnt 0x0
4764 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
4765 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4766 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
4767 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4769 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory:
4771 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4772 ; GFX940-NEXT: buffer_wbl2 sc1
4773 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 sc0
4774 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4775 ; GFX940-NEXT: buffer_inv sc1
4776 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4778 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory:
4780 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4781 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4782 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 glc
4783 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4784 ; GFX11-NEXT: buffer_gl1_inv
4785 ; GFX11-NEXT: buffer_gl0_inv
4786 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4788 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory:
4790 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4791 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
4792 ; GFX10-NEXT: s_mov_b32 s4, 0
4793 ; GFX10-NEXT: .LBB24_1: ; %atomicrmw.start
4794 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4795 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4796 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
4797 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
4798 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4799 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4800 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4801 ; GFX10-NEXT: buffer_gl1_inv
4802 ; GFX10-NEXT: buffer_gl0_inv
4803 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
4804 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4805 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4806 ; GFX10-NEXT: s_cbranch_execnz .LBB24_1
4807 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4808 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4809 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
4810 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4812 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory:
4814 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4815 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
4816 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
4817 ; GFX90A-NEXT: ; implicit-def: $vgpr3
4818 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
4819 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
4820 ; GFX90A-NEXT: s_cbranch_execz .LBB24_6
4821 ; GFX90A-NEXT: ; %bb.1: ; %atomicrmw.check.private
4822 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
4823 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
4824 ; GFX90A-NEXT: ; implicit-def: $vgpr3
4825 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
4826 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
4827 ; GFX90A-NEXT: s_cbranch_execz .LBB24_3
4828 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.global
4829 ; GFX90A-NEXT: global_atomic_add_f32 v3, v[0:1], v2, off glc
4830 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4831 ; GFX90A-NEXT: buffer_wbinvl1
4832 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
4833 ; GFX90A-NEXT: ; implicit-def: $vgpr2
4834 ; GFX90A-NEXT: .LBB24_3: ; %Flow
4835 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
4836 ; GFX90A-NEXT: s_cbranch_execz .LBB24_5
4837 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.private
4838 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
4839 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
4840 ; GFX90A-NEXT: buffer_load_dword v3, v0, s[0:3], 0 offen
4841 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4842 ; GFX90A-NEXT: v_add_f32_e32 v1, v3, v2
4843 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
4844 ; GFX90A-NEXT: .LBB24_5: ; %Flow1
4845 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
4846 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
4847 ; GFX90A-NEXT: ; implicit-def: $vgpr2
4848 ; GFX90A-NEXT: .LBB24_6: ; %Flow2
4849 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
4850 ; GFX90A-NEXT: s_cbranch_execz .LBB24_8
4851 ; GFX90A-NEXT: ; %bb.7: ; %atomicrmw.shared
4852 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
4853 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
4854 ; GFX90A-NEXT: ds_add_rtn_f32 v3, v0, v2
4855 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
4856 ; GFX90A-NEXT: .LBB24_8: ; %atomicrmw.phi
4857 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
4858 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
4859 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
4860 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
4862 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory:
4864 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4865 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
4866 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
4867 ; GFX908-NEXT: .LBB24_1: ; %atomicrmw.start
4868 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
4869 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4870 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
4871 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
4872 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4873 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4874 ; GFX908-NEXT: buffer_wbinvl1
4875 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4876 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4877 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
4878 ; GFX908-NEXT: s_cbranch_execnz .LBB24_1
4879 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
4880 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
4881 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
4882 ; GFX908-NEXT: s_setpc_b64 s[30:31]
4884 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory:
4886 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4887 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
4888 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
4889 ; GFX8-NEXT: .LBB24_1: ; %atomicrmw.start
4890 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
4891 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4892 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
4893 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
4894 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4895 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4896 ; GFX8-NEXT: buffer_wbinvl1
4897 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4898 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4899 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
4900 ; GFX8-NEXT: s_cbranch_execnz .LBB24_1
4901 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
4902 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
4903 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
4904 ; GFX8-NEXT: s_setpc_b64 s[30:31]
4906 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_remote_memory:
4908 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4909 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
4910 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
4911 ; GFX7-NEXT: .LBB24_1: ; %atomicrmw.start
4912 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
4913 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4914 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
4915 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
4916 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4917 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4918 ; GFX7-NEXT: buffer_wbinvl1
4919 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
4920 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
4921 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
4922 ; GFX7-NEXT: s_cbranch_execnz .LBB24_1
4923 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
4924 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
4925 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
4926 ; GFX7-NEXT: s_setpc_b64 s[30:31]
4927 %result = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.remote.memory !0
4931 define void @flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory(ptr %ptr, float %val) #0 {
4932 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory:
4934 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
4935 ; GFX12-NEXT: s_wait_expcnt 0x0
4936 ; GFX12-NEXT: s_wait_samplecnt 0x0
4937 ; GFX12-NEXT: s_wait_bvhcnt 0x0
4938 ; GFX12-NEXT: s_wait_kmcnt 0x0
4939 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
4940 ; GFX12-NEXT: s_wait_storecnt 0x0
4941 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 scope:SCOPE_DEV
4942 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
4943 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
4944 ; GFX12-NEXT: s_setpc_b64 s[30:31]
4946 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory:
4948 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4949 ; GFX940-NEXT: buffer_wbl2 sc1
4950 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2
4951 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4952 ; GFX940-NEXT: buffer_inv sc1
4953 ; GFX940-NEXT: s_setpc_b64 s[30:31]
4955 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory:
4957 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4958 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4959 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2
4960 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
4961 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
4962 ; GFX11-NEXT: buffer_gl1_inv
4963 ; GFX11-NEXT: buffer_gl0_inv
4964 ; GFX11-NEXT: s_setpc_b64 s[30:31]
4966 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory:
4968 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4969 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
4970 ; GFX10-NEXT: s_mov_b32 s4, 0
4971 ; GFX10-NEXT: .LBB25_1: ; %atomicrmw.start
4972 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
4973 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4974 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
4975 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
4976 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
4977 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4978 ; GFX10-NEXT: buffer_gl1_inv
4979 ; GFX10-NEXT: buffer_gl0_inv
4980 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
4981 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
4982 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
4983 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
4984 ; GFX10-NEXT: s_cbranch_execnz .LBB25_1
4985 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
4986 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
4987 ; GFX10-NEXT: s_setpc_b64 s[30:31]
4989 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory:
4990 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
4991 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
4992 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
4993 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
4994 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
4995 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
4996 ; GFX90A-NEXT: s_cbranch_execnz .LBB25_3
4997 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
4998 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
4999 ; GFX90A-NEXT: s_cbranch_execnz .LBB25_8
5000 ; GFX90A-NEXT: .LBB25_2: ; %atomicrmw.phi
5001 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5002 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5003 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5004 ; GFX90A-NEXT: .LBB25_3: ; %atomicrmw.check.private
5005 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
5006 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
5007 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
5008 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
5009 ; GFX90A-NEXT: s_cbranch_execz .LBB25_5
5010 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
5011 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
5012 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5013 ; GFX90A-NEXT: buffer_wbinvl1
5014 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5015 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5016 ; GFX90A-NEXT: .LBB25_5: ; %Flow
5017 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
5018 ; GFX90A-NEXT: s_cbranch_execz .LBB25_7
5019 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
5020 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5021 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5022 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
5023 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5024 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
5025 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
5026 ; GFX90A-NEXT: .LBB25_7: ; %Flow1
5027 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
5028 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5029 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5030 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5031 ; GFX90A-NEXT: s_cbranch_execz .LBB25_2
5032 ; GFX90A-NEXT: .LBB25_8: ; %atomicrmw.shared
5033 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5034 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5035 ; GFX90A-NEXT: ds_add_f32 v0, v2
5036 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5037 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5038 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5039 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5041 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory:
5042 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
5043 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5044 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
5045 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
5046 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
5047 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
5048 ; GFX908-NEXT: s_cbranch_execnz .LBB25_3
5049 ; GFX908-NEXT: ; %bb.1: ; %Flow2
5050 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5051 ; GFX908-NEXT: s_cbranch_execnz .LBB25_8
5052 ; GFX908-NEXT: .LBB25_2: ; %atomicrmw.phi
5053 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5054 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5055 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5056 ; GFX908-NEXT: .LBB25_3: ; %atomicrmw.check.private
5057 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
5058 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
5059 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
5060 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
5061 ; GFX908-NEXT: s_cbranch_execz .LBB25_5
5062 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
5063 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
5064 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5065 ; GFX908-NEXT: buffer_wbinvl1
5066 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
5067 ; GFX908-NEXT: ; implicit-def: $vgpr2
5068 ; GFX908-NEXT: .LBB25_5: ; %Flow
5069 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
5070 ; GFX908-NEXT: s_cbranch_execz .LBB25_7
5071 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
5072 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5073 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5074 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
5075 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5076 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
5077 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
5078 ; GFX908-NEXT: .LBB25_7: ; %Flow1
5079 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
5080 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
5081 ; GFX908-NEXT: ; implicit-def: $vgpr2
5082 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5083 ; GFX908-NEXT: s_cbranch_execz .LBB25_2
5084 ; GFX908-NEXT: .LBB25_8: ; %atomicrmw.shared
5085 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5086 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5087 ; GFX908-NEXT: ds_add_f32 v0, v2
5088 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
5089 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5090 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5091 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5093 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory:
5095 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5096 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
5097 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5098 ; GFX8-NEXT: .LBB25_1: ; %atomicrmw.start
5099 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5100 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5101 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
5102 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5103 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5104 ; GFX8-NEXT: buffer_wbinvl1
5105 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5106 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5107 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
5108 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5109 ; GFX8-NEXT: s_cbranch_execnz .LBB25_1
5110 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5111 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
5112 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5114 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_remote_memory:
5116 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5117 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
5118 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
5119 ; GFX7-NEXT: .LBB25_1: ; %atomicrmw.start
5120 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5121 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5122 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
5123 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5124 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5125 ; GFX7-NEXT: buffer_wbinvl1
5126 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5127 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5128 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
5129 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
5130 ; GFX7-NEXT: s_cbranch_execnz .LBB25_1
5131 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5132 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
5133 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5134 %unused = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.remote.memory !0
5138 define float @flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
5139 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5141 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5142 ; GFX12-NEXT: s_wait_expcnt 0x0
5143 ; GFX12-NEXT: s_wait_samplecnt 0x0
5144 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5145 ; GFX12-NEXT: s_wait_kmcnt 0x0
5146 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
5147 ; GFX12-NEXT: s_wait_storecnt 0x0
5148 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
5149 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5150 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
5151 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5153 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5155 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5156 ; GFX940-NEXT: buffer_wbl2 sc1
5157 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 sc0
5158 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5159 ; GFX940-NEXT: buffer_inv sc1
5160 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5162 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5164 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5165 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5166 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 glc
5167 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5168 ; GFX11-NEXT: buffer_gl1_inv
5169 ; GFX11-NEXT: buffer_gl0_inv
5170 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5172 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5174 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5175 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
5176 ; GFX10-NEXT: s_mov_b32 s4, 0
5177 ; GFX10-NEXT: .LBB26_1: ; %atomicrmw.start
5178 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5179 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5180 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
5181 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
5182 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5183 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5184 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5185 ; GFX10-NEXT: buffer_gl1_inv
5186 ; GFX10-NEXT: buffer_gl0_inv
5187 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
5188 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5189 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5190 ; GFX10-NEXT: s_cbranch_execnz .LBB26_1
5191 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5192 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5193 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
5194 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5196 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5198 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5199 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
5200 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
5201 ; GFX90A-NEXT: ; implicit-def: $vgpr3
5202 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
5203 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
5204 ; GFX90A-NEXT: s_cbranch_execz .LBB26_6
5205 ; GFX90A-NEXT: ; %bb.1: ; %atomicrmw.check.private
5206 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
5207 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
5208 ; GFX90A-NEXT: ; implicit-def: $vgpr3
5209 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
5210 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
5211 ; GFX90A-NEXT: s_cbranch_execz .LBB26_3
5212 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.global
5213 ; GFX90A-NEXT: global_atomic_add_f32 v3, v[0:1], v2, off glc
5214 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5215 ; GFX90A-NEXT: buffer_wbinvl1
5216 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5217 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5218 ; GFX90A-NEXT: .LBB26_3: ; %Flow
5219 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
5220 ; GFX90A-NEXT: s_cbranch_execz .LBB26_5
5221 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.private
5222 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5223 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5224 ; GFX90A-NEXT: buffer_load_dword v3, v0, s[0:3], 0 offen
5225 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5226 ; GFX90A-NEXT: v_add_f32_e32 v1, v3, v2
5227 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
5228 ; GFX90A-NEXT: .LBB26_5: ; %Flow1
5229 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
5230 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5231 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5232 ; GFX90A-NEXT: .LBB26_6: ; %Flow2
5233 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5234 ; GFX90A-NEXT: s_cbranch_execz .LBB26_8
5235 ; GFX90A-NEXT: ; %bb.7: ; %atomicrmw.shared
5236 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5237 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5238 ; GFX90A-NEXT: ds_add_rtn_f32 v3, v0, v2
5239 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5240 ; GFX90A-NEXT: .LBB26_8: ; %atomicrmw.phi
5241 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5242 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
5243 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5244 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5246 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5248 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5249 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
5250 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
5251 ; GFX908-NEXT: .LBB26_1: ; %atomicrmw.start
5252 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
5253 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5254 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
5255 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
5256 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5257 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5258 ; GFX908-NEXT: buffer_wbinvl1
5259 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5260 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5261 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
5262 ; GFX908-NEXT: s_cbranch_execnz .LBB26_1
5263 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
5264 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5265 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
5266 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5268 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5270 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5271 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
5272 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5273 ; GFX8-NEXT: .LBB26_1: ; %atomicrmw.start
5274 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5275 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5276 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
5277 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
5278 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5279 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5280 ; GFX8-NEXT: buffer_wbinvl1
5281 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5282 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5283 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5284 ; GFX8-NEXT: s_cbranch_execnz .LBB26_1
5285 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5286 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
5287 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
5288 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5290 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5292 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5293 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
5294 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
5295 ; GFX7-NEXT: .LBB26_1: ; %atomicrmw.start
5296 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5297 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5298 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
5299 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
5300 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5301 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5302 ; GFX7-NEXT: buffer_wbinvl1
5303 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5304 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5305 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
5306 ; GFX7-NEXT: s_cbranch_execnz .LBB26_1
5307 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5308 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
5309 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
5310 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5311 %result = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory !0, !amdgpu.ignore.denormal.mode !0
5315 define void @flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode(ptr %ptr, float %val) #0 {
5316 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5318 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5319 ; GFX12-NEXT: s_wait_expcnt 0x0
5320 ; GFX12-NEXT: s_wait_samplecnt 0x0
5321 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5322 ; GFX12-NEXT: s_wait_kmcnt 0x0
5323 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
5324 ; GFX12-NEXT: s_wait_storecnt 0x0
5325 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 scope:SCOPE_DEV
5326 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
5327 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
5328 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5330 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5332 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5333 ; GFX940-NEXT: buffer_wbl2 sc1
5334 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2
5335 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5336 ; GFX940-NEXT: buffer_inv sc1
5337 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5339 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5341 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5342 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5343 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2
5344 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
5345 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5346 ; GFX11-NEXT: buffer_gl1_inv
5347 ; GFX11-NEXT: buffer_gl0_inv
5348 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5350 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5352 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5353 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
5354 ; GFX10-NEXT: s_mov_b32 s4, 0
5355 ; GFX10-NEXT: .LBB27_1: ; %atomicrmw.start
5356 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5357 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5358 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
5359 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5360 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5361 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5362 ; GFX10-NEXT: buffer_gl1_inv
5363 ; GFX10-NEXT: buffer_gl0_inv
5364 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
5365 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
5366 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5367 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5368 ; GFX10-NEXT: s_cbranch_execnz .LBB27_1
5369 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5370 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5371 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5373 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5374 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
5375 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5376 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
5377 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
5378 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
5379 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
5380 ; GFX90A-NEXT: s_cbranch_execnz .LBB27_3
5381 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
5382 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5383 ; GFX90A-NEXT: s_cbranch_execnz .LBB27_8
5384 ; GFX90A-NEXT: .LBB27_2: ; %atomicrmw.phi
5385 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5386 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5387 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5388 ; GFX90A-NEXT: .LBB27_3: ; %atomicrmw.check.private
5389 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
5390 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
5391 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
5392 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
5393 ; GFX90A-NEXT: s_cbranch_execz .LBB27_5
5394 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
5395 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
5396 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5397 ; GFX90A-NEXT: buffer_wbinvl1
5398 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5399 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5400 ; GFX90A-NEXT: .LBB27_5: ; %Flow
5401 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
5402 ; GFX90A-NEXT: s_cbranch_execz .LBB27_7
5403 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
5404 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5405 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5406 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
5407 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5408 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
5409 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
5410 ; GFX90A-NEXT: .LBB27_7: ; %Flow1
5411 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
5412 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5413 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5414 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5415 ; GFX90A-NEXT: s_cbranch_execz .LBB27_2
5416 ; GFX90A-NEXT: .LBB27_8: ; %atomicrmw.shared
5417 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5418 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5419 ; GFX90A-NEXT: ds_add_f32 v0, v2
5420 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5421 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5422 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5423 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5425 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5426 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
5427 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5428 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
5429 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
5430 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
5431 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
5432 ; GFX908-NEXT: s_cbranch_execnz .LBB27_3
5433 ; GFX908-NEXT: ; %bb.1: ; %Flow2
5434 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5435 ; GFX908-NEXT: s_cbranch_execnz .LBB27_8
5436 ; GFX908-NEXT: .LBB27_2: ; %atomicrmw.phi
5437 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5438 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5439 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5440 ; GFX908-NEXT: .LBB27_3: ; %atomicrmw.check.private
5441 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
5442 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
5443 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
5444 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
5445 ; GFX908-NEXT: s_cbranch_execz .LBB27_5
5446 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
5447 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
5448 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5449 ; GFX908-NEXT: buffer_wbinvl1
5450 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
5451 ; GFX908-NEXT: ; implicit-def: $vgpr2
5452 ; GFX908-NEXT: .LBB27_5: ; %Flow
5453 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
5454 ; GFX908-NEXT: s_cbranch_execz .LBB27_7
5455 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
5456 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5457 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5458 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
5459 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5460 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
5461 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
5462 ; GFX908-NEXT: .LBB27_7: ; %Flow1
5463 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
5464 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
5465 ; GFX908-NEXT: ; implicit-def: $vgpr2
5466 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5467 ; GFX908-NEXT: s_cbranch_execz .LBB27_2
5468 ; GFX908-NEXT: .LBB27_8: ; %atomicrmw.shared
5469 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5470 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5471 ; GFX908-NEXT: ds_add_f32 v0, v2
5472 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
5473 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5474 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5475 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5477 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5479 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5480 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
5481 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5482 ; GFX8-NEXT: .LBB27_1: ; %atomicrmw.start
5483 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5484 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5485 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
5486 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5487 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5488 ; GFX8-NEXT: buffer_wbinvl1
5489 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5490 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5491 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
5492 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5493 ; GFX8-NEXT: s_cbranch_execnz .LBB27_1
5494 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5495 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
5496 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5498 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory__amdgpu_ignore_denormal_mode:
5500 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5501 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
5502 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
5503 ; GFX7-NEXT: .LBB27_1: ; %atomicrmw.start
5504 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5505 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5506 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
5507 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5508 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5509 ; GFX7-NEXT: buffer_wbinvl1
5510 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5511 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5512 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
5513 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
5514 ; GFX7-NEXT: s_cbranch_execnz .LBB27_1
5515 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5516 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
5517 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5518 %result = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory !0, !amdgpu.ignore.denormal.mode !0
5522 define float @flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory(ptr %ptr, float %val) #0 {
5523 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5525 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5526 ; GFX12-NEXT: s_wait_expcnt 0x0
5527 ; GFX12-NEXT: s_wait_samplecnt 0x0
5528 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5529 ; GFX12-NEXT: s_wait_kmcnt 0x0
5530 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
5531 ; GFX12-NEXT: s_wait_storecnt 0x0
5532 ; GFX12-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
5533 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5534 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
5535 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5537 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5539 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5540 ; GFX940-NEXT: buffer_wbl2 sc1
5541 ; GFX940-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 sc0
5542 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5543 ; GFX940-NEXT: buffer_inv sc1
5544 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5546 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5548 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5549 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5550 ; GFX11-NEXT: flat_atomic_add_f32 v0, v[0:1], v2 glc
5551 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5552 ; GFX11-NEXT: buffer_gl1_inv
5553 ; GFX11-NEXT: buffer_gl0_inv
5554 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5556 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5558 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5559 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
5560 ; GFX10-NEXT: s_mov_b32 s4, 0
5561 ; GFX10-NEXT: .LBB28_1: ; %atomicrmw.start
5562 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5563 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5564 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
5565 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
5566 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5567 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5568 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5569 ; GFX10-NEXT: buffer_gl1_inv
5570 ; GFX10-NEXT: buffer_gl0_inv
5571 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
5572 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5573 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5574 ; GFX10-NEXT: s_cbranch_execnz .LBB28_1
5575 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5576 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5577 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
5578 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5580 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5582 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5583 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
5584 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
5585 ; GFX90A-NEXT: ; implicit-def: $vgpr3
5586 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
5587 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
5588 ; GFX90A-NEXT: s_cbranch_execz .LBB28_6
5589 ; GFX90A-NEXT: ; %bb.1: ; %atomicrmw.check.private
5590 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
5591 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
5592 ; GFX90A-NEXT: ; implicit-def: $vgpr3
5593 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
5594 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
5595 ; GFX90A-NEXT: s_cbranch_execz .LBB28_3
5596 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.global
5597 ; GFX90A-NEXT: global_atomic_add_f32 v3, v[0:1], v2, off glc
5598 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5599 ; GFX90A-NEXT: buffer_wbinvl1
5600 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5601 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5602 ; GFX90A-NEXT: .LBB28_3: ; %Flow
5603 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
5604 ; GFX90A-NEXT: s_cbranch_execz .LBB28_5
5605 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.private
5606 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5607 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5608 ; GFX90A-NEXT: buffer_load_dword v3, v0, s[0:3], 0 offen
5609 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5610 ; GFX90A-NEXT: v_add_f32_e32 v1, v3, v2
5611 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
5612 ; GFX90A-NEXT: .LBB28_5: ; %Flow1
5613 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
5614 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5615 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5616 ; GFX90A-NEXT: .LBB28_6: ; %Flow2
5617 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5618 ; GFX90A-NEXT: s_cbranch_execz .LBB28_8
5619 ; GFX90A-NEXT: ; %bb.7: ; %atomicrmw.shared
5620 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5621 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5622 ; GFX90A-NEXT: ds_add_rtn_f32 v3, v0, v2
5623 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5624 ; GFX90A-NEXT: .LBB28_8: ; %atomicrmw.phi
5625 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5626 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
5627 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5628 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5630 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5632 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5633 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
5634 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
5635 ; GFX908-NEXT: .LBB28_1: ; %atomicrmw.start
5636 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
5637 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5638 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
5639 ; GFX908-NEXT: v_add_f32_e32 v3, v4, v2
5640 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5641 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5642 ; GFX908-NEXT: buffer_wbinvl1
5643 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5644 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5645 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
5646 ; GFX908-NEXT: s_cbranch_execnz .LBB28_1
5647 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
5648 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5649 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
5650 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5652 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5654 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5655 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
5656 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5657 ; GFX8-NEXT: .LBB28_1: ; %atomicrmw.start
5658 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5659 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5660 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
5661 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
5662 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5663 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5664 ; GFX8-NEXT: buffer_wbinvl1
5665 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5666 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5667 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5668 ; GFX8-NEXT: s_cbranch_execnz .LBB28_1
5669 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5670 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
5671 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
5672 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5674 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5676 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5677 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
5678 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
5679 ; GFX7-NEXT: .LBB28_1: ; %atomicrmw.start
5680 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5681 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5682 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
5683 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
5684 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5685 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5686 ; GFX7-NEXT: buffer_wbinvl1
5687 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5688 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5689 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
5690 ; GFX7-NEXT: s_cbranch_execnz .LBB28_1
5691 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5692 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
5693 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
5694 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5695 %result = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory !0
5699 define void @flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory(ptr %ptr, float %val) #0 {
5700 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5702 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5703 ; GFX12-NEXT: s_wait_expcnt 0x0
5704 ; GFX12-NEXT: s_wait_samplecnt 0x0
5705 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5706 ; GFX12-NEXT: s_wait_kmcnt 0x0
5707 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
5708 ; GFX12-NEXT: s_wait_storecnt 0x0
5709 ; GFX12-NEXT: flat_atomic_add_f32 v[0:1], v2 scope:SCOPE_DEV
5710 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
5711 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
5712 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5714 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5716 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5717 ; GFX940-NEXT: buffer_wbl2 sc1
5718 ; GFX940-NEXT: flat_atomic_add_f32 v[0:1], v2
5719 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5720 ; GFX940-NEXT: buffer_inv sc1
5721 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5723 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5725 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5726 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5727 ; GFX11-NEXT: flat_atomic_add_f32 v[0:1], v2
5728 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
5729 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5730 ; GFX11-NEXT: buffer_gl1_inv
5731 ; GFX11-NEXT: buffer_gl0_inv
5732 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5734 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5736 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5737 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
5738 ; GFX10-NEXT: s_mov_b32 s4, 0
5739 ; GFX10-NEXT: .LBB29_1: ; %atomicrmw.start
5740 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5741 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5742 ; GFX10-NEXT: v_add_f32_e32 v3, v4, v2
5743 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5744 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5745 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5746 ; GFX10-NEXT: buffer_gl1_inv
5747 ; GFX10-NEXT: buffer_gl0_inv
5748 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
5749 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
5750 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5751 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5752 ; GFX10-NEXT: s_cbranch_execnz .LBB29_1
5753 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5754 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5755 ; GFX10-NEXT: s_setpc_b64 s[30:31]
5757 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5758 ; GFX90A: ; %bb.0: ; %atomicrmw.check.shared
5759 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5760 ; GFX90A-NEXT: s_mov_b64 s[4:5], src_shared_base
5761 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
5762 ; GFX90A-NEXT: s_and_saveexec_b64 s[4:5], vcc
5763 ; GFX90A-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
5764 ; GFX90A-NEXT: s_cbranch_execnz .LBB29_3
5765 ; GFX90A-NEXT: ; %bb.1: ; %Flow2
5766 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5767 ; GFX90A-NEXT: s_cbranch_execnz .LBB29_8
5768 ; GFX90A-NEXT: .LBB29_2: ; %atomicrmw.phi
5769 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5770 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5771 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5772 ; GFX90A-NEXT: .LBB29_3: ; %atomicrmw.check.private
5773 ; GFX90A-NEXT: s_mov_b64 s[6:7], src_private_base
5774 ; GFX90A-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
5775 ; GFX90A-NEXT: s_and_saveexec_b64 s[6:7], vcc
5776 ; GFX90A-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
5777 ; GFX90A-NEXT: s_cbranch_execz .LBB29_5
5778 ; GFX90A-NEXT: ; %bb.4: ; %atomicrmw.global
5779 ; GFX90A-NEXT: global_atomic_add_f32 v[0:1], v2, off
5780 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5781 ; GFX90A-NEXT: buffer_wbinvl1
5782 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5783 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5784 ; GFX90A-NEXT: .LBB29_5: ; %Flow
5785 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
5786 ; GFX90A-NEXT: s_cbranch_execz .LBB29_7
5787 ; GFX90A-NEXT: ; %bb.6: ; %atomicrmw.private
5788 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5789 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5790 ; GFX90A-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
5791 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5792 ; GFX90A-NEXT: v_add_f32_e32 v1, v1, v2
5793 ; GFX90A-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
5794 ; GFX90A-NEXT: .LBB29_7: ; %Flow1
5795 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
5796 ; GFX90A-NEXT: ; implicit-def: $vgpr0_vgpr1
5797 ; GFX90A-NEXT: ; implicit-def: $vgpr2
5798 ; GFX90A-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5799 ; GFX90A-NEXT: s_cbranch_execz .LBB29_2
5800 ; GFX90A-NEXT: .LBB29_8: ; %atomicrmw.shared
5801 ; GFX90A-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5802 ; GFX90A-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5803 ; GFX90A-NEXT: ds_add_f32 v0, v2
5804 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
5805 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
5806 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
5807 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
5809 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5810 ; GFX908: ; %bb.0: ; %atomicrmw.check.shared
5811 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5812 ; GFX908-NEXT: s_mov_b64 s[4:5], src_shared_base
5813 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s5, v1
5814 ; GFX908-NEXT: s_and_saveexec_b64 s[4:5], vcc
5815 ; GFX908-NEXT: s_xor_b64 s[4:5], exec, s[4:5]
5816 ; GFX908-NEXT: s_cbranch_execnz .LBB29_3
5817 ; GFX908-NEXT: ; %bb.1: ; %Flow2
5818 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5819 ; GFX908-NEXT: s_cbranch_execnz .LBB29_8
5820 ; GFX908-NEXT: .LBB29_2: ; %atomicrmw.phi
5821 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5822 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5823 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5824 ; GFX908-NEXT: .LBB29_3: ; %atomicrmw.check.private
5825 ; GFX908-NEXT: s_mov_b64 s[6:7], src_private_base
5826 ; GFX908-NEXT: v_cmp_ne_u32_e32 vcc, s7, v1
5827 ; GFX908-NEXT: s_and_saveexec_b64 s[6:7], vcc
5828 ; GFX908-NEXT: s_xor_b64 s[6:7], exec, s[6:7]
5829 ; GFX908-NEXT: s_cbranch_execz .LBB29_5
5830 ; GFX908-NEXT: ; %bb.4: ; %atomicrmw.global
5831 ; GFX908-NEXT: global_atomic_add_f32 v[0:1], v2, off
5832 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5833 ; GFX908-NEXT: buffer_wbinvl1
5834 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
5835 ; GFX908-NEXT: ; implicit-def: $vgpr2
5836 ; GFX908-NEXT: .LBB29_5: ; %Flow
5837 ; GFX908-NEXT: s_andn2_saveexec_b64 s[6:7], s[6:7]
5838 ; GFX908-NEXT: s_cbranch_execz .LBB29_7
5839 ; GFX908-NEXT: ; %bb.6: ; %atomicrmw.private
5840 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5841 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5842 ; GFX908-NEXT: buffer_load_dword v1, v0, s[0:3], 0 offen
5843 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5844 ; GFX908-NEXT: v_add_f32_e32 v1, v1, v2
5845 ; GFX908-NEXT: buffer_store_dword v1, v0, s[0:3], 0 offen
5846 ; GFX908-NEXT: .LBB29_7: ; %Flow1
5847 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
5848 ; GFX908-NEXT: ; implicit-def: $vgpr0_vgpr1
5849 ; GFX908-NEXT: ; implicit-def: $vgpr2
5850 ; GFX908-NEXT: s_andn2_saveexec_b64 s[4:5], s[4:5]
5851 ; GFX908-NEXT: s_cbranch_execz .LBB29_2
5852 ; GFX908-NEXT: .LBB29_8: ; %atomicrmw.shared
5853 ; GFX908-NEXT: v_cmp_ne_u64_e32 vcc, 0, v[0:1]
5854 ; GFX908-NEXT: v_cndmask_b32_e32 v0, -1, v0, vcc
5855 ; GFX908-NEXT: ds_add_f32 v0, v2
5856 ; GFX908-NEXT: s_waitcnt lgkmcnt(0)
5857 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
5858 ; GFX908-NEXT: s_waitcnt vmcnt(0)
5859 ; GFX908-NEXT: s_setpc_b64 s[30:31]
5861 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5863 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5864 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
5865 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
5866 ; GFX8-NEXT: .LBB29_1: ; %atomicrmw.start
5867 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
5868 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5869 ; GFX8-NEXT: v_add_f32_e32 v3, v4, v2
5870 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5871 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5872 ; GFX8-NEXT: buffer_wbinvl1
5873 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5874 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5875 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
5876 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
5877 ; GFX8-NEXT: s_cbranch_execnz .LBB29_1
5878 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
5879 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
5880 ; GFX8-NEXT: s_setpc_b64 s[30:31]
5882 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f32__amdgpu_no_fine_grained_memory_amdgpu_no_remote_memory:
5884 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5885 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
5886 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
5887 ; GFX7-NEXT: .LBB29_1: ; %atomicrmw.start
5888 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
5889 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5890 ; GFX7-NEXT: v_add_f32_e32 v3, v4, v2
5891 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
5892 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5893 ; GFX7-NEXT: buffer_wbinvl1
5894 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
5895 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
5896 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
5897 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
5898 ; GFX7-NEXT: s_cbranch_execnz .LBB29_1
5899 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
5900 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
5901 ; GFX7-NEXT: s_setpc_b64 s[30:31]
5902 %result = atomicrmw fadd ptr %ptr, float %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory !0
5906 ; --------------------------------------------------------------------
5908 ; --------------------------------------------------------------------
5910 define double @flat_agent_atomic_fadd_ret_f64__amdgpu_no_fine_grained_memory(ptr %ptr, double %val) #0 {
5911 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f64__amdgpu_no_fine_grained_memory:
5913 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5914 ; GFX12-NEXT: s_wait_expcnt 0x0
5915 ; GFX12-NEXT: s_wait_samplecnt 0x0
5916 ; GFX12-NEXT: s_wait_bvhcnt 0x0
5917 ; GFX12-NEXT: s_wait_kmcnt 0x0
5918 ; GFX12-NEXT: flat_load_b64 v[4:5], v[0:1]
5919 ; GFX12-NEXT: s_mov_b32 s0, 0
5920 ; GFX12-NEXT: .LBB30_1: ; %atomicrmw.start
5921 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
5922 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5923 ; GFX12-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
5924 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
5925 ; GFX12-NEXT: v_add_f64_e32 v[4:5], v[6:7], v[2:3]
5926 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
5927 ; GFX12-NEXT: s_wait_storecnt 0x0
5928 ; GFX12-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
5929 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
5930 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
5931 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
5932 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
5933 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5934 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5935 ; GFX12-NEXT: s_cbranch_execnz .LBB30_1
5936 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
5937 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
5938 ; GFX12-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
5939 ; GFX12-NEXT: s_setpc_b64 s[30:31]
5941 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f64__amdgpu_no_fine_grained_memory:
5943 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5944 ; GFX940-NEXT: buffer_wbl2 sc1
5945 ; GFX940-NEXT: flat_atomic_add_f64 v[0:1], v[0:1], v[2:3] sc0
5946 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5947 ; GFX940-NEXT: buffer_inv sc1
5948 ; GFX940-NEXT: s_setpc_b64 s[30:31]
5950 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f64__amdgpu_no_fine_grained_memory:
5952 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5953 ; GFX11-NEXT: flat_load_b64 v[4:5], v[0:1]
5954 ; GFX11-NEXT: s_mov_b32 s0, 0
5955 ; GFX11-NEXT: .LBB30_1: ; %atomicrmw.start
5956 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
5957 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5958 ; GFX11-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
5959 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
5960 ; GFX11-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
5961 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
5962 ; GFX11-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] glc
5963 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5964 ; GFX11-NEXT: buffer_gl1_inv
5965 ; GFX11-NEXT: buffer_gl0_inv
5966 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
5967 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
5968 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
5969 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
5970 ; GFX11-NEXT: s_cbranch_execnz .LBB30_1
5971 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
5972 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
5973 ; GFX11-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
5974 ; GFX11-NEXT: s_setpc_b64 s[30:31]
5976 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f64__amdgpu_no_fine_grained_memory:
5978 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5979 ; GFX10-NEXT: flat_load_dwordx2 v[4:5], v[0:1]
5980 ; GFX10-NEXT: s_mov_b32 s4, 0
5981 ; GFX10-NEXT: .LBB30_1: ; %atomicrmw.start
5982 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
5983 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5984 ; GFX10-NEXT: v_mov_b32_e32 v7, v5
5985 ; GFX10-NEXT: v_mov_b32_e32 v6, v4
5986 ; GFX10-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
5987 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
5988 ; GFX10-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
5989 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5990 ; GFX10-NEXT: buffer_gl1_inv
5991 ; GFX10-NEXT: buffer_gl0_inv
5992 ; GFX10-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
5993 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
5994 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
5995 ; GFX10-NEXT: s_cbranch_execnz .LBB30_1
5996 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
5997 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
5998 ; GFX10-NEXT: v_mov_b32_e32 v0, v4
5999 ; GFX10-NEXT: v_mov_b32_e32 v1, v5
6000 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6002 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f64__amdgpu_no_fine_grained_memory:
6004 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6005 ; GFX90A-NEXT: flat_atomic_add_f64 v[0:1], v[0:1], v[2:3] glc
6006 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6007 ; GFX90A-NEXT: buffer_wbinvl1
6008 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6010 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f64__amdgpu_no_fine_grained_memory:
6012 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6013 ; GFX908-NEXT: flat_load_dwordx2 v[4:5], v[0:1]
6014 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
6015 ; GFX908-NEXT: .LBB30_1: ; %atomicrmw.start
6016 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6017 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6018 ; GFX908-NEXT: v_mov_b32_e32 v7, v5
6019 ; GFX908-NEXT: v_mov_b32_e32 v6, v4
6020 ; GFX908-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6021 ; GFX908-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
6022 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6023 ; GFX908-NEXT: buffer_wbinvl1
6024 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
6025 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6026 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
6027 ; GFX908-NEXT: s_cbranch_execnz .LBB30_1
6028 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6029 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
6030 ; GFX908-NEXT: v_mov_b32_e32 v0, v4
6031 ; GFX908-NEXT: v_mov_b32_e32 v1, v5
6032 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6034 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f64__amdgpu_no_fine_grained_memory:
6036 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6037 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, 4, v0
6038 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v1, vcc
6039 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
6040 ; GFX8-NEXT: flat_load_dword v5, v[5:6]
6041 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
6042 ; GFX8-NEXT: .LBB30_1: ; %atomicrmw.start
6043 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6044 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6045 ; GFX8-NEXT: v_mov_b32_e32 v7, v5
6046 ; GFX8-NEXT: v_mov_b32_e32 v6, v4
6047 ; GFX8-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6048 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
6049 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6050 ; GFX8-NEXT: buffer_wbinvl1
6051 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
6052 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6053 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
6054 ; GFX8-NEXT: s_cbranch_execnz .LBB30_1
6055 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6056 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6057 ; GFX8-NEXT: v_mov_b32_e32 v0, v4
6058 ; GFX8-NEXT: v_mov_b32_e32 v1, v5
6059 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6061 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f64__amdgpu_no_fine_grained_memory:
6063 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6064 ; GFX7-NEXT: v_add_i32_e32 v5, vcc, 4, v0
6065 ; GFX7-NEXT: v_addc_u32_e32 v6, vcc, 0, v1, vcc
6066 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
6067 ; GFX7-NEXT: flat_load_dword v5, v[5:6]
6068 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
6069 ; GFX7-NEXT: .LBB30_1: ; %atomicrmw.start
6070 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6071 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6072 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
6073 ; GFX7-NEXT: v_mov_b32_e32 v6, v4
6074 ; GFX7-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6075 ; GFX7-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
6076 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6077 ; GFX7-NEXT: buffer_wbinvl1
6078 ; GFX7-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
6079 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6080 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
6081 ; GFX7-NEXT: s_cbranch_execnz .LBB30_1
6082 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6083 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
6084 ; GFX7-NEXT: v_mov_b32_e32 v0, v4
6085 ; GFX7-NEXT: v_mov_b32_e32 v1, v5
6086 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6087 %result = atomicrmw fadd ptr %ptr, double %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
6091 define double @flat_agent_atomic_fadd_ret_f64__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, double %val) #0 {
6092 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6094 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6095 ; GFX12-NEXT: s_wait_expcnt 0x0
6096 ; GFX12-NEXT: s_wait_samplecnt 0x0
6097 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6098 ; GFX12-NEXT: s_wait_kmcnt 0x0
6099 ; GFX12-NEXT: flat_load_b64 v[4:5], v[0:1] offset:2040
6100 ; GFX12-NEXT: s_mov_b32 s0, 0
6101 ; GFX12-NEXT: .LBB31_1: ; %atomicrmw.start
6102 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6103 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6104 ; GFX12-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
6105 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
6106 ; GFX12-NEXT: v_add_f64_e32 v[4:5], v[6:7], v[2:3]
6107 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
6108 ; GFX12-NEXT: s_wait_storecnt 0x0
6109 ; GFX12-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] offset:2040 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
6110 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6111 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
6112 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6113 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
6114 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6115 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6116 ; GFX12-NEXT: s_cbranch_execnz .LBB31_1
6117 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6118 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
6119 ; GFX12-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
6120 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6122 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6124 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6125 ; GFX940-NEXT: buffer_wbl2 sc1
6126 ; GFX940-NEXT: flat_atomic_add_f64 v[0:1], v[0:1], v[2:3] offset:2040 sc0
6127 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6128 ; GFX940-NEXT: buffer_inv sc1
6129 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6131 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6133 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6134 ; GFX11-NEXT: flat_load_b64 v[4:5], v[0:1] offset:2040
6135 ; GFX11-NEXT: s_mov_b32 s0, 0
6136 ; GFX11-NEXT: .LBB31_1: ; %atomicrmw.start
6137 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6138 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6139 ; GFX11-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
6140 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
6141 ; GFX11-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6142 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6143 ; GFX11-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] offset:2040 glc
6144 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6145 ; GFX11-NEXT: buffer_gl1_inv
6146 ; GFX11-NEXT: buffer_gl0_inv
6147 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6148 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
6149 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6150 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6151 ; GFX11-NEXT: s_cbranch_execnz .LBB31_1
6152 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6153 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
6154 ; GFX11-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
6155 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6157 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6159 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6160 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x7f8, v0
6161 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
6162 ; GFX10-NEXT: s_mov_b32 s4, 0
6163 ; GFX10-NEXT: flat_load_dwordx2 v[0:1], v[4:5]
6164 ; GFX10-NEXT: .LBB31_1: ; %atomicrmw.start
6165 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6166 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6167 ; GFX10-NEXT: v_mov_b32_e32 v9, v1
6168 ; GFX10-NEXT: v_mov_b32_e32 v8, v0
6169 ; GFX10-NEXT: v_add_f64 v[6:7], v[8:9], v[2:3]
6170 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6171 ; GFX10-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[4:5], v[6:9] glc
6172 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6173 ; GFX10-NEXT: buffer_gl1_inv
6174 ; GFX10-NEXT: buffer_gl0_inv
6175 ; GFX10-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[0:1], v[8:9]
6176 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
6177 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
6178 ; GFX10-NEXT: s_cbranch_execnz .LBB31_1
6179 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6180 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
6181 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6183 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6185 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6186 ; GFX90A-NEXT: flat_atomic_add_f64 v[0:1], v[0:1], v[2:3] offset:2040 glc
6187 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6188 ; GFX90A-NEXT: buffer_wbinvl1
6189 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6191 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6193 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6194 ; GFX908-NEXT: flat_load_dwordx2 v[4:5], v[0:1] offset:2040
6195 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
6196 ; GFX908-NEXT: .LBB31_1: ; %atomicrmw.start
6197 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6198 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6199 ; GFX908-NEXT: v_mov_b32_e32 v7, v5
6200 ; GFX908-NEXT: v_mov_b32_e32 v6, v4
6201 ; GFX908-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6202 ; GFX908-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] offset:2040 glc
6203 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6204 ; GFX908-NEXT: buffer_wbinvl1
6205 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
6206 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6207 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
6208 ; GFX908-NEXT: s_cbranch_execnz .LBB31_1
6209 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6210 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
6211 ; GFX908-NEXT: v_mov_b32_e32 v0, v4
6212 ; GFX908-NEXT: v_mov_b32_e32 v1, v5
6213 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6215 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6217 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6218 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7f8, v0
6219 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
6220 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
6221 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
6222 ; GFX8-NEXT: flat_load_dword v1, v[0:1]
6223 ; GFX8-NEXT: flat_load_dword v0, v[4:5]
6224 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
6225 ; GFX8-NEXT: .LBB31_1: ; %atomicrmw.start
6226 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6227 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6228 ; GFX8-NEXT: v_mov_b32_e32 v9, v1
6229 ; GFX8-NEXT: v_mov_b32_e32 v8, v0
6230 ; GFX8-NEXT: v_add_f64 v[6:7], v[8:9], v[2:3]
6231 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[4:5], v[6:9] glc
6232 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6233 ; GFX8-NEXT: buffer_wbinvl1
6234 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[8:9]
6235 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6236 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
6237 ; GFX8-NEXT: s_cbranch_execnz .LBB31_1
6238 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6239 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6240 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6242 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6244 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6245 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7f8, v0
6246 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
6247 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
6248 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
6249 ; GFX7-NEXT: flat_load_dword v1, v[0:1]
6250 ; GFX7-NEXT: flat_load_dword v0, v[4:5]
6251 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
6252 ; GFX7-NEXT: .LBB31_1: ; %atomicrmw.start
6253 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6254 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6255 ; GFX7-NEXT: v_mov_b32_e32 v9, v1
6256 ; GFX7-NEXT: v_mov_b32_e32 v8, v0
6257 ; GFX7-NEXT: v_add_f64 v[6:7], v[8:9], v[2:3]
6258 ; GFX7-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[4:5], v[6:9] glc
6259 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6260 ; GFX7-NEXT: buffer_wbinvl1
6261 ; GFX7-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[8:9]
6262 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6263 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
6264 ; GFX7-NEXT: s_cbranch_execnz .LBB31_1
6265 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6266 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
6267 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6268 %gep = getelementptr double, ptr %ptr, i64 255
6269 %result = atomicrmw fadd ptr %gep, double %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
6273 define double @flat_agent_atomic_fadd_ret_f64__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, double %val) #0 {
6274 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6276 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6277 ; GFX12-NEXT: s_wait_expcnt 0x0
6278 ; GFX12-NEXT: s_wait_samplecnt 0x0
6279 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6280 ; GFX12-NEXT: s_wait_kmcnt 0x0
6281 ; GFX12-NEXT: flat_load_b64 v[4:5], v[0:1] offset:-2048
6282 ; GFX12-NEXT: s_mov_b32 s0, 0
6283 ; GFX12-NEXT: .LBB32_1: ; %atomicrmw.start
6284 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6285 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6286 ; GFX12-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
6287 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
6288 ; GFX12-NEXT: v_add_f64_e32 v[4:5], v[6:7], v[2:3]
6289 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
6290 ; GFX12-NEXT: s_wait_storecnt 0x0
6291 ; GFX12-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
6292 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6293 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
6294 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6295 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
6296 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6297 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6298 ; GFX12-NEXT: s_cbranch_execnz .LBB32_1
6299 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6300 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
6301 ; GFX12-NEXT: v_dual_mov_b32 v0, v4 :: v_dual_mov_b32 v1, v5
6302 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6304 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6306 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6307 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
6308 ; GFX940-NEXT: s_nop 1
6309 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
6310 ; GFX940-NEXT: buffer_wbl2 sc1
6311 ; GFX940-NEXT: flat_atomic_add_f64 v[0:1], v[0:1], v[2:3] sc0
6312 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6313 ; GFX940-NEXT: buffer_inv sc1
6314 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6316 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6318 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6319 ; GFX11-NEXT: v_dual_mov_b32 v4, v1 :: v_dual_mov_b32 v5, v0
6320 ; GFX11-NEXT: s_mov_b32 s0, 0
6321 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
6322 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v5
6323 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v4, vcc_lo
6324 ; GFX11-NEXT: v_add_co_u32 v5, vcc_lo, 0xfffff800, v5
6325 ; GFX11-NEXT: v_add_co_ci_u32_e32 v6, vcc_lo, -1, v4, vcc_lo
6326 ; GFX11-NEXT: flat_load_b64 v[0:1], v[0:1]
6327 ; GFX11-NEXT: .LBB32_1: ; %atomicrmw.start
6328 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6329 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6330 ; GFX11-NEXT: v_dual_mov_b32 v10, v1 :: v_dual_mov_b32 v9, v0
6331 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
6332 ; GFX11-NEXT: v_add_f64 v[7:8], v[9:10], v[2:3]
6333 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6334 ; GFX11-NEXT: flat_atomic_cmpswap_b64 v[0:1], v[5:6], v[7:10] glc
6335 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6336 ; GFX11-NEXT: buffer_gl1_inv
6337 ; GFX11-NEXT: buffer_gl0_inv
6338 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[0:1], v[9:10]
6339 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
6340 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6341 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6342 ; GFX11-NEXT: s_cbranch_execnz .LBB32_1
6343 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6344 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
6345 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6347 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6349 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6350 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
6351 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, -1, v1, vcc_lo
6352 ; GFX10-NEXT: s_mov_b32 s4, 0
6353 ; GFX10-NEXT: flat_load_dwordx2 v[0:1], v[4:5]
6354 ; GFX10-NEXT: .LBB32_1: ; %atomicrmw.start
6355 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6356 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6357 ; GFX10-NEXT: v_mov_b32_e32 v9, v1
6358 ; GFX10-NEXT: v_mov_b32_e32 v8, v0
6359 ; GFX10-NEXT: v_add_f64 v[6:7], v[8:9], v[2:3]
6360 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6361 ; GFX10-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[4:5], v[6:9] glc
6362 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6363 ; GFX10-NEXT: buffer_gl1_inv
6364 ; GFX10-NEXT: buffer_gl0_inv
6365 ; GFX10-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[0:1], v[8:9]
6366 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
6367 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
6368 ; GFX10-NEXT: s_cbranch_execnz .LBB32_1
6369 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6370 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
6371 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6373 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6375 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6376 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
6377 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
6378 ; GFX90A-NEXT: flat_atomic_add_f64 v[0:1], v[0:1], v[2:3] glc
6379 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6380 ; GFX90A-NEXT: buffer_wbinvl1
6381 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6383 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6385 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6386 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
6387 ; GFX908-NEXT: v_addc_co_u32_e32 v5, vcc, -1, v1, vcc
6388 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
6389 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
6390 ; GFX908-NEXT: flat_load_dwordx2 v[0:1], v[0:1]
6391 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
6392 ; GFX908-NEXT: .LBB32_1: ; %atomicrmw.start
6393 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6394 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6395 ; GFX908-NEXT: v_mov_b32_e32 v9, v1
6396 ; GFX908-NEXT: v_mov_b32_e32 v8, v0
6397 ; GFX908-NEXT: v_add_f64 v[6:7], v[8:9], v[2:3]
6398 ; GFX908-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[4:5], v[6:9] glc
6399 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6400 ; GFX908-NEXT: buffer_wbinvl1
6401 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[8:9]
6402 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6403 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
6404 ; GFX908-NEXT: s_cbranch_execnz .LBB32_1
6405 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6406 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
6407 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6409 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6411 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6412 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0xfffff800, v0
6413 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, -1, v1, vcc
6414 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff804, v0
6415 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
6416 ; GFX8-NEXT: flat_load_dword v1, v[0:1]
6417 ; GFX8-NEXT: flat_load_dword v0, v[4:5]
6418 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
6419 ; GFX8-NEXT: .LBB32_1: ; %atomicrmw.start
6420 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6421 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6422 ; GFX8-NEXT: v_mov_b32_e32 v9, v1
6423 ; GFX8-NEXT: v_mov_b32_e32 v8, v0
6424 ; GFX8-NEXT: v_add_f64 v[6:7], v[8:9], v[2:3]
6425 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[4:5], v[6:9] glc
6426 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6427 ; GFX8-NEXT: buffer_wbinvl1
6428 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[8:9]
6429 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6430 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
6431 ; GFX8-NEXT: s_cbranch_execnz .LBB32_1
6432 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6433 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6434 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6436 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6438 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6439 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
6440 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, -1, v1, vcc
6441 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0xfffff804, v0
6442 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
6443 ; GFX7-NEXT: flat_load_dword v1, v[0:1]
6444 ; GFX7-NEXT: flat_load_dword v0, v[4:5]
6445 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
6446 ; GFX7-NEXT: .LBB32_1: ; %atomicrmw.start
6447 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6448 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6449 ; GFX7-NEXT: v_mov_b32_e32 v9, v1
6450 ; GFX7-NEXT: v_mov_b32_e32 v8, v0
6451 ; GFX7-NEXT: v_add_f64 v[6:7], v[8:9], v[2:3]
6452 ; GFX7-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[4:5], v[6:9] glc
6453 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6454 ; GFX7-NEXT: buffer_wbinvl1
6455 ; GFX7-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[8:9]
6456 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6457 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
6458 ; GFX7-NEXT: s_cbranch_execnz .LBB32_1
6459 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6460 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
6461 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6462 %gep = getelementptr double, ptr %ptr, i64 -256
6463 %result = atomicrmw fadd ptr %gep, double %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
6467 define void @flat_agent_atomic_fadd_noret_f64__amdgpu_no_fine_grained_memory(ptr %ptr, double %val) #0 {
6468 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f64__amdgpu_no_fine_grained_memory:
6470 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6471 ; GFX12-NEXT: s_wait_expcnt 0x0
6472 ; GFX12-NEXT: s_wait_samplecnt 0x0
6473 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6474 ; GFX12-NEXT: s_wait_kmcnt 0x0
6475 ; GFX12-NEXT: flat_load_b64 v[6:7], v[0:1]
6476 ; GFX12-NEXT: s_mov_b32 s0, 0
6477 ; GFX12-NEXT: .LBB33_1: ; %atomicrmw.start
6478 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6479 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6480 ; GFX12-NEXT: v_add_f64_e32 v[4:5], v[6:7], v[2:3]
6481 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
6482 ; GFX12-NEXT: s_wait_storecnt 0x0
6483 ; GFX12-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
6484 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6485 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
6486 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6487 ; GFX12-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
6488 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
6489 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6490 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6491 ; GFX12-NEXT: s_cbranch_execnz .LBB33_1
6492 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6493 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
6494 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6496 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f64__amdgpu_no_fine_grained_memory:
6498 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6499 ; GFX940-NEXT: buffer_wbl2 sc1
6500 ; GFX940-NEXT: flat_atomic_add_f64 v[0:1], v[2:3]
6501 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6502 ; GFX940-NEXT: buffer_inv sc1
6503 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6505 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f64__amdgpu_no_fine_grained_memory:
6507 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6508 ; GFX11-NEXT: flat_load_b64 v[6:7], v[0:1]
6509 ; GFX11-NEXT: s_mov_b32 s0, 0
6510 ; GFX11-NEXT: .LBB33_1: ; %atomicrmw.start
6511 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6512 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6513 ; GFX11-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6514 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6515 ; GFX11-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] glc
6516 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6517 ; GFX11-NEXT: buffer_gl1_inv
6518 ; GFX11-NEXT: buffer_gl0_inv
6519 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6520 ; GFX11-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
6521 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
6522 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6523 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6524 ; GFX11-NEXT: s_cbranch_execnz .LBB33_1
6525 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6526 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
6527 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6529 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f64__amdgpu_no_fine_grained_memory:
6531 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6532 ; GFX10-NEXT: flat_load_dwordx2 v[6:7], v[0:1]
6533 ; GFX10-NEXT: s_mov_b32 s4, 0
6534 ; GFX10-NEXT: .LBB33_1: ; %atomicrmw.start
6535 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6536 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6537 ; GFX10-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6538 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6539 ; GFX10-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
6540 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6541 ; GFX10-NEXT: buffer_gl1_inv
6542 ; GFX10-NEXT: buffer_gl0_inv
6543 ; GFX10-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6544 ; GFX10-NEXT: v_mov_b32_e32 v7, v5
6545 ; GFX10-NEXT: v_mov_b32_e32 v6, v4
6546 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
6547 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
6548 ; GFX10-NEXT: s_cbranch_execnz .LBB33_1
6549 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6550 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
6551 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6553 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f64__amdgpu_no_fine_grained_memory:
6555 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6556 ; GFX90A-NEXT: flat_atomic_add_f64 v[0:1], v[2:3]
6557 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6558 ; GFX90A-NEXT: buffer_wbinvl1
6559 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6561 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f64__amdgpu_no_fine_grained_memory:
6563 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6564 ; GFX908-NEXT: flat_load_dwordx2 v[6:7], v[0:1]
6565 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
6566 ; GFX908-NEXT: .LBB33_1: ; %atomicrmw.start
6567 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6568 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6569 ; GFX908-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6570 ; GFX908-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
6571 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6572 ; GFX908-NEXT: buffer_wbinvl1
6573 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
6574 ; GFX908-NEXT: v_mov_b32_e32 v7, v5
6575 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6576 ; GFX908-NEXT: v_mov_b32_e32 v6, v4
6577 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
6578 ; GFX908-NEXT: s_cbranch_execnz .LBB33_1
6579 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6580 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
6581 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6583 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f64__amdgpu_no_fine_grained_memory:
6585 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6586 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 4, v0
6587 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
6588 ; GFX8-NEXT: flat_load_dword v6, v[0:1]
6589 ; GFX8-NEXT: flat_load_dword v7, v[4:5]
6590 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
6591 ; GFX8-NEXT: .LBB33_1: ; %atomicrmw.start
6592 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6593 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6594 ; GFX8-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6595 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
6596 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6597 ; GFX8-NEXT: buffer_wbinvl1
6598 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
6599 ; GFX8-NEXT: v_mov_b32_e32 v7, v5
6600 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6601 ; GFX8-NEXT: v_mov_b32_e32 v6, v4
6602 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
6603 ; GFX8-NEXT: s_cbranch_execnz .LBB33_1
6604 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6605 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6606 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6608 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f64__amdgpu_no_fine_grained_memory:
6610 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6611 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 4, v0
6612 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
6613 ; GFX7-NEXT: flat_load_dword v6, v[0:1]
6614 ; GFX7-NEXT: flat_load_dword v7, v[4:5]
6615 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
6616 ; GFX7-NEXT: .LBB33_1: ; %atomicrmw.start
6617 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6618 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6619 ; GFX7-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6620 ; GFX7-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
6621 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6622 ; GFX7-NEXT: buffer_wbinvl1
6623 ; GFX7-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
6624 ; GFX7-NEXT: v_mov_b32_e32 v7, v5
6625 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6626 ; GFX7-NEXT: v_mov_b32_e32 v6, v4
6627 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
6628 ; GFX7-NEXT: s_cbranch_execnz .LBB33_1
6629 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6630 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
6631 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6632 %unused = atomicrmw fadd ptr %ptr, double %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
6636 define void @flat_agent_atomic_fadd_noret_f64__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, double %val) #0 {
6637 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6639 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6640 ; GFX12-NEXT: s_wait_expcnt 0x0
6641 ; GFX12-NEXT: s_wait_samplecnt 0x0
6642 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6643 ; GFX12-NEXT: s_wait_kmcnt 0x0
6644 ; GFX12-NEXT: flat_load_b64 v[6:7], v[0:1] offset:2040
6645 ; GFX12-NEXT: s_mov_b32 s0, 0
6646 ; GFX12-NEXT: .LBB34_1: ; %atomicrmw.start
6647 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6648 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6649 ; GFX12-NEXT: v_add_f64_e32 v[4:5], v[6:7], v[2:3]
6650 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
6651 ; GFX12-NEXT: s_wait_storecnt 0x0
6652 ; GFX12-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] offset:2040 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
6653 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6654 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
6655 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6656 ; GFX12-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
6657 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
6658 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6659 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6660 ; GFX12-NEXT: s_cbranch_execnz .LBB34_1
6661 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6662 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
6663 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6665 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6667 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6668 ; GFX940-NEXT: buffer_wbl2 sc1
6669 ; GFX940-NEXT: flat_atomic_add_f64 v[0:1], v[2:3] offset:2040
6670 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6671 ; GFX940-NEXT: buffer_inv sc1
6672 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6674 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6676 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6677 ; GFX11-NEXT: flat_load_b64 v[6:7], v[0:1] offset:2040
6678 ; GFX11-NEXT: s_mov_b32 s0, 0
6679 ; GFX11-NEXT: .LBB34_1: ; %atomicrmw.start
6680 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6681 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6682 ; GFX11-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6683 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6684 ; GFX11-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] offset:2040 glc
6685 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6686 ; GFX11-NEXT: buffer_gl1_inv
6687 ; GFX11-NEXT: buffer_gl0_inv
6688 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6689 ; GFX11-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
6690 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
6691 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6692 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6693 ; GFX11-NEXT: s_cbranch_execnz .LBB34_1
6694 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6695 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
6696 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6698 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6700 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6701 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7f8, v0
6702 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
6703 ; GFX10-NEXT: s_mov_b32 s4, 0
6704 ; GFX10-NEXT: flat_load_dwordx2 v[6:7], v[0:1]
6705 ; GFX10-NEXT: .LBB34_1: ; %atomicrmw.start
6706 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6707 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6708 ; GFX10-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6709 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6710 ; GFX10-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
6711 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6712 ; GFX10-NEXT: buffer_gl1_inv
6713 ; GFX10-NEXT: buffer_gl0_inv
6714 ; GFX10-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6715 ; GFX10-NEXT: v_mov_b32_e32 v7, v5
6716 ; GFX10-NEXT: v_mov_b32_e32 v6, v4
6717 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
6718 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
6719 ; GFX10-NEXT: s_cbranch_execnz .LBB34_1
6720 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6721 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
6722 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6724 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6726 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6727 ; GFX90A-NEXT: flat_atomic_add_f64 v[0:1], v[2:3] offset:2040
6728 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6729 ; GFX90A-NEXT: buffer_wbinvl1
6730 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6732 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6734 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6735 ; GFX908-NEXT: flat_load_dwordx2 v[6:7], v[0:1] offset:2040
6736 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
6737 ; GFX908-NEXT: .LBB34_1: ; %atomicrmw.start
6738 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6739 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6740 ; GFX908-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6741 ; GFX908-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] offset:2040 glc
6742 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6743 ; GFX908-NEXT: buffer_wbinvl1
6744 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[4:5], v[6:7]
6745 ; GFX908-NEXT: v_mov_b32_e32 v7, v5
6746 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6747 ; GFX908-NEXT: v_mov_b32_e32 v6, v4
6748 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
6749 ; GFX908-NEXT: s_cbranch_execnz .LBB34_1
6750 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6751 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
6752 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6754 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6756 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6757 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7f8, v0
6758 ; GFX8-NEXT: v_addc_u32_e32 v9, vcc, 0, v1, vcc
6759 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
6760 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
6761 ; GFX8-NEXT: flat_load_dword v7, v[0:1]
6762 ; GFX8-NEXT: flat_load_dword v6, v[8:9]
6763 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
6764 ; GFX8-NEXT: .LBB34_1: ; %atomicrmw.start
6765 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6766 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6767 ; GFX8-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6768 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[8:9], v[4:7] glc
6769 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6770 ; GFX8-NEXT: buffer_wbinvl1
6771 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[6:7]
6772 ; GFX8-NEXT: v_mov_b32_e32 v7, v1
6773 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6774 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
6775 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
6776 ; GFX8-NEXT: s_cbranch_execnz .LBB34_1
6777 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6778 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6779 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6781 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_pos__amdgpu_no_fine_grained_memory:
6783 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6784 ; GFX7-NEXT: v_add_i32_e32 v8, vcc, 0x7f8, v0
6785 ; GFX7-NEXT: v_addc_u32_e32 v9, vcc, 0, v1, vcc
6786 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
6787 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
6788 ; GFX7-NEXT: flat_load_dword v7, v[0:1]
6789 ; GFX7-NEXT: flat_load_dword v6, v[8:9]
6790 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
6791 ; GFX7-NEXT: .LBB34_1: ; %atomicrmw.start
6792 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6793 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6794 ; GFX7-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6795 ; GFX7-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[8:9], v[4:7] glc
6796 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6797 ; GFX7-NEXT: buffer_wbinvl1
6798 ; GFX7-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[6:7]
6799 ; GFX7-NEXT: v_mov_b32_e32 v7, v1
6800 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6801 ; GFX7-NEXT: v_mov_b32_e32 v6, v0
6802 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
6803 ; GFX7-NEXT: s_cbranch_execnz .LBB34_1
6804 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6805 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
6806 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6807 %gep = getelementptr double, ptr %ptr, i64 255
6808 %unused = atomicrmw fadd ptr %gep, double %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
6812 define void @flat_agent_atomic_fadd_noret_f64__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, double %val) #0 {
6813 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6815 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6816 ; GFX12-NEXT: s_wait_expcnt 0x0
6817 ; GFX12-NEXT: s_wait_samplecnt 0x0
6818 ; GFX12-NEXT: s_wait_bvhcnt 0x0
6819 ; GFX12-NEXT: s_wait_kmcnt 0x0
6820 ; GFX12-NEXT: flat_load_b64 v[6:7], v[0:1] offset:-2048
6821 ; GFX12-NEXT: s_mov_b32 s0, 0
6822 ; GFX12-NEXT: .LBB35_1: ; %atomicrmw.start
6823 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
6824 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6825 ; GFX12-NEXT: v_add_f64_e32 v[4:5], v[6:7], v[2:3]
6826 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
6827 ; GFX12-NEXT: s_wait_storecnt 0x0
6828 ; GFX12-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
6829 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
6830 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
6831 ; GFX12-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6832 ; GFX12-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
6833 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
6834 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6835 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6836 ; GFX12-NEXT: s_cbranch_execnz .LBB35_1
6837 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
6838 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
6839 ; GFX12-NEXT: s_setpc_b64 s[30:31]
6841 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6843 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6844 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
6845 ; GFX940-NEXT: s_nop 1
6846 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
6847 ; GFX940-NEXT: buffer_wbl2 sc1
6848 ; GFX940-NEXT: flat_atomic_add_f64 v[0:1], v[2:3]
6849 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6850 ; GFX940-NEXT: buffer_inv sc1
6851 ; GFX940-NEXT: s_setpc_b64 s[30:31]
6853 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6855 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6856 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
6857 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, -1, v1, vcc_lo
6858 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
6859 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
6860 ; GFX11-NEXT: flat_load_b64 v[6:7], v[4:5]
6861 ; GFX11-NEXT: s_mov_b32 s0, 0
6862 ; GFX11-NEXT: .LBB35_1: ; %atomicrmw.start
6863 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
6864 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6865 ; GFX11-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6866 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
6867 ; GFX11-NEXT: flat_atomic_cmpswap_b64 v[4:5], v[0:1], v[4:7] glc
6868 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6869 ; GFX11-NEXT: buffer_gl1_inv
6870 ; GFX11-NEXT: buffer_gl0_inv
6871 ; GFX11-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6872 ; GFX11-NEXT: v_dual_mov_b32 v7, v5 :: v_dual_mov_b32 v6, v4
6873 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
6874 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
6875 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
6876 ; GFX11-NEXT: s_cbranch_execnz .LBB35_1
6877 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
6878 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
6879 ; GFX11-NEXT: s_setpc_b64 s[30:31]
6881 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6883 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6884 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
6885 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
6886 ; GFX10-NEXT: s_mov_b32 s4, 0
6887 ; GFX10-NEXT: flat_load_dwordx2 v[6:7], v[0:1]
6888 ; GFX10-NEXT: .LBB35_1: ; %atomicrmw.start
6889 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
6890 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6891 ; GFX10-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6892 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
6893 ; GFX10-NEXT: flat_atomic_cmpswap_x2 v[4:5], v[0:1], v[4:7] glc
6894 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6895 ; GFX10-NEXT: buffer_gl1_inv
6896 ; GFX10-NEXT: buffer_gl0_inv
6897 ; GFX10-NEXT: v_cmp_eq_u64_e32 vcc_lo, v[4:5], v[6:7]
6898 ; GFX10-NEXT: v_mov_b32_e32 v7, v5
6899 ; GFX10-NEXT: v_mov_b32_e32 v6, v4
6900 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
6901 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
6902 ; GFX10-NEXT: s_cbranch_execnz .LBB35_1
6903 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
6904 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
6905 ; GFX10-NEXT: s_setpc_b64 s[30:31]
6907 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6909 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6910 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
6911 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
6912 ; GFX90A-NEXT: flat_atomic_add_f64 v[0:1], v[2:3]
6913 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6914 ; GFX90A-NEXT: buffer_wbinvl1
6915 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
6917 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6919 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6920 ; GFX908-NEXT: v_add_co_u32_e32 v8, vcc, 0xfffff800, v0
6921 ; GFX908-NEXT: v_addc_co_u32_e32 v9, vcc, -1, v1, vcc
6922 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
6923 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
6924 ; GFX908-NEXT: flat_load_dwordx2 v[6:7], v[0:1]
6925 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
6926 ; GFX908-NEXT: .LBB35_1: ; %atomicrmw.start
6927 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
6928 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6929 ; GFX908-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6930 ; GFX908-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[8:9], v[4:7] glc
6931 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6932 ; GFX908-NEXT: buffer_wbinvl1
6933 ; GFX908-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[6:7]
6934 ; GFX908-NEXT: v_mov_b32_e32 v7, v1
6935 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6936 ; GFX908-NEXT: v_mov_b32_e32 v6, v0
6937 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
6938 ; GFX908-NEXT: s_cbranch_execnz .LBB35_1
6939 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
6940 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
6941 ; GFX908-NEXT: s_setpc_b64 s[30:31]
6943 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6945 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6946 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0xfffff800, v0
6947 ; GFX8-NEXT: v_addc_u32_e32 v9, vcc, -1, v1, vcc
6948 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff804, v0
6949 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
6950 ; GFX8-NEXT: flat_load_dword v7, v[0:1]
6951 ; GFX8-NEXT: flat_load_dword v6, v[8:9]
6952 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
6953 ; GFX8-NEXT: .LBB35_1: ; %atomicrmw.start
6954 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
6955 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6956 ; GFX8-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6957 ; GFX8-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[8:9], v[4:7] glc
6958 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6959 ; GFX8-NEXT: buffer_wbinvl1
6960 ; GFX8-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[6:7]
6961 ; GFX8-NEXT: v_mov_b32_e32 v7, v1
6962 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6963 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
6964 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
6965 ; GFX8-NEXT: s_cbranch_execnz .LBB35_1
6966 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
6967 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
6968 ; GFX8-NEXT: s_setpc_b64 s[30:31]
6970 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f64__offset12b_neg__amdgpu_no_fine_grained_memory:
6972 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
6973 ; GFX7-NEXT: v_add_i32_e32 v8, vcc, 0xfffff800, v0
6974 ; GFX7-NEXT: v_addc_u32_e32 v9, vcc, -1, v1, vcc
6975 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0xfffff804, v0
6976 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
6977 ; GFX7-NEXT: flat_load_dword v7, v[0:1]
6978 ; GFX7-NEXT: flat_load_dword v6, v[8:9]
6979 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
6980 ; GFX7-NEXT: .LBB35_1: ; %atomicrmw.start
6981 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
6982 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6983 ; GFX7-NEXT: v_add_f64 v[4:5], v[6:7], v[2:3]
6984 ; GFX7-NEXT: flat_atomic_cmpswap_x2 v[0:1], v[8:9], v[4:7] glc
6985 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6986 ; GFX7-NEXT: buffer_wbinvl1
6987 ; GFX7-NEXT: v_cmp_eq_u64_e32 vcc, v[0:1], v[6:7]
6988 ; GFX7-NEXT: v_mov_b32_e32 v7, v1
6989 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
6990 ; GFX7-NEXT: v_mov_b32_e32 v6, v0
6991 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
6992 ; GFX7-NEXT: s_cbranch_execnz .LBB35_1
6993 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
6994 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
6995 ; GFX7-NEXT: s_setpc_b64 s[30:31]
6996 %gep = getelementptr double, ptr %ptr, i64 -256
6997 %unused = atomicrmw fadd ptr %gep, double %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
7001 ; --------------------------------------------------------------------
7003 ; --------------------------------------------------------------------
7005 define half @flat_agent_atomic_fadd_ret_f16__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
7006 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f16__amdgpu_no_fine_grained_memory:
7008 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7009 ; GFX12-NEXT: s_wait_expcnt 0x0
7010 ; GFX12-NEXT: s_wait_samplecnt 0x0
7011 ; GFX12-NEXT: s_wait_bvhcnt 0x0
7012 ; GFX12-NEXT: s_wait_kmcnt 0x0
7013 ; GFX12-NEXT: v_mov_b32_e32 v3, v0
7014 ; GFX12-NEXT: s_mov_b32 s0, 0
7015 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7016 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
7017 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
7018 ; GFX12-NEXT: flat_load_b32 v5, v[0:1]
7019 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7020 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7021 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7022 ; GFX12-NEXT: v_not_b32_e32 v4, v4
7023 ; GFX12-NEXT: .LBB36_1: ; %atomicrmw.start
7024 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
7025 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7026 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
7027 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7028 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7029 ; GFX12-NEXT: v_add_f16_e32 v5, v5, v2
7030 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7031 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff, v5
7032 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7033 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7034 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
7035 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
7036 ; GFX12-NEXT: s_wait_storecnt 0x0
7037 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
7038 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7039 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
7040 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7041 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
7042 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7043 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7044 ; GFX12-NEXT: s_cbranch_execnz .LBB36_1
7045 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
7046 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
7047 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7048 ; GFX12-NEXT: s_setpc_b64 s[30:31]
7050 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f16__amdgpu_no_fine_grained_memory:
7052 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7053 ; GFX940-NEXT: v_mov_b32_e32 v3, v0
7054 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v3
7055 ; GFX940-NEXT: flat_load_dword v4, v[0:1]
7056 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v3
7057 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7058 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
7059 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v3, s0
7060 ; GFX940-NEXT: v_not_b32_e32 v5, v5
7061 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
7062 ; GFX940-NEXT: .LBB36_1: ; %atomicrmw.start
7063 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
7064 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7065 ; GFX940-NEXT: v_mov_b32_e32 v7, v4
7066 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v3, v7
7067 ; GFX940-NEXT: v_add_f16_e32 v4, v4, v2
7068 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7069 ; GFX940-NEXT: v_and_or_b32 v6, v7, v5, v4
7070 ; GFX940-NEXT: buffer_wbl2 sc1
7071 ; GFX940-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] sc0
7072 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7073 ; GFX940-NEXT: buffer_inv sc1
7074 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
7075 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
7076 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
7077 ; GFX940-NEXT: s_cbranch_execnz .LBB36_1
7078 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
7079 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
7080 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v4
7081 ; GFX940-NEXT: s_setpc_b64 s[30:31]
7083 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f16__amdgpu_no_fine_grained_memory:
7085 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7086 ; GFX11-NEXT: v_mov_b32_e32 v3, v0
7087 ; GFX11-NEXT: s_mov_b32 s0, 0
7088 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7089 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
7090 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
7091 ; GFX11-NEXT: flat_load_b32 v5, v[0:1]
7092 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7093 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7094 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7095 ; GFX11-NEXT: v_not_b32_e32 v4, v4
7096 ; GFX11-NEXT: .LBB36_1: ; %atomicrmw.start
7097 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
7098 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7099 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
7100 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7101 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7102 ; GFX11-NEXT: v_add_f16_e32 v5, v5, v2
7103 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7104 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff, v5
7105 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7106 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7107 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
7108 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
7109 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] glc
7110 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7111 ; GFX11-NEXT: buffer_gl1_inv
7112 ; GFX11-NEXT: buffer_gl0_inv
7113 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7114 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
7115 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7116 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7117 ; GFX11-NEXT: s_cbranch_execnz .LBB36_1
7118 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
7119 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
7120 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7121 ; GFX11-NEXT: s_setpc_b64 s[30:31]
7123 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f16__amdgpu_no_fine_grained_memory:
7125 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7126 ; GFX10-NEXT: v_mov_b32_e32 v3, v0
7127 ; GFX10-NEXT: s_mov_b32 s4, 0
7128 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
7129 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
7130 ; GFX10-NEXT: flat_load_dword v5, v[0:1]
7131 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7132 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7133 ; GFX10-NEXT: v_not_b32_e32 v4, v4
7134 ; GFX10-NEXT: .LBB36_1: ; %atomicrmw.start
7135 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
7136 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7137 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
7138 ; GFX10-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7139 ; GFX10-NEXT: v_add_f16_e32 v5, v5, v2
7140 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
7141 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
7142 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
7143 ; GFX10-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7144 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7145 ; GFX10-NEXT: buffer_gl1_inv
7146 ; GFX10-NEXT: buffer_gl0_inv
7147 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7148 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
7149 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
7150 ; GFX10-NEXT: s_cbranch_execnz .LBB36_1
7151 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
7152 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
7153 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7154 ; GFX10-NEXT: s_setpc_b64 s[30:31]
7156 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f16__amdgpu_no_fine_grained_memory:
7158 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7159 ; GFX90A-NEXT: v_mov_b32_e32 v3, v0
7160 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
7161 ; GFX90A-NEXT: flat_load_dword v4, v[0:1]
7162 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
7163 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7164 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
7165 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v3, s4
7166 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
7167 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
7168 ; GFX90A-NEXT: .LBB36_1: ; %atomicrmw.start
7169 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
7170 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7171 ; GFX90A-NEXT: v_mov_b32_e32 v7, v4
7172 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v3, v7
7173 ; GFX90A-NEXT: v_add_f16_e32 v4, v4, v2
7174 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7175 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v5, v4
7176 ; GFX90A-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] glc
7177 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7178 ; GFX90A-NEXT: buffer_wbinvl1
7179 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
7180 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7181 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
7182 ; GFX90A-NEXT: s_cbranch_execnz .LBB36_1
7183 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
7184 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
7185 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v4
7186 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
7188 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f16__amdgpu_no_fine_grained_memory:
7190 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7191 ; GFX908-NEXT: v_mov_b32_e32 v3, v0
7192 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
7193 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
7194 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
7195 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7196 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
7197 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v3, s4
7198 ; GFX908-NEXT: v_not_b32_e32 v5, v5
7199 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
7200 ; GFX908-NEXT: .LBB36_1: ; %atomicrmw.start
7201 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
7202 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7203 ; GFX908-NEXT: v_mov_b32_e32 v7, v4
7204 ; GFX908-NEXT: v_lshrrev_b32_e32 v4, v3, v7
7205 ; GFX908-NEXT: v_add_f16_e32 v4, v4, v2
7206 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7207 ; GFX908-NEXT: v_and_or_b32 v6, v7, v5, v4
7208 ; GFX908-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] glc
7209 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7210 ; GFX908-NEXT: buffer_wbinvl1
7211 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
7212 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7213 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
7214 ; GFX908-NEXT: s_cbranch_execnz .LBB36_1
7215 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
7216 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
7217 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v4
7218 ; GFX908-NEXT: s_setpc_b64 s[30:31]
7220 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f16__amdgpu_no_fine_grained_memory:
7222 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7223 ; GFX8-NEXT: v_mov_b32_e32 v3, v0
7224 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
7225 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
7226 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
7227 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7228 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
7229 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
7230 ; GFX8-NEXT: v_not_b32_e32 v4, v4
7231 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
7232 ; GFX8-NEXT: .LBB36_1: ; %atomicrmw.start
7233 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
7234 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7235 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
7236 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7237 ; GFX8-NEXT: v_add_f16_e32 v5, v5, v2
7238 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
7239 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7240 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
7241 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7242 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7243 ; GFX8-NEXT: buffer_wbinvl1
7244 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
7245 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7246 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
7247 ; GFX8-NEXT: s_cbranch_execnz .LBB36_1
7248 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
7249 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
7250 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7251 ; GFX8-NEXT: s_setpc_b64 s[30:31]
7253 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f16__amdgpu_no_fine_grained_memory:
7255 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7256 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
7257 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
7258 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
7259 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v2
7260 ; GFX7-NEXT: v_and_b32_e32 v2, 3, v3
7261 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v2
7262 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
7263 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v4
7264 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v2
7265 ; GFX7-NEXT: v_not_b32_e32 v4, v4
7266 ; GFX7-NEXT: .LBB36_1: ; %atomicrmw.start
7267 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
7268 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7269 ; GFX7-NEXT: v_mov_b32_e32 v6, v5
7270 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, v2, v6
7271 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
7272 ; GFX7-NEXT: v_and_b32_e32 v7, v6, v4
7273 ; GFX7-NEXT: v_add_f32_e32 v5, v5, v3
7274 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
7275 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, v2, v5
7276 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v5
7277 ; GFX7-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7278 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7279 ; GFX7-NEXT: buffer_wbinvl1
7280 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
7281 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7282 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
7283 ; GFX7-NEXT: s_cbranch_execnz .LBB36_1
7284 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
7285 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
7286 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v2, v5
7287 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
7288 ; GFX7-NEXT: s_setpc_b64 s[30:31]
7289 %result = atomicrmw fadd ptr %ptr, half %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
7293 define half @flat_agent_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
7294 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
7296 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7297 ; GFX12-NEXT: s_wait_expcnt 0x0
7298 ; GFX12-NEXT: s_wait_samplecnt 0x0
7299 ; GFX12-NEXT: s_wait_bvhcnt 0x0
7300 ; GFX12-NEXT: s_wait_kmcnt 0x0
7301 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
7302 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
7303 ; GFX12-NEXT: s_mov_b32 s0, 0
7304 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7305 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
7306 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
7307 ; GFX12-NEXT: flat_load_b32 v5, v[0:1]
7308 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7309 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7310 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7311 ; GFX12-NEXT: v_not_b32_e32 v4, v4
7312 ; GFX12-NEXT: .LBB37_1: ; %atomicrmw.start
7313 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
7314 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7315 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
7316 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7317 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7318 ; GFX12-NEXT: v_add_f16_e32 v5, v5, v2
7319 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7320 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff, v5
7321 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7322 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7323 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
7324 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
7325 ; GFX12-NEXT: s_wait_storecnt 0x0
7326 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
7327 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7328 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
7329 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7330 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
7331 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7332 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7333 ; GFX12-NEXT: s_cbranch_execnz .LBB37_1
7334 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
7335 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
7336 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7337 ; GFX12-NEXT: s_setpc_b64 s[30:31]
7339 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
7341 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7342 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
7343 ; GFX940-NEXT: v_lshl_add_u64 v[6:7], v[0:1], 0, s[0:1]
7344 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v6
7345 ; GFX940-NEXT: v_mov_b32_e32 v1, v7
7346 ; GFX940-NEXT: flat_load_dword v4, v[0:1]
7347 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v6
7348 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7349 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
7350 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v3, s0
7351 ; GFX940-NEXT: v_not_b32_e32 v5, v5
7352 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
7353 ; GFX940-NEXT: .LBB37_1: ; %atomicrmw.start
7354 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
7355 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7356 ; GFX940-NEXT: v_mov_b32_e32 v7, v4
7357 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v3, v7
7358 ; GFX940-NEXT: v_add_f16_e32 v4, v4, v2
7359 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7360 ; GFX940-NEXT: v_and_or_b32 v6, v7, v5, v4
7361 ; GFX940-NEXT: buffer_wbl2 sc1
7362 ; GFX940-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] sc0
7363 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7364 ; GFX940-NEXT: buffer_inv sc1
7365 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
7366 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
7367 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
7368 ; GFX940-NEXT: s_cbranch_execnz .LBB37_1
7369 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
7370 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
7371 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v4
7372 ; GFX940-NEXT: s_setpc_b64 s[30:31]
7374 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
7376 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7377 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
7378 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
7379 ; GFX11-NEXT: s_mov_b32 s0, 0
7380 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7381 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
7382 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
7383 ; GFX11-NEXT: flat_load_b32 v5, v[0:1]
7384 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7385 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7386 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7387 ; GFX11-NEXT: v_not_b32_e32 v4, v4
7388 ; GFX11-NEXT: .LBB37_1: ; %atomicrmw.start
7389 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
7390 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7391 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
7392 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7393 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7394 ; GFX11-NEXT: v_add_f16_e32 v5, v5, v2
7395 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7396 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff, v5
7397 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7398 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7399 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
7400 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
7401 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] glc
7402 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7403 ; GFX11-NEXT: buffer_gl1_inv
7404 ; GFX11-NEXT: buffer_gl0_inv
7405 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7406 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
7407 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7408 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7409 ; GFX11-NEXT: s_cbranch_execnz .LBB37_1
7410 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
7411 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
7412 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7413 ; GFX11-NEXT: s_setpc_b64 s[30:31]
7415 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
7417 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7418 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
7419 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
7420 ; GFX10-NEXT: s_mov_b32 s4, 0
7421 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
7422 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
7423 ; GFX10-NEXT: flat_load_dword v5, v[0:1]
7424 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7425 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7426 ; GFX10-NEXT: v_not_b32_e32 v4, v4
7427 ; GFX10-NEXT: .LBB37_1: ; %atomicrmw.start
7428 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
7429 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7430 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
7431 ; GFX10-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7432 ; GFX10-NEXT: v_add_f16_e32 v5, v5, v2
7433 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
7434 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
7435 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
7436 ; GFX10-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7437 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7438 ; GFX10-NEXT: buffer_gl1_inv
7439 ; GFX10-NEXT: buffer_gl0_inv
7440 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7441 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
7442 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
7443 ; GFX10-NEXT: s_cbranch_execnz .LBB37_1
7444 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
7445 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
7446 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7447 ; GFX10-NEXT: s_setpc_b64 s[30:31]
7449 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
7451 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7452 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
7453 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
7454 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
7455 ; GFX90A-NEXT: flat_load_dword v4, v[0:1]
7456 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
7457 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7458 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
7459 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v3, s4
7460 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
7461 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
7462 ; GFX90A-NEXT: .LBB37_1: ; %atomicrmw.start
7463 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
7464 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7465 ; GFX90A-NEXT: v_mov_b32_e32 v7, v4
7466 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v3, v7
7467 ; GFX90A-NEXT: v_add_f16_e32 v4, v4, v2
7468 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7469 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v5, v4
7470 ; GFX90A-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] glc
7471 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7472 ; GFX90A-NEXT: buffer_wbinvl1
7473 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
7474 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7475 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
7476 ; GFX90A-NEXT: s_cbranch_execnz .LBB37_1
7477 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
7478 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
7479 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v4
7480 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
7482 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
7484 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7485 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
7486 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
7487 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
7488 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
7489 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
7490 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7491 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
7492 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v3, s4
7493 ; GFX908-NEXT: v_not_b32_e32 v5, v5
7494 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
7495 ; GFX908-NEXT: .LBB37_1: ; %atomicrmw.start
7496 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
7497 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7498 ; GFX908-NEXT: v_mov_b32_e32 v7, v4
7499 ; GFX908-NEXT: v_lshrrev_b32_e32 v4, v3, v7
7500 ; GFX908-NEXT: v_add_f16_e32 v4, v4, v2
7501 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7502 ; GFX908-NEXT: v_and_or_b32 v6, v7, v5, v4
7503 ; GFX908-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] glc
7504 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7505 ; GFX908-NEXT: buffer_wbinvl1
7506 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
7507 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7508 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
7509 ; GFX908-NEXT: s_cbranch_execnz .LBB37_1
7510 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
7511 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
7512 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v4
7513 ; GFX908-NEXT: s_setpc_b64 s[30:31]
7515 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
7517 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7518 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
7519 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
7520 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
7521 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
7522 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
7523 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7524 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
7525 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
7526 ; GFX8-NEXT: v_not_b32_e32 v4, v4
7527 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
7528 ; GFX8-NEXT: .LBB37_1: ; %atomicrmw.start
7529 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
7530 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7531 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
7532 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7533 ; GFX8-NEXT: v_add_f16_e32 v5, v5, v2
7534 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
7535 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7536 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
7537 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7538 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7539 ; GFX8-NEXT: buffer_wbinvl1
7540 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
7541 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7542 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
7543 ; GFX8-NEXT: s_cbranch_execnz .LBB37_1
7544 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
7545 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
7546 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7547 ; GFX8-NEXT: s_setpc_b64 s[30:31]
7549 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
7551 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7552 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0x7fe, v0
7553 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
7554 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
7555 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
7556 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v2
7557 ; GFX7-NEXT: v_and_b32_e32 v2, 3, v3
7558 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v2
7559 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
7560 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v4
7561 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v2
7562 ; GFX7-NEXT: v_not_b32_e32 v4, v4
7563 ; GFX7-NEXT: .LBB37_1: ; %atomicrmw.start
7564 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
7565 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7566 ; GFX7-NEXT: v_mov_b32_e32 v6, v5
7567 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, v2, v6
7568 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
7569 ; GFX7-NEXT: v_and_b32_e32 v7, v6, v4
7570 ; GFX7-NEXT: v_add_f32_e32 v5, v5, v3
7571 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
7572 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, v2, v5
7573 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v5
7574 ; GFX7-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7575 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7576 ; GFX7-NEXT: buffer_wbinvl1
7577 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
7578 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7579 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
7580 ; GFX7-NEXT: s_cbranch_execnz .LBB37_1
7581 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
7582 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
7583 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v2, v5
7584 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
7585 ; GFX7-NEXT: s_setpc_b64 s[30:31]
7586 %gep = getelementptr half, ptr %ptr, i64 1023
7587 %result = atomicrmw fadd ptr %gep, half %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
7591 define half @flat_agent_atomic_fadd_ret_f16__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
7592 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
7594 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7595 ; GFX12-NEXT: s_wait_expcnt 0x0
7596 ; GFX12-NEXT: s_wait_samplecnt 0x0
7597 ; GFX12-NEXT: s_wait_bvhcnt 0x0
7598 ; GFX12-NEXT: s_wait_kmcnt 0x0
7599 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
7600 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
7601 ; GFX12-NEXT: s_mov_b32 s0, 0
7602 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7603 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
7604 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
7605 ; GFX12-NEXT: flat_load_b32 v5, v[0:1]
7606 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7607 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7608 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7609 ; GFX12-NEXT: v_not_b32_e32 v4, v4
7610 ; GFX12-NEXT: .LBB38_1: ; %atomicrmw.start
7611 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
7612 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7613 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
7614 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7615 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7616 ; GFX12-NEXT: v_add_f16_e32 v5, v5, v2
7617 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7618 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff, v5
7619 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7620 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7621 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
7622 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
7623 ; GFX12-NEXT: s_wait_storecnt 0x0
7624 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
7625 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7626 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
7627 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7628 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
7629 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7630 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7631 ; GFX12-NEXT: s_cbranch_execnz .LBB38_1
7632 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
7633 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
7634 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7635 ; GFX12-NEXT: s_setpc_b64 s[30:31]
7637 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
7639 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7640 ; GFX940-NEXT: s_movk_i32 s0, 0xf800
7641 ; GFX940-NEXT: s_mov_b32 s1, -1
7642 ; GFX940-NEXT: v_lshl_add_u64 v[6:7], v[0:1], 0, s[0:1]
7643 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v6
7644 ; GFX940-NEXT: v_mov_b32_e32 v1, v7
7645 ; GFX940-NEXT: flat_load_dword v4, v[0:1]
7646 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v6
7647 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7648 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
7649 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v3, s0
7650 ; GFX940-NEXT: v_not_b32_e32 v5, v5
7651 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
7652 ; GFX940-NEXT: .LBB38_1: ; %atomicrmw.start
7653 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
7654 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7655 ; GFX940-NEXT: v_mov_b32_e32 v7, v4
7656 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v3, v7
7657 ; GFX940-NEXT: v_add_f16_e32 v4, v4, v2
7658 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7659 ; GFX940-NEXT: v_and_or_b32 v6, v7, v5, v4
7660 ; GFX940-NEXT: buffer_wbl2 sc1
7661 ; GFX940-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] sc0
7662 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7663 ; GFX940-NEXT: buffer_inv sc1
7664 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
7665 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
7666 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
7667 ; GFX940-NEXT: s_cbranch_execnz .LBB38_1
7668 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
7669 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
7670 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v4
7671 ; GFX940-NEXT: s_setpc_b64 s[30:31]
7673 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
7675 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7676 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
7677 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
7678 ; GFX11-NEXT: s_mov_b32 s0, 0
7679 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7680 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
7681 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
7682 ; GFX11-NEXT: flat_load_b32 v5, v[0:1]
7683 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7684 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7685 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7686 ; GFX11-NEXT: v_not_b32_e32 v4, v4
7687 ; GFX11-NEXT: .LBB38_1: ; %atomicrmw.start
7688 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
7689 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7690 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
7691 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7692 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7693 ; GFX11-NEXT: v_add_f16_e32 v5, v5, v2
7694 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7695 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff, v5
7696 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7697 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7698 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
7699 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
7700 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] glc
7701 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7702 ; GFX11-NEXT: buffer_gl1_inv
7703 ; GFX11-NEXT: buffer_gl0_inv
7704 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7705 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
7706 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7707 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7708 ; GFX11-NEXT: s_cbranch_execnz .LBB38_1
7709 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
7710 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
7711 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7712 ; GFX11-NEXT: s_setpc_b64 s[30:31]
7714 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
7716 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7717 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
7718 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
7719 ; GFX10-NEXT: s_mov_b32 s4, 0
7720 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
7721 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
7722 ; GFX10-NEXT: flat_load_dword v5, v[0:1]
7723 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7724 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
7725 ; GFX10-NEXT: v_not_b32_e32 v4, v4
7726 ; GFX10-NEXT: .LBB38_1: ; %atomicrmw.start
7727 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
7728 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7729 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
7730 ; GFX10-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7731 ; GFX10-NEXT: v_add_f16_e32 v5, v5, v2
7732 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
7733 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
7734 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
7735 ; GFX10-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7736 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7737 ; GFX10-NEXT: buffer_gl1_inv
7738 ; GFX10-NEXT: buffer_gl0_inv
7739 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
7740 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
7741 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
7742 ; GFX10-NEXT: s_cbranch_execnz .LBB38_1
7743 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
7744 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
7745 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7746 ; GFX10-NEXT: s_setpc_b64 s[30:31]
7748 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
7750 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7751 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
7752 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
7753 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
7754 ; GFX90A-NEXT: flat_load_dword v4, v[0:1]
7755 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
7756 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7757 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
7758 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v3, s4
7759 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
7760 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
7761 ; GFX90A-NEXT: .LBB38_1: ; %atomicrmw.start
7762 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
7763 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7764 ; GFX90A-NEXT: v_mov_b32_e32 v7, v4
7765 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v3, v7
7766 ; GFX90A-NEXT: v_add_f16_e32 v4, v4, v2
7767 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7768 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v5, v4
7769 ; GFX90A-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] glc
7770 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7771 ; GFX90A-NEXT: buffer_wbinvl1
7772 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
7773 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7774 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
7775 ; GFX90A-NEXT: s_cbranch_execnz .LBB38_1
7776 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
7777 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
7778 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v4
7779 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
7781 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
7783 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7784 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
7785 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
7786 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
7787 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
7788 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
7789 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7790 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
7791 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v3, s4
7792 ; GFX908-NEXT: v_not_b32_e32 v5, v5
7793 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
7794 ; GFX908-NEXT: .LBB38_1: ; %atomicrmw.start
7795 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
7796 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7797 ; GFX908-NEXT: v_mov_b32_e32 v7, v4
7798 ; GFX908-NEXT: v_lshrrev_b32_e32 v4, v3, v7
7799 ; GFX908-NEXT: v_add_f16_e32 v4, v4, v2
7800 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7801 ; GFX908-NEXT: v_and_or_b32 v6, v7, v5, v4
7802 ; GFX908-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] glc
7803 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7804 ; GFX908-NEXT: buffer_wbinvl1
7805 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
7806 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7807 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
7808 ; GFX908-NEXT: s_cbranch_execnz .LBB38_1
7809 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
7810 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
7811 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v4
7812 ; GFX908-NEXT: s_setpc_b64 s[30:31]
7814 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
7816 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7817 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
7818 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
7819 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
7820 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
7821 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
7822 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7823 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
7824 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
7825 ; GFX8-NEXT: v_not_b32_e32 v4, v4
7826 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
7827 ; GFX8-NEXT: .LBB38_1: ; %atomicrmw.start
7828 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
7829 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7830 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
7831 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, v3, v6
7832 ; GFX8-NEXT: v_add_f16_e32 v5, v5, v2
7833 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
7834 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, v3, v5
7835 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
7836 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7837 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7838 ; GFX8-NEXT: buffer_wbinvl1
7839 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
7840 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7841 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
7842 ; GFX8-NEXT: s_cbranch_execnz .LBB38_1
7843 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
7844 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
7845 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
7846 ; GFX8-NEXT: s_setpc_b64 s[30:31]
7848 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
7850 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7851 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0xfffff800, v0
7852 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
7853 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
7854 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
7855 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v2
7856 ; GFX7-NEXT: v_and_b32_e32 v2, 3, v3
7857 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v2
7858 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
7859 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v4
7860 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v2
7861 ; GFX7-NEXT: v_not_b32_e32 v4, v4
7862 ; GFX7-NEXT: .LBB38_1: ; %atomicrmw.start
7863 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
7864 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7865 ; GFX7-NEXT: v_mov_b32_e32 v6, v5
7866 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, v2, v6
7867 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
7868 ; GFX7-NEXT: v_and_b32_e32 v7, v6, v4
7869 ; GFX7-NEXT: v_add_f32_e32 v5, v5, v3
7870 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
7871 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, v2, v5
7872 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v5
7873 ; GFX7-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
7874 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7875 ; GFX7-NEXT: buffer_wbinvl1
7876 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
7877 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
7878 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
7879 ; GFX7-NEXT: s_cbranch_execnz .LBB38_1
7880 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
7881 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
7882 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v2, v5
7883 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
7884 ; GFX7-NEXT: s_setpc_b64 s[30:31]
7885 %gep = getelementptr half, ptr %ptr, i64 -1024
7886 %result = atomicrmw fadd ptr %gep, half %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
7890 define void @flat_agent_atomic_fadd_noret_f16__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
7891 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f16__amdgpu_no_fine_grained_memory:
7893 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7894 ; GFX12-NEXT: s_wait_expcnt 0x0
7895 ; GFX12-NEXT: s_wait_samplecnt 0x0
7896 ; GFX12-NEXT: s_wait_bvhcnt 0x0
7897 ; GFX12-NEXT: s_wait_kmcnt 0x0
7898 ; GFX12-NEXT: v_mov_b32_e32 v3, v0
7899 ; GFX12-NEXT: s_mov_b32 s0, 0
7900 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7901 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
7902 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
7903 ; GFX12-NEXT: flat_load_b32 v4, v[0:1]
7904 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 3, v3
7905 ; GFX12-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
7906 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
7907 ; GFX12-NEXT: v_not_b32_e32 v6, v3
7908 ; GFX12-NEXT: .LBB39_1: ; %atomicrmw.start
7909 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
7910 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7911 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v5, v4
7912 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7913 ; GFX12-NEXT: v_add_f16_e32 v3, v3, v2
7914 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
7915 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7916 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v5, v3
7917 ; GFX12-NEXT: v_and_or_b32 v3, v4, v6, v3
7918 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
7919 ; GFX12-NEXT: s_wait_storecnt 0x0
7920 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
7921 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
7922 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
7923 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
7924 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
7925 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
7926 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7927 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7928 ; GFX12-NEXT: s_cbranch_execnz .LBB39_1
7929 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
7930 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
7931 ; GFX12-NEXT: s_setpc_b64 s[30:31]
7933 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f16__amdgpu_no_fine_grained_memory:
7935 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7936 ; GFX940-NEXT: v_mov_b32_e32 v3, v0
7937 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v3
7938 ; GFX940-NEXT: flat_load_dword v5, v[0:1]
7939 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v3
7940 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
7941 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
7942 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
7943 ; GFX940-NEXT: v_not_b32_e32 v6, v4
7944 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
7945 ; GFX940-NEXT: .LBB39_1: ; %atomicrmw.start
7946 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
7947 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7948 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v3, v5
7949 ; GFX940-NEXT: v_add_f16_e32 v4, v4, v2
7950 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v3, v4
7951 ; GFX940-NEXT: v_and_or_b32 v4, v5, v6, v4
7952 ; GFX940-NEXT: buffer_wbl2 sc1
7953 ; GFX940-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] sc0
7954 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7955 ; GFX940-NEXT: buffer_inv sc1
7956 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
7957 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
7958 ; GFX940-NEXT: v_mov_b32_e32 v5, v4
7959 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
7960 ; GFX940-NEXT: s_cbranch_execnz .LBB39_1
7961 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
7962 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
7963 ; GFX940-NEXT: s_setpc_b64 s[30:31]
7965 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f16__amdgpu_no_fine_grained_memory:
7967 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
7968 ; GFX11-NEXT: v_mov_b32_e32 v3, v0
7969 ; GFX11-NEXT: s_mov_b32 s0, 0
7970 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
7971 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
7972 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
7973 ; GFX11-NEXT: flat_load_b32 v4, v[0:1]
7974 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 3, v3
7975 ; GFX11-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
7976 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
7977 ; GFX11-NEXT: v_not_b32_e32 v6, v3
7978 ; GFX11-NEXT: .LBB39_1: ; %atomicrmw.start
7979 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
7980 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7981 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v5, v4
7982 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7983 ; GFX11-NEXT: v_add_f16_e32 v3, v3, v2
7984 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
7985 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
7986 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v5, v3
7987 ; GFX11-NEXT: v_and_or_b32 v3, v4, v6, v3
7988 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
7989 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
7990 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7991 ; GFX11-NEXT: buffer_gl1_inv
7992 ; GFX11-NEXT: buffer_gl0_inv
7993 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
7994 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
7995 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
7996 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
7997 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
7998 ; GFX11-NEXT: s_cbranch_execnz .LBB39_1
7999 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
8000 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
8001 ; GFX11-NEXT: s_setpc_b64 s[30:31]
8003 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f16__amdgpu_no_fine_grained_memory:
8005 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8006 ; GFX10-NEXT: v_mov_b32_e32 v3, v0
8007 ; GFX10-NEXT: s_mov_b32 s4, 0
8008 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
8009 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
8010 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
8011 ; GFX10-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8012 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8013 ; GFX10-NEXT: v_not_b32_e32 v6, v3
8014 ; GFX10-NEXT: .LBB39_1: ; %atomicrmw.start
8015 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
8016 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8017 ; GFX10-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8018 ; GFX10-NEXT: v_add_f16_e32 v3, v3, v2
8019 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
8020 ; GFX10-NEXT: v_and_or_b32 v3, v4, v6, v3
8021 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
8022 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8023 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8024 ; GFX10-NEXT: buffer_gl1_inv
8025 ; GFX10-NEXT: buffer_gl0_inv
8026 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8027 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
8028 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
8029 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
8030 ; GFX10-NEXT: s_cbranch_execnz .LBB39_1
8031 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
8032 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
8033 ; GFX10-NEXT: s_setpc_b64 s[30:31]
8035 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f16__amdgpu_no_fine_grained_memory:
8037 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8038 ; GFX90A-NEXT: v_mov_b32_e32 v3, v0
8039 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
8040 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
8041 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
8042 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8043 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
8044 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
8045 ; GFX90A-NEXT: v_not_b32_e32 v6, v4
8046 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
8047 ; GFX90A-NEXT: .LBB39_1: ; %atomicrmw.start
8048 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
8049 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8050 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v3, v5
8051 ; GFX90A-NEXT: v_add_f16_e32 v4, v4, v2
8052 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v3, v4
8053 ; GFX90A-NEXT: v_and_or_b32 v4, v5, v6, v4
8054 ; GFX90A-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] glc
8055 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8056 ; GFX90A-NEXT: buffer_wbinvl1
8057 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
8058 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8059 ; GFX90A-NEXT: v_mov_b32_e32 v5, v4
8060 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
8061 ; GFX90A-NEXT: s_cbranch_execnz .LBB39_1
8062 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
8063 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
8064 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
8066 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f16__amdgpu_no_fine_grained_memory:
8068 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8069 ; GFX908-NEXT: v_mov_b32_e32 v3, v0
8070 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
8071 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
8072 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
8073 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8074 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
8075 ; GFX908-NEXT: v_lshlrev_b32_e64 v3, v5, s4
8076 ; GFX908-NEXT: v_not_b32_e32 v6, v3
8077 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
8078 ; GFX908-NEXT: .LBB39_1: ; %atomicrmw.start
8079 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
8080 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8081 ; GFX908-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8082 ; GFX908-NEXT: v_add_f16_e32 v3, v3, v2
8083 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8084 ; GFX908-NEXT: v_and_or_b32 v3, v4, v6, v3
8085 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8086 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8087 ; GFX908-NEXT: buffer_wbinvl1
8088 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8089 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8090 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
8091 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
8092 ; GFX908-NEXT: s_cbranch_execnz .LBB39_1
8093 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
8094 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
8095 ; GFX908-NEXT: s_setpc_b64 s[30:31]
8097 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f16__amdgpu_no_fine_grained_memory:
8099 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8100 ; GFX8-NEXT: v_mov_b32_e32 v3, v0
8101 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
8102 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
8103 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
8104 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8105 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
8106 ; GFX8-NEXT: v_lshlrev_b32_e64 v3, v5, s4
8107 ; GFX8-NEXT: v_not_b32_e32 v6, v3
8108 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
8109 ; GFX8-NEXT: .LBB39_1: ; %atomicrmw.start
8110 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
8111 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8112 ; GFX8-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8113 ; GFX8-NEXT: v_add_f16_e32 v3, v3, v2
8114 ; GFX8-NEXT: v_and_b32_e32 v7, v4, v6
8115 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8116 ; GFX8-NEXT: v_or_b32_e32 v3, v7, v3
8117 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8118 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8119 ; GFX8-NEXT: buffer_wbinvl1
8120 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8121 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8122 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
8123 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
8124 ; GFX8-NEXT: s_cbranch_execnz .LBB39_1
8125 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
8126 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
8127 ; GFX8-NEXT: s_setpc_b64 s[30:31]
8129 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f16__amdgpu_no_fine_grained_memory:
8131 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8132 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
8133 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
8134 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
8135 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v2
8136 ; GFX7-NEXT: v_and_b32_e32 v2, 3, v3
8137 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v2
8138 ; GFX7-NEXT: v_lshl_b32_e32 v3, 0xffff, v2
8139 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
8140 ; GFX7-NEXT: v_not_b32_e32 v6, v3
8141 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
8142 ; GFX7-NEXT: .LBB39_1: ; %atomicrmw.start
8143 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
8144 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8145 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, v2, v4
8146 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
8147 ; GFX7-NEXT: v_and_b32_e32 v7, v4, v6
8148 ; GFX7-NEXT: v_add_f32_e32 v3, v3, v5
8149 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
8150 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, v2, v3
8151 ; GFX7-NEXT: v_or_b32_e32 v3, v7, v3
8152 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8153 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8154 ; GFX7-NEXT: buffer_wbinvl1
8155 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8156 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8157 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
8158 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
8159 ; GFX7-NEXT: s_cbranch_execnz .LBB39_1
8160 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
8161 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
8162 ; GFX7-NEXT: s_setpc_b64 s[30:31]
8163 %unused = atomicrmw fadd ptr %ptr, half %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
8167 define void @flat_agent_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
8168 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
8170 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8171 ; GFX12-NEXT: s_wait_expcnt 0x0
8172 ; GFX12-NEXT: s_wait_samplecnt 0x0
8173 ; GFX12-NEXT: s_wait_bvhcnt 0x0
8174 ; GFX12-NEXT: s_wait_kmcnt 0x0
8175 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
8176 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
8177 ; GFX12-NEXT: s_mov_b32 s0, 0
8178 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
8179 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
8180 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
8181 ; GFX12-NEXT: flat_load_b32 v4, v[0:1]
8182 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8183 ; GFX12-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8184 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
8185 ; GFX12-NEXT: v_not_b32_e32 v6, v3
8186 ; GFX12-NEXT: .LBB40_1: ; %atomicrmw.start
8187 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
8188 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8189 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8190 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8191 ; GFX12-NEXT: v_add_f16_e32 v3, v3, v2
8192 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
8193 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8194 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8195 ; GFX12-NEXT: v_and_or_b32 v3, v4, v6, v3
8196 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
8197 ; GFX12-NEXT: s_wait_storecnt 0x0
8198 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
8199 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8200 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
8201 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8202 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
8203 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
8204 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8205 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8206 ; GFX12-NEXT: s_cbranch_execnz .LBB40_1
8207 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
8208 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
8209 ; GFX12-NEXT: s_setpc_b64 s[30:31]
8211 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
8213 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8214 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
8215 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
8216 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
8217 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
8218 ; GFX940-NEXT: flat_load_dword v5, v[0:1]
8219 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
8220 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8221 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
8222 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
8223 ; GFX940-NEXT: v_not_b32_e32 v6, v4
8224 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
8225 ; GFX940-NEXT: .LBB40_1: ; %atomicrmw.start
8226 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
8227 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8228 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v3, v5
8229 ; GFX940-NEXT: v_add_f16_e32 v4, v4, v2
8230 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v3, v4
8231 ; GFX940-NEXT: v_and_or_b32 v4, v5, v6, v4
8232 ; GFX940-NEXT: buffer_wbl2 sc1
8233 ; GFX940-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] sc0
8234 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8235 ; GFX940-NEXT: buffer_inv sc1
8236 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
8237 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
8238 ; GFX940-NEXT: v_mov_b32_e32 v5, v4
8239 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
8240 ; GFX940-NEXT: s_cbranch_execnz .LBB40_1
8241 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
8242 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
8243 ; GFX940-NEXT: s_setpc_b64 s[30:31]
8245 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
8247 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8248 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
8249 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
8250 ; GFX11-NEXT: s_mov_b32 s0, 0
8251 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
8252 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
8253 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
8254 ; GFX11-NEXT: flat_load_b32 v4, v[0:1]
8255 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8256 ; GFX11-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8257 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
8258 ; GFX11-NEXT: v_not_b32_e32 v6, v3
8259 ; GFX11-NEXT: .LBB40_1: ; %atomicrmw.start
8260 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
8261 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8262 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8263 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8264 ; GFX11-NEXT: v_add_f16_e32 v3, v3, v2
8265 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
8266 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8267 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8268 ; GFX11-NEXT: v_and_or_b32 v3, v4, v6, v3
8269 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
8270 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
8271 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8272 ; GFX11-NEXT: buffer_gl1_inv
8273 ; GFX11-NEXT: buffer_gl0_inv
8274 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8275 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
8276 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
8277 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8278 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8279 ; GFX11-NEXT: s_cbranch_execnz .LBB40_1
8280 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
8281 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
8282 ; GFX11-NEXT: s_setpc_b64 s[30:31]
8284 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
8286 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8287 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
8288 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
8289 ; GFX10-NEXT: s_mov_b32 s4, 0
8290 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
8291 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
8292 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
8293 ; GFX10-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8294 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8295 ; GFX10-NEXT: v_not_b32_e32 v6, v3
8296 ; GFX10-NEXT: .LBB40_1: ; %atomicrmw.start
8297 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
8298 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8299 ; GFX10-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8300 ; GFX10-NEXT: v_add_f16_e32 v3, v3, v2
8301 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
8302 ; GFX10-NEXT: v_and_or_b32 v3, v4, v6, v3
8303 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
8304 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8305 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8306 ; GFX10-NEXT: buffer_gl1_inv
8307 ; GFX10-NEXT: buffer_gl0_inv
8308 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8309 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
8310 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
8311 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
8312 ; GFX10-NEXT: s_cbranch_execnz .LBB40_1
8313 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
8314 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
8315 ; GFX10-NEXT: s_setpc_b64 s[30:31]
8317 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
8319 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8320 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
8321 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
8322 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
8323 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
8324 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
8325 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8326 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
8327 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
8328 ; GFX90A-NEXT: v_not_b32_e32 v6, v4
8329 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
8330 ; GFX90A-NEXT: .LBB40_1: ; %atomicrmw.start
8331 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
8332 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8333 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v3, v5
8334 ; GFX90A-NEXT: v_add_f16_e32 v4, v4, v2
8335 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v3, v4
8336 ; GFX90A-NEXT: v_and_or_b32 v4, v5, v6, v4
8337 ; GFX90A-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] glc
8338 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8339 ; GFX90A-NEXT: buffer_wbinvl1
8340 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
8341 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8342 ; GFX90A-NEXT: v_mov_b32_e32 v5, v4
8343 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
8344 ; GFX90A-NEXT: s_cbranch_execnz .LBB40_1
8345 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
8346 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
8347 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
8349 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
8351 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8352 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
8353 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
8354 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
8355 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
8356 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
8357 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8358 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
8359 ; GFX908-NEXT: v_lshlrev_b32_e64 v3, v5, s4
8360 ; GFX908-NEXT: v_not_b32_e32 v6, v3
8361 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
8362 ; GFX908-NEXT: .LBB40_1: ; %atomicrmw.start
8363 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
8364 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8365 ; GFX908-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8366 ; GFX908-NEXT: v_add_f16_e32 v3, v3, v2
8367 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8368 ; GFX908-NEXT: v_and_or_b32 v3, v4, v6, v3
8369 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8370 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8371 ; GFX908-NEXT: buffer_wbinvl1
8372 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8373 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8374 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
8375 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
8376 ; GFX908-NEXT: s_cbranch_execnz .LBB40_1
8377 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
8378 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
8379 ; GFX908-NEXT: s_setpc_b64 s[30:31]
8381 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
8383 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8384 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
8385 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
8386 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
8387 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
8388 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
8389 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8390 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
8391 ; GFX8-NEXT: v_lshlrev_b32_e64 v3, v5, s4
8392 ; GFX8-NEXT: v_not_b32_e32 v6, v3
8393 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
8394 ; GFX8-NEXT: .LBB40_1: ; %atomicrmw.start
8395 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
8396 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8397 ; GFX8-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8398 ; GFX8-NEXT: v_add_f16_e32 v3, v3, v2
8399 ; GFX8-NEXT: v_and_b32_e32 v7, v4, v6
8400 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8401 ; GFX8-NEXT: v_or_b32_e32 v3, v7, v3
8402 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8403 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8404 ; GFX8-NEXT: buffer_wbinvl1
8405 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8406 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8407 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
8408 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
8409 ; GFX8-NEXT: s_cbranch_execnz .LBB40_1
8410 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
8411 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
8412 ; GFX8-NEXT: s_setpc_b64 s[30:31]
8414 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
8416 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8417 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
8418 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
8419 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
8420 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
8421 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
8422 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
8423 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
8424 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
8425 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v2
8426 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v4
8427 ; GFX7-NEXT: v_not_b32_e32 v6, v2
8428 ; GFX7-NEXT: .LBB40_1: ; %atomicrmw.start
8429 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
8430 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8431 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
8432 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
8433 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v6
8434 ; GFX7-NEXT: v_add_f32_e32 v2, v2, v5
8435 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
8436 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
8437 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
8438 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
8439 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8440 ; GFX7-NEXT: buffer_wbinvl1
8441 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
8442 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8443 ; GFX7-NEXT: v_mov_b32_e32 v3, v2
8444 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
8445 ; GFX7-NEXT: s_cbranch_execnz .LBB40_1
8446 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
8447 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
8448 ; GFX7-NEXT: s_setpc_b64 s[30:31]
8449 %gep = getelementptr half, ptr %ptr, i64 1023
8450 %unused = atomicrmw fadd ptr %gep, half %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
8454 define void @flat_agent_atomic_fadd_noret_f16__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
8455 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
8457 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8458 ; GFX12-NEXT: s_wait_expcnt 0x0
8459 ; GFX12-NEXT: s_wait_samplecnt 0x0
8460 ; GFX12-NEXT: s_wait_bvhcnt 0x0
8461 ; GFX12-NEXT: s_wait_kmcnt 0x0
8462 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
8463 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
8464 ; GFX12-NEXT: s_mov_b32 s0, 0
8465 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
8466 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
8467 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
8468 ; GFX12-NEXT: flat_load_b32 v4, v[0:1]
8469 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8470 ; GFX12-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8471 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
8472 ; GFX12-NEXT: v_not_b32_e32 v6, v3
8473 ; GFX12-NEXT: .LBB41_1: ; %atomicrmw.start
8474 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
8475 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8476 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8477 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8478 ; GFX12-NEXT: v_add_f16_e32 v3, v3, v2
8479 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
8480 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8481 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8482 ; GFX12-NEXT: v_and_or_b32 v3, v4, v6, v3
8483 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
8484 ; GFX12-NEXT: s_wait_storecnt 0x0
8485 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
8486 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8487 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
8488 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8489 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
8490 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
8491 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8492 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8493 ; GFX12-NEXT: s_cbranch_execnz .LBB41_1
8494 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
8495 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
8496 ; GFX12-NEXT: s_setpc_b64 s[30:31]
8498 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
8500 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8501 ; GFX940-NEXT: s_movk_i32 s0, 0xf800
8502 ; GFX940-NEXT: s_mov_b32 s1, -1
8503 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
8504 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
8505 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
8506 ; GFX940-NEXT: flat_load_dword v5, v[0:1]
8507 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
8508 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8509 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
8510 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
8511 ; GFX940-NEXT: v_not_b32_e32 v6, v4
8512 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
8513 ; GFX940-NEXT: .LBB41_1: ; %atomicrmw.start
8514 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
8515 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8516 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v3, v5
8517 ; GFX940-NEXT: v_add_f16_e32 v4, v4, v2
8518 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v3, v4
8519 ; GFX940-NEXT: v_and_or_b32 v4, v5, v6, v4
8520 ; GFX940-NEXT: buffer_wbl2 sc1
8521 ; GFX940-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] sc0
8522 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8523 ; GFX940-NEXT: buffer_inv sc1
8524 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
8525 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
8526 ; GFX940-NEXT: v_mov_b32_e32 v5, v4
8527 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
8528 ; GFX940-NEXT: s_cbranch_execnz .LBB41_1
8529 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
8530 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
8531 ; GFX940-NEXT: s_setpc_b64 s[30:31]
8533 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
8535 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8536 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
8537 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
8538 ; GFX11-NEXT: s_mov_b32 s0, 0
8539 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
8540 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
8541 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
8542 ; GFX11-NEXT: flat_load_b32 v4, v[0:1]
8543 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8544 ; GFX11-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8545 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
8546 ; GFX11-NEXT: v_not_b32_e32 v6, v3
8547 ; GFX11-NEXT: .LBB41_1: ; %atomicrmw.start
8548 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
8549 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8550 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8551 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8552 ; GFX11-NEXT: v_add_f16_e32 v3, v3, v2
8553 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
8554 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8555 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8556 ; GFX11-NEXT: v_and_or_b32 v3, v4, v6, v3
8557 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
8558 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
8559 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8560 ; GFX11-NEXT: buffer_gl1_inv
8561 ; GFX11-NEXT: buffer_gl0_inv
8562 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8563 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
8564 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
8565 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8566 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8567 ; GFX11-NEXT: s_cbranch_execnz .LBB41_1
8568 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
8569 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
8570 ; GFX11-NEXT: s_setpc_b64 s[30:31]
8572 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
8574 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8575 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
8576 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
8577 ; GFX10-NEXT: s_mov_b32 s4, 0
8578 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
8579 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
8580 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
8581 ; GFX10-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8582 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
8583 ; GFX10-NEXT: v_not_b32_e32 v6, v3
8584 ; GFX10-NEXT: .LBB41_1: ; %atomicrmw.start
8585 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
8586 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8587 ; GFX10-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8588 ; GFX10-NEXT: v_add_f16_e32 v3, v3, v2
8589 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
8590 ; GFX10-NEXT: v_and_or_b32 v3, v4, v6, v3
8591 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
8592 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8593 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8594 ; GFX10-NEXT: buffer_gl1_inv
8595 ; GFX10-NEXT: buffer_gl0_inv
8596 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8597 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
8598 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
8599 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
8600 ; GFX10-NEXT: s_cbranch_execnz .LBB41_1
8601 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
8602 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
8603 ; GFX10-NEXT: s_setpc_b64 s[30:31]
8605 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
8607 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8608 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
8609 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
8610 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
8611 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
8612 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
8613 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
8614 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
8615 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
8616 ; GFX90A-NEXT: v_not_b32_e32 v6, v4
8617 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
8618 ; GFX90A-NEXT: .LBB41_1: ; %atomicrmw.start
8619 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
8620 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8621 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v3, v5
8622 ; GFX90A-NEXT: v_add_f16_e32 v4, v4, v2
8623 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v3, v4
8624 ; GFX90A-NEXT: v_and_or_b32 v4, v5, v6, v4
8625 ; GFX90A-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] glc
8626 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8627 ; GFX90A-NEXT: buffer_wbinvl1
8628 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
8629 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8630 ; GFX90A-NEXT: v_mov_b32_e32 v5, v4
8631 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
8632 ; GFX90A-NEXT: s_cbranch_execnz .LBB41_1
8633 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
8634 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
8635 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
8637 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
8639 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8640 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
8641 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
8642 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
8643 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
8644 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
8645 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8646 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
8647 ; GFX908-NEXT: v_lshlrev_b32_e64 v3, v5, s4
8648 ; GFX908-NEXT: v_not_b32_e32 v6, v3
8649 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
8650 ; GFX908-NEXT: .LBB41_1: ; %atomicrmw.start
8651 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
8652 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8653 ; GFX908-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8654 ; GFX908-NEXT: v_add_f16_e32 v3, v3, v2
8655 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8656 ; GFX908-NEXT: v_and_or_b32 v3, v4, v6, v3
8657 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8658 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8659 ; GFX908-NEXT: buffer_wbinvl1
8660 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8661 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8662 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
8663 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
8664 ; GFX908-NEXT: s_cbranch_execnz .LBB41_1
8665 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
8666 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
8667 ; GFX908-NEXT: s_setpc_b64 s[30:31]
8669 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
8671 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8672 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
8673 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
8674 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
8675 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
8676 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
8677 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, 3, v3
8678 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
8679 ; GFX8-NEXT: v_lshlrev_b32_e64 v3, v5, s4
8680 ; GFX8-NEXT: v_not_b32_e32 v6, v3
8681 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
8682 ; GFX8-NEXT: .LBB41_1: ; %atomicrmw.start
8683 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
8684 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8685 ; GFX8-NEXT: v_lshrrev_b32_e32 v3, v5, v4
8686 ; GFX8-NEXT: v_add_f16_e32 v3, v3, v2
8687 ; GFX8-NEXT: v_and_b32_e32 v7, v4, v6
8688 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, v5, v3
8689 ; GFX8-NEXT: v_or_b32_e32 v3, v7, v3
8690 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8691 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8692 ; GFX8-NEXT: buffer_wbinvl1
8693 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8694 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8695 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
8696 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
8697 ; GFX8-NEXT: s_cbranch_execnz .LBB41_1
8698 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
8699 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
8700 ; GFX8-NEXT: s_setpc_b64 s[30:31]
8702 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b_neg__amdgpu_no_fine_grained_memory:
8704 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8705 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
8706 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
8707 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
8708 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
8709 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
8710 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
8711 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
8712 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
8713 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v2
8714 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v4
8715 ; GFX7-NEXT: v_not_b32_e32 v6, v2
8716 ; GFX7-NEXT: .LBB41_1: ; %atomicrmw.start
8717 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
8718 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8719 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
8720 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
8721 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v6
8722 ; GFX7-NEXT: v_add_f32_e32 v2, v2, v5
8723 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
8724 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
8725 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
8726 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
8727 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8728 ; GFX7-NEXT: buffer_wbinvl1
8729 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
8730 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8731 ; GFX7-NEXT: v_mov_b32_e32 v3, v2
8732 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
8733 ; GFX7-NEXT: s_cbranch_execnz .LBB41_1
8734 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
8735 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
8736 ; GFX7-NEXT: s_setpc_b64 s[30:31]
8737 %gep = getelementptr half, ptr %ptr, i64 -1024
8738 %unused = atomicrmw fadd ptr %gep, half %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
8742 define void @flat_agent_atomic_fadd_noret_f16__offset12b__align4_pos__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
8743 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
8745 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8746 ; GFX12-NEXT: s_wait_expcnt 0x0
8747 ; GFX12-NEXT: s_wait_samplecnt 0x0
8748 ; GFX12-NEXT: s_wait_bvhcnt 0x0
8749 ; GFX12-NEXT: s_wait_kmcnt 0x0
8750 ; GFX12-NEXT: flat_load_b32 v4, v[0:1] offset:2046
8751 ; GFX12-NEXT: s_mov_b32 s0, 0
8752 ; GFX12-NEXT: .LBB42_1: ; %atomicrmw.start
8753 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
8754 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8755 ; GFX12-NEXT: v_add_f16_e32 v3, v4, v2
8756 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8757 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
8758 ; GFX12-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
8759 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
8760 ; GFX12-NEXT: s_wait_storecnt 0x0
8761 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2046 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
8762 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8763 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
8764 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8765 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
8766 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
8767 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8768 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8769 ; GFX12-NEXT: s_cbranch_execnz .LBB42_1
8770 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
8771 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
8772 ; GFX12-NEXT: s_setpc_b64 s[30:31]
8774 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
8776 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8777 ; GFX940-NEXT: flat_load_dword v5, v[0:1] offset:2046
8778 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
8779 ; GFX940-NEXT: s_mov_b32 s2, 0xffff0000
8780 ; GFX940-NEXT: .LBB42_1: ; %atomicrmw.start
8781 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
8782 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8783 ; GFX940-NEXT: v_add_f16_e32 v3, v5, v2
8784 ; GFX940-NEXT: v_and_or_b32 v4, v5, s2, v3
8785 ; GFX940-NEXT: buffer_wbl2 sc1
8786 ; GFX940-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2046 sc0
8787 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8788 ; GFX940-NEXT: buffer_inv sc1
8789 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
8790 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
8791 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
8792 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
8793 ; GFX940-NEXT: s_cbranch_execnz .LBB42_1
8794 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
8795 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
8796 ; GFX940-NEXT: s_setpc_b64 s[30:31]
8798 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
8800 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8801 ; GFX11-NEXT: flat_load_b32 v4, v[0:1] offset:2046
8802 ; GFX11-NEXT: s_mov_b32 s0, 0
8803 ; GFX11-NEXT: .LBB42_1: ; %atomicrmw.start
8804 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
8805 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8806 ; GFX11-NEXT: v_add_f16_e32 v3, v4, v2
8807 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8808 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
8809 ; GFX11-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
8810 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
8811 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2046 glc
8812 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8813 ; GFX11-NEXT: buffer_gl1_inv
8814 ; GFX11-NEXT: buffer_gl0_inv
8815 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8816 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
8817 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
8818 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8819 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8820 ; GFX11-NEXT: s_cbranch_execnz .LBB42_1
8821 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
8822 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
8823 ; GFX11-NEXT: s_setpc_b64 s[30:31]
8825 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
8827 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8828 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fe, v0
8829 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
8830 ; GFX10-NEXT: s_mov_b32 s4, 0
8831 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
8832 ; GFX10-NEXT: .LBB42_1: ; %atomicrmw.start
8833 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
8834 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8835 ; GFX10-NEXT: v_add_f16_e32 v3, v4, v2
8836 ; GFX10-NEXT: v_and_b32_e32 v3, 0xffff, v3
8837 ; GFX10-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
8838 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
8839 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8840 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8841 ; GFX10-NEXT: buffer_gl1_inv
8842 ; GFX10-NEXT: buffer_gl0_inv
8843 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8844 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
8845 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
8846 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
8847 ; GFX10-NEXT: s_cbranch_execnz .LBB42_1
8848 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
8849 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
8850 ; GFX10-NEXT: s_setpc_b64 s[30:31]
8852 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
8854 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8855 ; GFX90A-NEXT: flat_load_dword v5, v[0:1] offset:2046
8856 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
8857 ; GFX90A-NEXT: s_mov_b32 s6, 0xffff0000
8858 ; GFX90A-NEXT: .LBB42_1: ; %atomicrmw.start
8859 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
8860 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8861 ; GFX90A-NEXT: v_add_f16_e32 v3, v5, v2
8862 ; GFX90A-NEXT: v_and_or_b32 v4, v5, s6, v3
8863 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2046 glc
8864 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8865 ; GFX90A-NEXT: buffer_wbinvl1
8866 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
8867 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8868 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
8869 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
8870 ; GFX90A-NEXT: s_cbranch_execnz .LBB42_1
8871 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
8872 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
8873 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
8875 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
8877 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8878 ; GFX908-NEXT: flat_load_dword v4, v[0:1] offset:2046
8879 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
8880 ; GFX908-NEXT: s_mov_b32 s6, 0xffff0000
8881 ; GFX908-NEXT: .LBB42_1: ; %atomicrmw.start
8882 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
8883 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8884 ; GFX908-NEXT: v_add_f16_e32 v3, v4, v2
8885 ; GFX908-NEXT: v_and_or_b32 v3, v4, s6, v3
8886 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2046 glc
8887 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8888 ; GFX908-NEXT: buffer_wbinvl1
8889 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8890 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8891 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
8892 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
8893 ; GFX908-NEXT: s_cbranch_execnz .LBB42_1
8894 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
8895 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
8896 ; GFX908-NEXT: s_setpc_b64 s[30:31]
8898 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
8900 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8901 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fe, v0
8902 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
8903 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
8904 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
8905 ; GFX8-NEXT: .LBB42_1: ; %atomicrmw.start
8906 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
8907 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8908 ; GFX8-NEXT: v_add_f16_e32 v3, v4, v2
8909 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
8910 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
8911 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
8912 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8913 ; GFX8-NEXT: buffer_wbinvl1
8914 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
8915 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8916 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
8917 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
8918 ; GFX8-NEXT: s_cbranch_execnz .LBB42_1
8919 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
8920 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
8921 ; GFX8-NEXT: s_setpc_b64 s[30:31]
8923 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_f16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
8925 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8926 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fe, v0
8927 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
8928 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
8929 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
8930 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
8931 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v2
8932 ; GFX7-NEXT: .LBB42_1: ; %atomicrmw.start
8933 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
8934 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8935 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
8936 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
8937 ; GFX7-NEXT: v_add_f32_e32 v2, v2, v4
8938 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
8939 ; GFX7-NEXT: v_or_b32_e32 v2, v5, v2
8940 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
8941 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8942 ; GFX7-NEXT: buffer_wbinvl1
8943 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
8944 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
8945 ; GFX7-NEXT: v_mov_b32_e32 v3, v2
8946 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
8947 ; GFX7-NEXT: s_cbranch_execnz .LBB42_1
8948 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
8949 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
8950 ; GFX7-NEXT: s_setpc_b64 s[30:31]
8951 %gep = getelementptr half, ptr %ptr, i64 1023
8952 %unused = atomicrmw fadd ptr %gep, half %val syncscope("agent") seq_cst, align 4, !amdgpu.no.fine.grained.memory !0
8956 define half @flat_agent_atomic_fadd_ret_f16__offset12b_pos__align4__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
8957 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
8959 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8960 ; GFX12-NEXT: s_wait_expcnt 0x0
8961 ; GFX12-NEXT: s_wait_samplecnt 0x0
8962 ; GFX12-NEXT: s_wait_bvhcnt 0x0
8963 ; GFX12-NEXT: s_wait_kmcnt 0x0
8964 ; GFX12-NEXT: flat_load_b32 v3, v[0:1] offset:2046
8965 ; GFX12-NEXT: s_mov_b32 s0, 0
8966 ; GFX12-NEXT: .LBB43_1: ; %atomicrmw.start
8967 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
8968 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8969 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
8970 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
8971 ; GFX12-NEXT: v_add_f16_e32 v3, v4, v2
8972 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
8973 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
8974 ; GFX12-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
8975 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
8976 ; GFX12-NEXT: s_wait_storecnt 0x0
8977 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2046 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
8978 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
8979 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
8980 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
8981 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
8982 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
8983 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
8984 ; GFX12-NEXT: s_cbranch_execnz .LBB43_1
8985 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
8986 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
8987 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
8988 ; GFX12-NEXT: s_setpc_b64 s[30:31]
8990 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
8992 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8993 ; GFX940-NEXT: flat_load_dword v3, v[0:1] offset:2046
8994 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
8995 ; GFX940-NEXT: s_mov_b32 s2, 0xffff0000
8996 ; GFX940-NEXT: .LBB43_1: ; %atomicrmw.start
8997 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
8998 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8999 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
9000 ; GFX940-NEXT: v_add_f16_e32 v3, v5, v2
9001 ; GFX940-NEXT: v_and_or_b32 v4, v5, s2, v3
9002 ; GFX940-NEXT: buffer_wbl2 sc1
9003 ; GFX940-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2046 sc0
9004 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9005 ; GFX940-NEXT: buffer_inv sc1
9006 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
9007 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
9008 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
9009 ; GFX940-NEXT: s_cbranch_execnz .LBB43_1
9010 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
9011 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
9012 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
9013 ; GFX940-NEXT: s_setpc_b64 s[30:31]
9015 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
9017 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9018 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2046
9019 ; GFX11-NEXT: s_mov_b32 s0, 0
9020 ; GFX11-NEXT: .LBB43_1: ; %atomicrmw.start
9021 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
9022 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9023 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
9024 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9025 ; GFX11-NEXT: v_add_f16_e32 v3, v4, v2
9026 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
9027 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
9028 ; GFX11-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
9029 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
9030 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2046 glc
9031 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9032 ; GFX11-NEXT: buffer_gl1_inv
9033 ; GFX11-NEXT: buffer_gl0_inv
9034 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
9035 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
9036 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9037 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9038 ; GFX11-NEXT: s_cbranch_execnz .LBB43_1
9039 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
9040 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
9041 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
9042 ; GFX11-NEXT: s_setpc_b64 s[30:31]
9044 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
9046 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9047 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
9048 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
9049 ; GFX10-NEXT: s_mov_b32 s4, 0
9050 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
9051 ; GFX10-NEXT: .LBB43_1: ; %atomicrmw.start
9052 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
9053 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9054 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
9055 ; GFX10-NEXT: v_add_f16_e32 v0, v1, v2
9056 ; GFX10-NEXT: v_and_b32_e32 v0, 0xffff, v0
9057 ; GFX10-NEXT: v_and_or_b32 v0, 0xffff0000, v1, v0
9058 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
9059 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
9060 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9061 ; GFX10-NEXT: buffer_gl1_inv
9062 ; GFX10-NEXT: buffer_gl0_inv
9063 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
9064 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
9065 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
9066 ; GFX10-NEXT: s_cbranch_execnz .LBB43_1
9067 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
9068 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
9069 ; GFX10-NEXT: s_setpc_b64 s[30:31]
9071 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
9073 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9074 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2046
9075 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
9076 ; GFX90A-NEXT: s_mov_b32 s6, 0xffff0000
9077 ; GFX90A-NEXT: .LBB43_1: ; %atomicrmw.start
9078 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
9079 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9080 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
9081 ; GFX90A-NEXT: v_add_f16_e32 v3, v5, v2
9082 ; GFX90A-NEXT: v_and_or_b32 v4, v5, s6, v3
9083 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2046 glc
9084 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9085 ; GFX90A-NEXT: buffer_wbinvl1
9086 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
9087 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9088 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
9089 ; GFX90A-NEXT: s_cbranch_execnz .LBB43_1
9090 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
9091 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
9092 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
9093 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
9095 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
9097 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9098 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2046
9099 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
9100 ; GFX908-NEXT: s_mov_b32 s6, 0xffff0000
9101 ; GFX908-NEXT: .LBB43_1: ; %atomicrmw.start
9102 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
9103 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9104 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
9105 ; GFX908-NEXT: v_add_f16_e32 v3, v4, v2
9106 ; GFX908-NEXT: v_and_or_b32 v3, v4, s6, v3
9107 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2046 glc
9108 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9109 ; GFX908-NEXT: buffer_wbinvl1
9110 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
9111 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9112 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
9113 ; GFX908-NEXT: s_cbranch_execnz .LBB43_1
9114 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
9115 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
9116 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
9117 ; GFX908-NEXT: s_setpc_b64 s[30:31]
9119 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
9121 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9122 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
9123 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
9124 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
9125 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
9126 ; GFX8-NEXT: .LBB43_1: ; %atomicrmw.start
9127 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
9128 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9129 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
9130 ; GFX8-NEXT: v_add_f16_e32 v0, v1, v2
9131 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v1
9132 ; GFX8-NEXT: v_or_b32_e32 v0, v5, v0
9133 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
9134 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9135 ; GFX8-NEXT: buffer_wbinvl1
9136 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
9137 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9138 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
9139 ; GFX8-NEXT: s_cbranch_execnz .LBB43_1
9140 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
9141 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
9142 ; GFX8-NEXT: s_setpc_b64 s[30:31]
9144 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_f16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
9146 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9147 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fe, v0
9148 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
9149 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
9150 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
9151 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
9152 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
9153 ; GFX7-NEXT: .LBB43_1: ; %atomicrmw.start
9154 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
9155 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9156 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
9157 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v4
9158 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
9159 ; GFX7-NEXT: v_add_f32_e32 v3, v3, v2
9160 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
9161 ; GFX7-NEXT: v_or_b32_e32 v3, v5, v3
9162 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
9163 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9164 ; GFX7-NEXT: buffer_wbinvl1
9165 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
9166 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9167 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
9168 ; GFX7-NEXT: s_cbranch_execnz .LBB43_1
9169 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
9170 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
9171 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v3
9172 ; GFX7-NEXT: s_setpc_b64 s[30:31]
9173 %gep = getelementptr half, ptr %ptr, i64 1023
9174 %result = atomicrmw fadd ptr %gep, half %val syncscope("agent") seq_cst, align 4, !amdgpu.no.fine.grained.memory !0
9178 define half @flat_system_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
9179 ; GFX12-LABEL: flat_system_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9181 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9182 ; GFX12-NEXT: s_wait_expcnt 0x0
9183 ; GFX12-NEXT: s_wait_samplecnt 0x0
9184 ; GFX12-NEXT: s_wait_bvhcnt 0x0
9185 ; GFX12-NEXT: s_wait_kmcnt 0x0
9186 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
9187 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
9188 ; GFX12-NEXT: s_mov_b32 s0, 0
9189 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
9190 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
9191 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
9192 ; GFX12-NEXT: flat_load_b32 v5, v[0:1]
9193 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9194 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
9195 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
9196 ; GFX12-NEXT: v_not_b32_e32 v4, v4
9197 ; GFX12-NEXT: .LBB44_1: ; %atomicrmw.start
9198 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
9199 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9200 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
9201 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9202 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
9203 ; GFX12-NEXT: v_add_f16_e32 v5, v5, v2
9204 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9205 ; GFX12-NEXT: v_and_b32_e32 v5, 0xffff, v5
9206 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
9207 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
9208 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
9209 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
9210 ; GFX12-NEXT: s_wait_storecnt 0x0
9211 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
9212 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9213 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
9214 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
9215 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
9216 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9217 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9218 ; GFX12-NEXT: s_cbranch_execnz .LBB44_1
9219 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
9220 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
9221 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
9222 ; GFX12-NEXT: s_setpc_b64 s[30:31]
9224 ; GFX940-LABEL: flat_system_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9226 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9227 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
9228 ; GFX940-NEXT: v_lshl_add_u64 v[6:7], v[0:1], 0, s[0:1]
9229 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v6
9230 ; GFX940-NEXT: v_mov_b32_e32 v1, v7
9231 ; GFX940-NEXT: flat_load_dword v4, v[0:1]
9232 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v6
9233 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9234 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
9235 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v3, s0
9236 ; GFX940-NEXT: v_not_b32_e32 v5, v5
9237 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
9238 ; GFX940-NEXT: .LBB44_1: ; %atomicrmw.start
9239 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
9240 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9241 ; GFX940-NEXT: v_mov_b32_e32 v7, v4
9242 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v3, v7
9243 ; GFX940-NEXT: v_add_f16_e32 v4, v4, v2
9244 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v3, v4
9245 ; GFX940-NEXT: v_and_or_b32 v6, v7, v5, v4
9246 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
9247 ; GFX940-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] sc0 sc1
9248 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9249 ; GFX940-NEXT: buffer_inv sc0 sc1
9250 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
9251 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
9252 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
9253 ; GFX940-NEXT: s_cbranch_execnz .LBB44_1
9254 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
9255 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
9256 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v4
9257 ; GFX940-NEXT: s_setpc_b64 s[30:31]
9259 ; GFX11-LABEL: flat_system_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9261 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9262 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
9263 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
9264 ; GFX11-NEXT: s_mov_b32 s0, 0
9265 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
9266 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
9267 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
9268 ; GFX11-NEXT: flat_load_b32 v5, v[0:1]
9269 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9270 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
9271 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
9272 ; GFX11-NEXT: v_not_b32_e32 v4, v4
9273 ; GFX11-NEXT: .LBB44_1: ; %atomicrmw.start
9274 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
9275 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9276 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
9277 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9278 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
9279 ; GFX11-NEXT: v_add_f16_e32 v5, v5, v2
9280 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9281 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff, v5
9282 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
9283 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
9284 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
9285 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
9286 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] glc
9287 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9288 ; GFX11-NEXT: buffer_gl1_inv
9289 ; GFX11-NEXT: buffer_gl0_inv
9290 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
9291 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
9292 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9293 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9294 ; GFX11-NEXT: s_cbranch_execnz .LBB44_1
9295 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
9296 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
9297 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
9298 ; GFX11-NEXT: s_setpc_b64 s[30:31]
9300 ; GFX10-LABEL: flat_system_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9302 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9303 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
9304 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
9305 ; GFX10-NEXT: s_mov_b32 s4, 0
9306 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
9307 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
9308 ; GFX10-NEXT: flat_load_dword v5, v[0:1]
9309 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9310 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
9311 ; GFX10-NEXT: v_not_b32_e32 v4, v4
9312 ; GFX10-NEXT: .LBB44_1: ; %atomicrmw.start
9313 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
9314 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9315 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
9316 ; GFX10-NEXT: v_lshrrev_b32_e32 v5, v3, v6
9317 ; GFX10-NEXT: v_add_f16_e32 v5, v5, v2
9318 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
9319 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
9320 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
9321 ; GFX10-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
9322 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9323 ; GFX10-NEXT: buffer_gl1_inv
9324 ; GFX10-NEXT: buffer_gl0_inv
9325 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
9326 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
9327 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
9328 ; GFX10-NEXT: s_cbranch_execnz .LBB44_1
9329 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
9330 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
9331 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
9332 ; GFX10-NEXT: s_setpc_b64 s[30:31]
9334 ; GFX90A-LABEL: flat_system_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9336 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9337 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
9338 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
9339 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
9340 ; GFX90A-NEXT: flat_load_dword v4, v[0:1]
9341 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
9342 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9343 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
9344 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v3, s4
9345 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
9346 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
9347 ; GFX90A-NEXT: .LBB44_1: ; %atomicrmw.start
9348 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
9349 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9350 ; GFX90A-NEXT: v_mov_b32_e32 v7, v4
9351 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v3, v7
9352 ; GFX90A-NEXT: v_add_f16_e32 v4, v4, v2
9353 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v3, v4
9354 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v5, v4
9355 ; GFX90A-NEXT: buffer_wbl2
9356 ; GFX90A-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] glc
9357 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9358 ; GFX90A-NEXT: buffer_invl2
9359 ; GFX90A-NEXT: buffer_wbinvl1
9360 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
9361 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9362 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
9363 ; GFX90A-NEXT: s_cbranch_execnz .LBB44_1
9364 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
9365 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
9366 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v4
9367 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
9369 ; GFX908-LABEL: flat_system_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9371 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9372 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
9373 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
9374 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
9375 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
9376 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
9377 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9378 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
9379 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v3, s4
9380 ; GFX908-NEXT: v_not_b32_e32 v5, v5
9381 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
9382 ; GFX908-NEXT: .LBB44_1: ; %atomicrmw.start
9383 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
9384 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9385 ; GFX908-NEXT: v_mov_b32_e32 v7, v4
9386 ; GFX908-NEXT: v_lshrrev_b32_e32 v4, v3, v7
9387 ; GFX908-NEXT: v_add_f16_e32 v4, v4, v2
9388 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, v3, v4
9389 ; GFX908-NEXT: v_and_or_b32 v6, v7, v5, v4
9390 ; GFX908-NEXT: flat_atomic_cmpswap v4, v[0:1], v[6:7] glc
9391 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9392 ; GFX908-NEXT: buffer_wbinvl1
9393 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v4, v7
9394 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9395 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
9396 ; GFX908-NEXT: s_cbranch_execnz .LBB44_1
9397 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
9398 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
9399 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v4
9400 ; GFX908-NEXT: s_setpc_b64 s[30:31]
9402 ; GFX8-LABEL: flat_system_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9404 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9405 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
9406 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
9407 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
9408 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
9409 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
9410 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9411 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
9412 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
9413 ; GFX8-NEXT: v_not_b32_e32 v4, v4
9414 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
9415 ; GFX8-NEXT: .LBB44_1: ; %atomicrmw.start
9416 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
9417 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9418 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
9419 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, v3, v6
9420 ; GFX8-NEXT: v_add_f16_e32 v5, v5, v2
9421 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
9422 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, v3, v5
9423 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
9424 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
9425 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9426 ; GFX8-NEXT: buffer_wbinvl1
9427 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
9428 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9429 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
9430 ; GFX8-NEXT: s_cbranch_execnz .LBB44_1
9431 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
9432 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
9433 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
9434 ; GFX8-NEXT: s_setpc_b64 s[30:31]
9436 ; GFX7-LABEL: flat_system_atomic_fadd_ret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9438 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9439 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0x7fe, v0
9440 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
9441 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
9442 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
9443 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v2
9444 ; GFX7-NEXT: v_and_b32_e32 v2, 3, v3
9445 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 3, v2
9446 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
9447 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v4
9448 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v2
9449 ; GFX7-NEXT: v_not_b32_e32 v4, v4
9450 ; GFX7-NEXT: .LBB44_1: ; %atomicrmw.start
9451 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
9452 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9453 ; GFX7-NEXT: v_mov_b32_e32 v6, v5
9454 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, v2, v6
9455 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
9456 ; GFX7-NEXT: v_and_b32_e32 v7, v6, v4
9457 ; GFX7-NEXT: v_add_f32_e32 v5, v5, v3
9458 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
9459 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, v2, v5
9460 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v5
9461 ; GFX7-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
9462 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9463 ; GFX7-NEXT: buffer_wbinvl1
9464 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
9465 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9466 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
9467 ; GFX7-NEXT: s_cbranch_execnz .LBB44_1
9468 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
9469 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
9470 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v2, v5
9471 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v0
9472 ; GFX7-NEXT: s_setpc_b64 s[30:31]
9473 %gep = getelementptr half, ptr %ptr, i64 1023
9474 %result = atomicrmw fadd ptr %gep, half %val seq_cst, !amdgpu.no.fine.grained.memory !0
9478 define void @flat_system_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, half %val) #0 {
9479 ; GFX12-LABEL: flat_system_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9481 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9482 ; GFX12-NEXT: s_wait_expcnt 0x0
9483 ; GFX12-NEXT: s_wait_samplecnt 0x0
9484 ; GFX12-NEXT: s_wait_bvhcnt 0x0
9485 ; GFX12-NEXT: s_wait_kmcnt 0x0
9486 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
9487 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
9488 ; GFX12-NEXT: s_mov_b32 s0, 0
9489 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
9490 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
9491 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
9492 ; GFX12-NEXT: flat_load_b32 v4, v[0:1]
9493 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 3, v3
9494 ; GFX12-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
9495 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
9496 ; GFX12-NEXT: v_not_b32_e32 v6, v3
9497 ; GFX12-NEXT: .LBB45_1: ; %atomicrmw.start
9498 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
9499 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9500 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v5, v4
9501 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9502 ; GFX12-NEXT: v_add_f16_e32 v3, v3, v2
9503 ; GFX12-NEXT: v_and_b32_e32 v3, 0xffff, v3
9504 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9505 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v5, v3
9506 ; GFX12-NEXT: v_and_or_b32 v3, v4, v6, v3
9507 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
9508 ; GFX12-NEXT: s_wait_storecnt 0x0
9509 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
9510 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9511 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
9512 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
9513 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
9514 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
9515 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9516 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9517 ; GFX12-NEXT: s_cbranch_execnz .LBB45_1
9518 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
9519 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
9520 ; GFX12-NEXT: s_setpc_b64 s[30:31]
9522 ; GFX940-LABEL: flat_system_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9524 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9525 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
9526 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
9527 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
9528 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
9529 ; GFX940-NEXT: flat_load_dword v5, v[0:1]
9530 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
9531 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9532 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
9533 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
9534 ; GFX940-NEXT: v_not_b32_e32 v6, v4
9535 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
9536 ; GFX940-NEXT: .LBB45_1: ; %atomicrmw.start
9537 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
9538 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9539 ; GFX940-NEXT: v_lshrrev_b32_e32 v4, v3, v5
9540 ; GFX940-NEXT: v_add_f16_e32 v4, v4, v2
9541 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, v3, v4
9542 ; GFX940-NEXT: v_and_or_b32 v4, v5, v6, v4
9543 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
9544 ; GFX940-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] sc0 sc1
9545 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9546 ; GFX940-NEXT: buffer_inv sc0 sc1
9547 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
9548 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
9549 ; GFX940-NEXT: v_mov_b32_e32 v5, v4
9550 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
9551 ; GFX940-NEXT: s_cbranch_execnz .LBB45_1
9552 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
9553 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
9554 ; GFX940-NEXT: s_setpc_b64 s[30:31]
9556 ; GFX11-LABEL: flat_system_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9558 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9559 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
9560 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
9561 ; GFX11-NEXT: s_mov_b32 s0, 0
9562 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_1)
9563 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
9564 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
9565 ; GFX11-NEXT: flat_load_b32 v4, v[0:1]
9566 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 3, v3
9567 ; GFX11-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
9568 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
9569 ; GFX11-NEXT: v_not_b32_e32 v6, v3
9570 ; GFX11-NEXT: .LBB45_1: ; %atomicrmw.start
9571 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
9572 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9573 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v5, v4
9574 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9575 ; GFX11-NEXT: v_add_f16_e32 v3, v3, v2
9576 ; GFX11-NEXT: v_and_b32_e32 v3, 0xffff, v3
9577 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9578 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v5, v3
9579 ; GFX11-NEXT: v_and_or_b32 v3, v4, v6, v3
9580 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
9581 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
9582 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9583 ; GFX11-NEXT: buffer_gl1_inv
9584 ; GFX11-NEXT: buffer_gl0_inv
9585 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
9586 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
9587 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
9588 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9589 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9590 ; GFX11-NEXT: s_cbranch_execnz .LBB45_1
9591 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
9592 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
9593 ; GFX11-NEXT: s_setpc_b64 s[30:31]
9595 ; GFX10-LABEL: flat_system_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9597 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9598 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
9599 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
9600 ; GFX10-NEXT: s_mov_b32 s4, 0
9601 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
9602 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
9603 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
9604 ; GFX10-NEXT: v_lshlrev_b32_e32 v5, 3, v3
9605 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
9606 ; GFX10-NEXT: v_not_b32_e32 v6, v3
9607 ; GFX10-NEXT: .LBB45_1: ; %atomicrmw.start
9608 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
9609 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9610 ; GFX10-NEXT: v_lshrrev_b32_e32 v3, v5, v4
9611 ; GFX10-NEXT: v_add_f16_e32 v3, v3, v2
9612 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_0
9613 ; GFX10-NEXT: v_and_or_b32 v3, v4, v6, v3
9614 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
9615 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
9616 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9617 ; GFX10-NEXT: buffer_gl1_inv
9618 ; GFX10-NEXT: buffer_gl0_inv
9619 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
9620 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
9621 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
9622 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
9623 ; GFX10-NEXT: s_cbranch_execnz .LBB45_1
9624 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
9625 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
9626 ; GFX10-NEXT: s_setpc_b64 s[30:31]
9628 ; GFX90A-LABEL: flat_system_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9630 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9631 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
9632 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
9633 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
9634 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
9635 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
9636 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9637 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
9638 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
9639 ; GFX90A-NEXT: v_not_b32_e32 v6, v4
9640 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
9641 ; GFX90A-NEXT: .LBB45_1: ; %atomicrmw.start
9642 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
9643 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9644 ; GFX90A-NEXT: v_lshrrev_b32_e32 v4, v3, v5
9645 ; GFX90A-NEXT: v_add_f16_e32 v4, v4, v2
9646 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, v3, v4
9647 ; GFX90A-NEXT: v_and_or_b32 v4, v5, v6, v4
9648 ; GFX90A-NEXT: buffer_wbl2
9649 ; GFX90A-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] glc
9650 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9651 ; GFX90A-NEXT: buffer_invl2
9652 ; GFX90A-NEXT: buffer_wbinvl1
9653 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
9654 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9655 ; GFX90A-NEXT: v_mov_b32_e32 v5, v4
9656 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
9657 ; GFX90A-NEXT: s_cbranch_execnz .LBB45_1
9658 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
9659 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
9660 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
9662 ; GFX908-LABEL: flat_system_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9664 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9665 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
9666 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
9667 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
9668 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
9669 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
9670 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, 3, v3
9671 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
9672 ; GFX908-NEXT: v_lshlrev_b32_e64 v3, v5, s4
9673 ; GFX908-NEXT: v_not_b32_e32 v6, v3
9674 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
9675 ; GFX908-NEXT: .LBB45_1: ; %atomicrmw.start
9676 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
9677 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9678 ; GFX908-NEXT: v_lshrrev_b32_e32 v3, v5, v4
9679 ; GFX908-NEXT: v_add_f16_e32 v3, v3, v2
9680 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, v5, v3
9681 ; GFX908-NEXT: v_and_or_b32 v3, v4, v6, v3
9682 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
9683 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9684 ; GFX908-NEXT: buffer_wbinvl1
9685 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
9686 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9687 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
9688 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
9689 ; GFX908-NEXT: s_cbranch_execnz .LBB45_1
9690 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
9691 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
9692 ; GFX908-NEXT: s_setpc_b64 s[30:31]
9694 ; GFX8-LABEL: flat_system_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9696 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9697 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
9698 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
9699 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
9700 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
9701 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
9702 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, 3, v3
9703 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
9704 ; GFX8-NEXT: v_lshlrev_b32_e64 v3, v5, s4
9705 ; GFX8-NEXT: v_not_b32_e32 v6, v3
9706 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
9707 ; GFX8-NEXT: .LBB45_1: ; %atomicrmw.start
9708 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
9709 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9710 ; GFX8-NEXT: v_lshrrev_b32_e32 v3, v5, v4
9711 ; GFX8-NEXT: v_add_f16_e32 v3, v3, v2
9712 ; GFX8-NEXT: v_and_b32_e32 v7, v4, v6
9713 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, v5, v3
9714 ; GFX8-NEXT: v_or_b32_e32 v3, v7, v3
9715 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
9716 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9717 ; GFX8-NEXT: buffer_wbinvl1
9718 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
9719 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9720 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
9721 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
9722 ; GFX8-NEXT: s_cbranch_execnz .LBB45_1
9723 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
9724 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
9725 ; GFX8-NEXT: s_setpc_b64 s[30:31]
9727 ; GFX7-LABEL: flat_system_atomic_fadd_noret_f16__offset12b_pos__amdgpu_no_fine_grained_memory:
9729 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9730 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
9731 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
9732 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
9733 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
9734 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
9735 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
9736 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
9737 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
9738 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v2
9739 ; GFX7-NEXT: v_lshl_b32_e32 v2, 0xffff, v4
9740 ; GFX7-NEXT: v_not_b32_e32 v6, v2
9741 ; GFX7-NEXT: .LBB45_1: ; %atomicrmw.start
9742 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
9743 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9744 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
9745 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v2
9746 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v6
9747 ; GFX7-NEXT: v_add_f32_e32 v2, v2, v5
9748 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
9749 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
9750 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
9751 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
9752 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9753 ; GFX7-NEXT: buffer_wbinvl1
9754 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
9755 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9756 ; GFX7-NEXT: v_mov_b32_e32 v3, v2
9757 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
9758 ; GFX7-NEXT: s_cbranch_execnz .LBB45_1
9759 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
9760 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
9761 ; GFX7-NEXT: s_setpc_b64 s[30:31]
9762 %gep = getelementptr half, ptr %ptr, i64 1023
9763 %unused = atomicrmw fadd ptr %gep, half %val seq_cst, !amdgpu.no.fine.grained.memory !0
9767 ; --------------------------------------------------------------------
9769 ; --------------------------------------------------------------------
9771 define bfloat @flat_agent_atomic_fadd_ret_bf16__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
9772 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_bf16__amdgpu_no_fine_grained_memory:
9774 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9775 ; GFX12-NEXT: s_wait_expcnt 0x0
9776 ; GFX12-NEXT: s_wait_samplecnt 0x0
9777 ; GFX12-NEXT: s_wait_bvhcnt 0x0
9778 ; GFX12-NEXT: s_wait_kmcnt 0x0
9779 ; GFX12-NEXT: v_dual_mov_b32 v3, v0 :: v_dual_lshlrev_b32 v2, 16, v2
9780 ; GFX12-NEXT: s_mov_b32 s0, 0
9781 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
9782 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
9783 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
9784 ; GFX12-NEXT: flat_load_b32 v5, v[0:1]
9785 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9786 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
9787 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
9788 ; GFX12-NEXT: v_not_b32_e32 v4, v4
9789 ; GFX12-NEXT: .LBB46_1: ; %atomicrmw.start
9790 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
9791 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9792 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
9793 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9794 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
9795 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 16, v5
9796 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9797 ; GFX12-NEXT: v_add_f32_e32 v5, v5, v2
9798 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
9799 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v5
9800 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
9801 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
9802 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
9803 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
9804 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9805 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, 16, v5
9806 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
9807 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
9808 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
9809 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
9810 ; GFX12-NEXT: s_wait_storecnt 0x0
9811 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
9812 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
9813 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
9814 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
9815 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
9816 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9817 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9818 ; GFX12-NEXT: s_cbranch_execnz .LBB46_1
9819 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
9820 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
9821 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
9822 ; GFX12-NEXT: s_setpc_b64 s[30:31]
9824 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_bf16__amdgpu_no_fine_grained_memory:
9826 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9827 ; GFX940-NEXT: v_mov_b32_e32 v3, v0
9828 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v3
9829 ; GFX940-NEXT: flat_load_dword v5, v[0:1]
9830 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v3
9831 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9832 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
9833 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
9834 ; GFX940-NEXT: v_not_b32_e32 v4, v4
9835 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
9836 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9837 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
9838 ; GFX940-NEXT: .LBB46_1: ; %atomicrmw.start
9839 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
9840 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9841 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
9842 ; GFX940-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9843 ; GFX940-NEXT: s_nop 0
9844 ; GFX940-NEXT: v_add_f32_e32 v5, v5, v2
9845 ; GFX940-NEXT: v_bfe_u32 v6, v5, 16, 1
9846 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v5
9847 ; GFX940-NEXT: v_add3_u32 v6, v6, v5, s2
9848 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
9849 ; GFX940-NEXT: s_nop 1
9850 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
9851 ; GFX940-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9852 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
9853 ; GFX940-NEXT: buffer_wbl2 sc1
9854 ; GFX940-NEXT: flat_atomic_cmpswap v5, v[0:1], v[6:7] sc0
9855 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9856 ; GFX940-NEXT: buffer_inv sc1
9857 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
9858 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
9859 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
9860 ; GFX940-NEXT: s_cbranch_execnz .LBB46_1
9861 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
9862 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
9863 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
9864 ; GFX940-NEXT: s_setpc_b64 s[30:31]
9866 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_bf16__amdgpu_no_fine_grained_memory:
9868 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9869 ; GFX11-NEXT: v_dual_mov_b32 v3, v0 :: v_dual_lshlrev_b32 v2, 16, v2
9870 ; GFX11-NEXT: s_mov_b32 s0, 0
9871 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
9872 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
9873 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
9874 ; GFX11-NEXT: flat_load_b32 v5, v[0:1]
9875 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9876 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
9877 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
9878 ; GFX11-NEXT: v_not_b32_e32 v4, v4
9879 ; GFX11-NEXT: .p2align 6
9880 ; GFX11-NEXT: .LBB46_1: ; %atomicrmw.start
9881 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
9882 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9883 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
9884 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9885 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
9886 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 16, v5
9887 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9888 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
9889 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
9890 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v5
9891 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
9892 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
9893 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
9894 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
9895 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
9896 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, 16, v5
9897 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
9898 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
9899 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
9900 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
9901 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] glc
9902 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9903 ; GFX11-NEXT: buffer_gl1_inv
9904 ; GFX11-NEXT: buffer_gl0_inv
9905 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
9906 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
9907 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
9908 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
9909 ; GFX11-NEXT: s_cbranch_execnz .LBB46_1
9910 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
9911 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
9912 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
9913 ; GFX11-NEXT: s_setpc_b64 s[30:31]
9915 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_bf16__amdgpu_no_fine_grained_memory:
9917 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9918 ; GFX10-NEXT: v_mov_b32_e32 v3, v0
9919 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9920 ; GFX10-NEXT: s_mov_b32 s4, 0
9921 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
9922 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
9923 ; GFX10-NEXT: flat_load_dword v5, v[0:1]
9924 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9925 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
9926 ; GFX10-NEXT: v_not_b32_e32 v4, v4
9927 ; GFX10-NEXT: .LBB46_1: ; %atomicrmw.start
9928 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
9929 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9930 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
9931 ; GFX10-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9932 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
9933 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
9934 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v5
9935 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
9936 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
9937 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
9938 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9939 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
9940 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
9941 ; GFX10-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
9942 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9943 ; GFX10-NEXT: buffer_gl1_inv
9944 ; GFX10-NEXT: buffer_gl0_inv
9945 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
9946 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
9947 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
9948 ; GFX10-NEXT: s_cbranch_execnz .LBB46_1
9949 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
9950 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
9951 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
9952 ; GFX10-NEXT: s_setpc_b64 s[30:31]
9954 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_bf16__amdgpu_no_fine_grained_memory:
9956 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9957 ; GFX90A-NEXT: v_mov_b32_e32 v3, v0
9958 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
9959 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
9960 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
9961 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
9962 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
9963 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
9964 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
9965 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
9966 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
9967 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
9968 ; GFX90A-NEXT: .LBB46_1: ; %atomicrmw.start
9969 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
9970 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9971 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
9972 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
9973 ; GFX90A-NEXT: v_add_f32_e32 v5, v5, v2
9974 ; GFX90A-NEXT: v_bfe_u32 v6, v5, 16, 1
9975 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v5
9976 ; GFX90A-NEXT: v_add3_u32 v6, v6, v5, s6
9977 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
9978 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
9979 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
9980 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
9981 ; GFX90A-NEXT: flat_atomic_cmpswap v5, v[0:1], v[6:7] glc
9982 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9983 ; GFX90A-NEXT: buffer_wbinvl1
9984 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
9985 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
9986 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
9987 ; GFX90A-NEXT: s_cbranch_execnz .LBB46_1
9988 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
9989 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
9990 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
9991 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
9993 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_bf16__amdgpu_no_fine_grained_memory:
9995 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9996 ; GFX908-NEXT: v_mov_b32_e32 v3, v0
9997 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
9998 ; GFX908-NEXT: flat_load_dword v5, v[0:1]
9999 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
10000 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10001 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
10002 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10003 ; GFX908-NEXT: v_not_b32_e32 v4, v4
10004 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
10005 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10006 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
10007 ; GFX908-NEXT: .LBB46_1: ; %atomicrmw.start
10008 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
10009 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10010 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
10011 ; GFX908-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10012 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
10013 ; GFX908-NEXT: v_bfe_u32 v7, v5, 16, 1
10014 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v5
10015 ; GFX908-NEXT: v_add3_u32 v7, v7, v5, s6
10016 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10017 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc
10018 ; GFX908-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10019 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
10020 ; GFX908-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10021 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10022 ; GFX908-NEXT: buffer_wbinvl1
10023 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10024 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10025 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
10026 ; GFX908-NEXT: s_cbranch_execnz .LBB46_1
10027 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
10028 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
10029 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10030 ; GFX908-NEXT: s_setpc_b64 s[30:31]
10032 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_bf16__amdgpu_no_fine_grained_memory:
10034 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10035 ; GFX8-NEXT: v_mov_b32_e32 v3, v0
10036 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
10037 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
10038 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
10039 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10040 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
10041 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10042 ; GFX8-NEXT: v_not_b32_e32 v4, v4
10043 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
10044 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10045 ; GFX8-NEXT: .LBB46_1: ; %atomicrmw.start
10046 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
10047 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10048 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
10049 ; GFX8-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10050 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
10051 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
10052 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
10053 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
10054 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
10055 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10056 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
10057 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
10058 ; GFX8-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10059 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
10060 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10061 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10062 ; GFX8-NEXT: buffer_wbinvl1
10063 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10064 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10065 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
10066 ; GFX8-NEXT: s_cbranch_execnz .LBB46_1
10067 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
10068 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
10069 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10070 ; GFX8-NEXT: s_setpc_b64 s[30:31]
10072 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_bf16__amdgpu_no_fine_grained_memory:
10074 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10075 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
10076 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
10077 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
10078 ; GFX7-NEXT: v_and_b32_e32 v3, 3, v3
10079 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10080 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v3
10081 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
10082 ; GFX7-NEXT: v_not_b32_e32 v4, v4
10083 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
10084 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
10085 ; GFX7-NEXT: .LBB46_1: ; %atomicrmw.start
10086 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
10087 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10088 ; GFX7-NEXT: v_mov_b32_e32 v6, v5
10089 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, v3, v6
10090 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
10091 ; GFX7-NEXT: v_add_f32_e32 v5, v5, v2
10092 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v5
10093 ; GFX7-NEXT: v_and_b32_e32 v7, v6, v4
10094 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, v3, v5
10095 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v5
10096 ; GFX7-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10097 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10098 ; GFX7-NEXT: buffer_wbinvl1
10099 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10100 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10101 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
10102 ; GFX7-NEXT: s_cbranch_execnz .LBB46_1
10103 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
10104 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
10105 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10106 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
10107 ; GFX7-NEXT: s_setpc_b64 s[30:31]
10108 %result = atomicrmw fadd ptr %ptr, bfloat %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
10112 define bfloat @flat_agent_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
10113 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10115 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10116 ; GFX12-NEXT: s_wait_expcnt 0x0
10117 ; GFX12-NEXT: s_wait_samplecnt 0x0
10118 ; GFX12-NEXT: s_wait_bvhcnt 0x0
10119 ; GFX12-NEXT: s_wait_kmcnt 0x0
10120 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
10121 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10122 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10123 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10124 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
10125 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
10126 ; GFX12-NEXT: s_mov_b32 s0, 0
10127 ; GFX12-NEXT: flat_load_b32 v5, v[0:1]
10128 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10129 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
10130 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
10131 ; GFX12-NEXT: v_not_b32_e32 v4, v4
10132 ; GFX12-NEXT: .LBB47_1: ; %atomicrmw.start
10133 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
10134 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10135 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
10136 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10137 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
10138 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 16, v5
10139 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10140 ; GFX12-NEXT: v_add_f32_e32 v5, v5, v2
10141 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
10142 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v5
10143 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
10144 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
10145 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
10146 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
10147 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10148 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, 16, v5
10149 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
10150 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
10151 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
10152 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
10153 ; GFX12-NEXT: s_wait_storecnt 0x0
10154 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
10155 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10156 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
10157 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
10158 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
10159 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10160 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10161 ; GFX12-NEXT: s_cbranch_execnz .LBB47_1
10162 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
10163 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
10164 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10165 ; GFX12-NEXT: s_setpc_b64 s[30:31]
10167 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10169 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10170 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
10171 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
10172 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
10173 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
10174 ; GFX940-NEXT: flat_load_dword v5, v[0:1]
10175 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
10176 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10177 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
10178 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
10179 ; GFX940-NEXT: v_not_b32_e32 v4, v4
10180 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
10181 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10182 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
10183 ; GFX940-NEXT: .LBB47_1: ; %atomicrmw.start
10184 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
10185 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10186 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
10187 ; GFX940-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10188 ; GFX940-NEXT: s_nop 0
10189 ; GFX940-NEXT: v_add_f32_e32 v5, v5, v2
10190 ; GFX940-NEXT: v_bfe_u32 v6, v5, 16, 1
10191 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v5
10192 ; GFX940-NEXT: v_add3_u32 v6, v6, v5, s2
10193 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10194 ; GFX940-NEXT: s_nop 1
10195 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
10196 ; GFX940-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10197 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
10198 ; GFX940-NEXT: buffer_wbl2 sc1
10199 ; GFX940-NEXT: flat_atomic_cmpswap v5, v[0:1], v[6:7] sc0
10200 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10201 ; GFX940-NEXT: buffer_inv sc1
10202 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
10203 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
10204 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
10205 ; GFX940-NEXT: s_cbranch_execnz .LBB47_1
10206 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
10207 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
10208 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10209 ; GFX940-NEXT: s_setpc_b64 s[30:31]
10211 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10213 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10214 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
10215 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10216 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10217 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10218 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
10219 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
10220 ; GFX11-NEXT: s_mov_b32 s0, 0
10221 ; GFX11-NEXT: flat_load_b32 v5, v[0:1]
10222 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10223 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
10224 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
10225 ; GFX11-NEXT: v_not_b32_e32 v4, v4
10226 ; GFX11-NEXT: .p2align 6
10227 ; GFX11-NEXT: .LBB47_1: ; %atomicrmw.start
10228 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
10229 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10230 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
10231 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10232 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
10233 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 16, v5
10234 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10235 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
10236 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
10237 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v5
10238 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
10239 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
10240 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
10241 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
10242 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10243 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, 16, v5
10244 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
10245 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
10246 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
10247 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
10248 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] glc
10249 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10250 ; GFX11-NEXT: buffer_gl1_inv
10251 ; GFX11-NEXT: buffer_gl0_inv
10252 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
10253 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
10254 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10255 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10256 ; GFX11-NEXT: s_cbranch_execnz .LBB47_1
10257 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
10258 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
10259 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10260 ; GFX11-NEXT: s_setpc_b64 s[30:31]
10262 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10264 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10265 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
10266 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10267 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10268 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
10269 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
10270 ; GFX10-NEXT: s_mov_b32 s4, 0
10271 ; GFX10-NEXT: flat_load_dword v5, v[0:1]
10272 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10273 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
10274 ; GFX10-NEXT: v_not_b32_e32 v4, v4
10275 ; GFX10-NEXT: .LBB47_1: ; %atomicrmw.start
10276 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
10277 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10278 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
10279 ; GFX10-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10280 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
10281 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
10282 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v5
10283 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
10284 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
10285 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
10286 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10287 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
10288 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
10289 ; GFX10-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10290 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10291 ; GFX10-NEXT: buffer_gl1_inv
10292 ; GFX10-NEXT: buffer_gl0_inv
10293 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
10294 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
10295 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
10296 ; GFX10-NEXT: s_cbranch_execnz .LBB47_1
10297 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
10298 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
10299 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10300 ; GFX10-NEXT: s_setpc_b64 s[30:31]
10302 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10304 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10305 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
10306 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
10307 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
10308 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
10309 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
10310 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10311 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
10312 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10313 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
10314 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
10315 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10316 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
10317 ; GFX90A-NEXT: .LBB47_1: ; %atomicrmw.start
10318 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
10319 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10320 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
10321 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10322 ; GFX90A-NEXT: v_add_f32_e32 v5, v5, v2
10323 ; GFX90A-NEXT: v_bfe_u32 v6, v5, 16, 1
10324 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v5
10325 ; GFX90A-NEXT: v_add3_u32 v6, v6, v5, s6
10326 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10327 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
10328 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10329 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
10330 ; GFX90A-NEXT: flat_atomic_cmpswap v5, v[0:1], v[6:7] glc
10331 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10332 ; GFX90A-NEXT: buffer_wbinvl1
10333 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
10334 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10335 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
10336 ; GFX90A-NEXT: s_cbranch_execnz .LBB47_1
10337 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
10338 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
10339 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10340 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
10342 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10344 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10345 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
10346 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
10347 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
10348 ; GFX908-NEXT: flat_load_dword v5, v[0:1]
10349 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
10350 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10351 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
10352 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10353 ; GFX908-NEXT: v_not_b32_e32 v4, v4
10354 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
10355 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10356 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
10357 ; GFX908-NEXT: .LBB47_1: ; %atomicrmw.start
10358 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
10359 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10360 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
10361 ; GFX908-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10362 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
10363 ; GFX908-NEXT: v_bfe_u32 v7, v5, 16, 1
10364 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v5
10365 ; GFX908-NEXT: v_add3_u32 v7, v7, v5, s6
10366 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10367 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc
10368 ; GFX908-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10369 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
10370 ; GFX908-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10371 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10372 ; GFX908-NEXT: buffer_wbinvl1
10373 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10374 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10375 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
10376 ; GFX908-NEXT: s_cbranch_execnz .LBB47_1
10377 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
10378 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
10379 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10380 ; GFX908-NEXT: s_setpc_b64 s[30:31]
10382 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10384 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10385 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
10386 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
10387 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
10388 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
10389 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
10390 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10391 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
10392 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10393 ; GFX8-NEXT: v_not_b32_e32 v4, v4
10394 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
10395 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10396 ; GFX8-NEXT: .LBB47_1: ; %atomicrmw.start
10397 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
10398 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10399 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
10400 ; GFX8-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10401 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
10402 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
10403 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
10404 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
10405 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
10406 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10407 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
10408 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
10409 ; GFX8-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10410 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
10411 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10412 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10413 ; GFX8-NEXT: buffer_wbinvl1
10414 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10415 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10416 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
10417 ; GFX8-NEXT: s_cbranch_execnz .LBB47_1
10418 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
10419 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
10420 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10421 ; GFX8-NEXT: s_setpc_b64 s[30:31]
10423 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10425 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10426 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0x7fe, v0
10427 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
10428 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
10429 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
10430 ; GFX7-NEXT: v_and_b32_e32 v3, 3, v3
10431 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10432 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v3
10433 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
10434 ; GFX7-NEXT: v_not_b32_e32 v4, v4
10435 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
10436 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
10437 ; GFX7-NEXT: .LBB47_1: ; %atomicrmw.start
10438 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
10439 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10440 ; GFX7-NEXT: v_mov_b32_e32 v6, v5
10441 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, v3, v6
10442 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
10443 ; GFX7-NEXT: v_add_f32_e32 v5, v5, v2
10444 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v5
10445 ; GFX7-NEXT: v_and_b32_e32 v7, v6, v4
10446 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, v3, v5
10447 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v5
10448 ; GFX7-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10449 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10450 ; GFX7-NEXT: buffer_wbinvl1
10451 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10452 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10453 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
10454 ; GFX7-NEXT: s_cbranch_execnz .LBB47_1
10455 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
10456 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
10457 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10458 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
10459 ; GFX7-NEXT: s_setpc_b64 s[30:31]
10460 %gep = getelementptr bfloat, ptr %ptr, i64 1023
10461 %result = atomicrmw fadd ptr %gep, bfloat %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
10465 define bfloat @flat_agent_atomic_fadd_ret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
10466 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
10468 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10469 ; GFX12-NEXT: s_wait_expcnt 0x0
10470 ; GFX12-NEXT: s_wait_samplecnt 0x0
10471 ; GFX12-NEXT: s_wait_bvhcnt 0x0
10472 ; GFX12-NEXT: s_wait_kmcnt 0x0
10473 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
10474 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
10475 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10476 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10477 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
10478 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
10479 ; GFX12-NEXT: s_mov_b32 s0, 0
10480 ; GFX12-NEXT: flat_load_b32 v5, v[0:1]
10481 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10482 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
10483 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
10484 ; GFX12-NEXT: v_not_b32_e32 v4, v4
10485 ; GFX12-NEXT: .LBB48_1: ; %atomicrmw.start
10486 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
10487 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10488 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
10489 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10490 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
10491 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 16, v5
10492 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10493 ; GFX12-NEXT: v_add_f32_e32 v5, v5, v2
10494 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
10495 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v5
10496 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
10497 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
10498 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
10499 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
10500 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10501 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, 16, v5
10502 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
10503 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
10504 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
10505 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
10506 ; GFX12-NEXT: s_wait_storecnt 0x0
10507 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
10508 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10509 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
10510 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
10511 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
10512 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10513 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10514 ; GFX12-NEXT: s_cbranch_execnz .LBB48_1
10515 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
10516 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
10517 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10518 ; GFX12-NEXT: s_setpc_b64 s[30:31]
10520 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
10522 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10523 ; GFX940-NEXT: s_movk_i32 s0, 0xf800
10524 ; GFX940-NEXT: s_mov_b32 s1, -1
10525 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
10526 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
10527 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
10528 ; GFX940-NEXT: flat_load_dword v5, v[0:1]
10529 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
10530 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10531 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
10532 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
10533 ; GFX940-NEXT: v_not_b32_e32 v4, v4
10534 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
10535 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10536 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
10537 ; GFX940-NEXT: .LBB48_1: ; %atomicrmw.start
10538 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
10539 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10540 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
10541 ; GFX940-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10542 ; GFX940-NEXT: s_nop 0
10543 ; GFX940-NEXT: v_add_f32_e32 v5, v5, v2
10544 ; GFX940-NEXT: v_bfe_u32 v6, v5, 16, 1
10545 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v5
10546 ; GFX940-NEXT: v_add3_u32 v6, v6, v5, s2
10547 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10548 ; GFX940-NEXT: s_nop 1
10549 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
10550 ; GFX940-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10551 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
10552 ; GFX940-NEXT: buffer_wbl2 sc1
10553 ; GFX940-NEXT: flat_atomic_cmpswap v5, v[0:1], v[6:7] sc0
10554 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10555 ; GFX940-NEXT: buffer_inv sc1
10556 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
10557 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
10558 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
10559 ; GFX940-NEXT: s_cbranch_execnz .LBB48_1
10560 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
10561 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
10562 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10563 ; GFX940-NEXT: s_setpc_b64 s[30:31]
10565 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
10567 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10568 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
10569 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
10570 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10571 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10572 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
10573 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
10574 ; GFX11-NEXT: s_mov_b32 s0, 0
10575 ; GFX11-NEXT: flat_load_b32 v5, v[0:1]
10576 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10577 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
10578 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
10579 ; GFX11-NEXT: v_not_b32_e32 v4, v4
10580 ; GFX11-NEXT: .p2align 6
10581 ; GFX11-NEXT: .LBB48_1: ; %atomicrmw.start
10582 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
10583 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10584 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
10585 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10586 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
10587 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 16, v5
10588 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10589 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
10590 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
10591 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v5
10592 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
10593 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
10594 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
10595 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
10596 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10597 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, 16, v5
10598 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
10599 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
10600 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
10601 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
10602 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] glc
10603 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10604 ; GFX11-NEXT: buffer_gl1_inv
10605 ; GFX11-NEXT: buffer_gl0_inv
10606 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
10607 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
10608 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10609 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10610 ; GFX11-NEXT: s_cbranch_execnz .LBB48_1
10611 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
10612 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
10613 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10614 ; GFX11-NEXT: s_setpc_b64 s[30:31]
10616 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
10618 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10619 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
10620 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
10621 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10622 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
10623 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
10624 ; GFX10-NEXT: s_mov_b32 s4, 0
10625 ; GFX10-NEXT: flat_load_dword v5, v[0:1]
10626 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10627 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
10628 ; GFX10-NEXT: v_not_b32_e32 v4, v4
10629 ; GFX10-NEXT: .LBB48_1: ; %atomicrmw.start
10630 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
10631 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10632 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
10633 ; GFX10-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10634 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
10635 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
10636 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v5
10637 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
10638 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
10639 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
10640 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10641 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
10642 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
10643 ; GFX10-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10644 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10645 ; GFX10-NEXT: buffer_gl1_inv
10646 ; GFX10-NEXT: buffer_gl0_inv
10647 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
10648 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
10649 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
10650 ; GFX10-NEXT: s_cbranch_execnz .LBB48_1
10651 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
10652 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
10653 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10654 ; GFX10-NEXT: s_setpc_b64 s[30:31]
10656 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
10658 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10659 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
10660 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
10661 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
10662 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
10663 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
10664 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10665 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
10666 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10667 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
10668 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
10669 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10670 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
10671 ; GFX90A-NEXT: .LBB48_1: ; %atomicrmw.start
10672 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
10673 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10674 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
10675 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10676 ; GFX90A-NEXT: v_add_f32_e32 v5, v5, v2
10677 ; GFX90A-NEXT: v_bfe_u32 v6, v5, 16, 1
10678 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v5
10679 ; GFX90A-NEXT: v_add3_u32 v6, v6, v5, s6
10680 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10681 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
10682 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10683 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
10684 ; GFX90A-NEXT: flat_atomic_cmpswap v5, v[0:1], v[6:7] glc
10685 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10686 ; GFX90A-NEXT: buffer_wbinvl1
10687 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
10688 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10689 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
10690 ; GFX90A-NEXT: s_cbranch_execnz .LBB48_1
10691 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
10692 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
10693 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10694 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
10696 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
10698 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10699 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
10700 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
10701 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
10702 ; GFX908-NEXT: flat_load_dword v5, v[0:1]
10703 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
10704 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10705 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
10706 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10707 ; GFX908-NEXT: v_not_b32_e32 v4, v4
10708 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
10709 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10710 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
10711 ; GFX908-NEXT: .LBB48_1: ; %atomicrmw.start
10712 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
10713 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10714 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
10715 ; GFX908-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10716 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
10717 ; GFX908-NEXT: v_bfe_u32 v7, v5, 16, 1
10718 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v5
10719 ; GFX908-NEXT: v_add3_u32 v7, v7, v5, s6
10720 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10721 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc
10722 ; GFX908-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10723 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
10724 ; GFX908-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10725 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10726 ; GFX908-NEXT: buffer_wbinvl1
10727 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10728 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10729 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
10730 ; GFX908-NEXT: s_cbranch_execnz .LBB48_1
10731 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
10732 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
10733 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10734 ; GFX908-NEXT: s_setpc_b64 s[30:31]
10736 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
10738 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10739 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
10740 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
10741 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
10742 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
10743 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
10744 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10745 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
10746 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
10747 ; GFX8-NEXT: v_not_b32_e32 v4, v4
10748 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
10749 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10750 ; GFX8-NEXT: .LBB48_1: ; %atomicrmw.start
10751 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
10752 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10753 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
10754 ; GFX8-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10755 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
10756 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
10757 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
10758 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
10759 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
10760 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
10761 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
10762 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
10763 ; GFX8-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10764 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
10765 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10766 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10767 ; GFX8-NEXT: buffer_wbinvl1
10768 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10769 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10770 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
10771 ; GFX8-NEXT: s_cbranch_execnz .LBB48_1
10772 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
10773 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
10774 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10775 ; GFX8-NEXT: s_setpc_b64 s[30:31]
10777 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
10779 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10780 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0xfffff800, v0
10781 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
10782 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
10783 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
10784 ; GFX7-NEXT: v_and_b32_e32 v3, 3, v3
10785 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 3, v3
10786 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v3
10787 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
10788 ; GFX7-NEXT: v_not_b32_e32 v4, v4
10789 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
10790 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
10791 ; GFX7-NEXT: .LBB48_1: ; %atomicrmw.start
10792 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
10793 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10794 ; GFX7-NEXT: v_mov_b32_e32 v6, v5
10795 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, v3, v6
10796 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
10797 ; GFX7-NEXT: v_add_f32_e32 v5, v5, v2
10798 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v5
10799 ; GFX7-NEXT: v_and_b32_e32 v7, v6, v4
10800 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, v3, v5
10801 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v5
10802 ; GFX7-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
10803 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10804 ; GFX7-NEXT: buffer_wbinvl1
10805 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
10806 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
10807 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
10808 ; GFX7-NEXT: s_cbranch_execnz .LBB48_1
10809 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
10810 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
10811 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v3, v5
10812 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
10813 ; GFX7-NEXT: s_setpc_b64 s[30:31]
10814 %gep = getelementptr bfloat, ptr %ptr, i64 -1024
10815 %result = atomicrmw fadd ptr %gep, bfloat %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
10819 define void @flat_agent_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
10820 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10822 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10823 ; GFX12-NEXT: s_wait_expcnt 0x0
10824 ; GFX12-NEXT: s_wait_samplecnt 0x0
10825 ; GFX12-NEXT: s_wait_bvhcnt 0x0
10826 ; GFX12-NEXT: s_wait_kmcnt 0x0
10827 ; GFX12-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
10828 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10829 ; GFX12-NEXT: v_lshlrev_b32_e32 v6, 16, v2
10830 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10831 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v4
10832 ; GFX12-NEXT: v_and_b32_e32 v4, 3, v4
10833 ; GFX12-NEXT: s_mov_b32 s0, 0
10834 ; GFX12-NEXT: flat_load_b32 v3, v[0:1]
10835 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 3, v4
10836 ; GFX12-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
10837 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
10838 ; GFX12-NEXT: v_not_b32_e32 v5, v5
10839 ; GFX12-NEXT: .LBB49_1: ; %atomicrmw.start
10840 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
10841 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10842 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, v4, v3
10843 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10844 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10845 ; GFX12-NEXT: v_add_f32_e32 v2, v2, v6
10846 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
10847 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
10848 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v2
10849 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
10850 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
10851 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10852 ; GFX12-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
10853 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10854 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10855 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, v4, v2
10856 ; GFX12-NEXT: v_and_or_b32 v2, v3, v5, v2
10857 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
10858 ; GFX12-NEXT: s_wait_storecnt 0x0
10859 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
10860 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
10861 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
10862 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
10863 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
10864 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
10865 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10866 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10867 ; GFX12-NEXT: s_cbranch_execnz .LBB49_1
10868 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
10869 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
10870 ; GFX12-NEXT: s_setpc_b64 s[30:31]
10872 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10874 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10875 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
10876 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
10877 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
10878 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
10879 ; GFX940-NEXT: flat_load_dword v3, v[0:1]
10880 ; GFX940-NEXT: v_and_b32_e32 v4, 3, v4
10881 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 3, v4
10882 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
10883 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v4, s0
10884 ; GFX940-NEXT: v_not_b32_e32 v5, v5
10885 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
10886 ; GFX940-NEXT: v_lshlrev_b32_e32 v6, 16, v2
10887 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
10888 ; GFX940-NEXT: .LBB49_1: ; %atomicrmw.start
10889 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
10890 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10891 ; GFX940-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10892 ; GFX940-NEXT: s_nop 0
10893 ; GFX940-NEXT: v_add_f32_e32 v2, v2, v6
10894 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
10895 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
10896 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s2
10897 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
10898 ; GFX940-NEXT: s_nop 1
10899 ; GFX940-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
10900 ; GFX940-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10901 ; GFX940-NEXT: v_and_or_b32 v2, v3, v5, v2
10902 ; GFX940-NEXT: buffer_wbl2 sc1
10903 ; GFX940-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] sc0
10904 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10905 ; GFX940-NEXT: buffer_inv sc1
10906 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
10907 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
10908 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
10909 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
10910 ; GFX940-NEXT: s_cbranch_execnz .LBB49_1
10911 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
10912 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
10913 ; GFX940-NEXT: s_setpc_b64 s[30:31]
10915 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10917 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10918 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
10919 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10920 ; GFX11-NEXT: v_lshlrev_b32_e32 v6, 16, v2
10921 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
10922 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v4
10923 ; GFX11-NEXT: v_and_b32_e32 v4, 3, v4
10924 ; GFX11-NEXT: s_mov_b32 s0, 0
10925 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
10926 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 3, v4
10927 ; GFX11-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
10928 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
10929 ; GFX11-NEXT: v_not_b32_e32 v5, v5
10930 ; GFX11-NEXT: .p2align 6
10931 ; GFX11-NEXT: .LBB49_1: ; %atomicrmw.start
10932 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
10933 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10934 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, v4, v3
10935 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10936 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
10937 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v6
10938 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
10939 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
10940 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v2
10941 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
10942 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
10943 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10944 ; GFX11-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
10945 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, 16, v2
10946 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
10947 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, v4, v2
10948 ; GFX11-NEXT: v_and_or_b32 v2, v3, v5, v2
10949 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
10950 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] glc
10951 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10952 ; GFX11-NEXT: buffer_gl1_inv
10953 ; GFX11-NEXT: buffer_gl0_inv
10954 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
10955 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
10956 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
10957 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
10958 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
10959 ; GFX11-NEXT: s_cbranch_execnz .LBB49_1
10960 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
10961 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
10962 ; GFX11-NEXT: s_setpc_b64 s[30:31]
10964 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
10966 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10967 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
10968 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
10969 ; GFX10-NEXT: v_lshlrev_b32_e32 v6, 16, v2
10970 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v4
10971 ; GFX10-NEXT: v_and_b32_e32 v4, 3, v4
10972 ; GFX10-NEXT: s_mov_b32 s4, 0
10973 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
10974 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 3, v4
10975 ; GFX10-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
10976 ; GFX10-NEXT: v_not_b32_e32 v5, v5
10977 ; GFX10-NEXT: .LBB49_1: ; %atomicrmw.start
10978 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
10979 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10980 ; GFX10-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
10981 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v6
10982 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
10983 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v2
10984 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
10985 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
10986 ; GFX10-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
10987 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
10988 ; GFX10-NEXT: v_and_or_b32 v2, v3, v5, v2
10989 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
10990 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
10991 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
10992 ; GFX10-NEXT: buffer_gl1_inv
10993 ; GFX10-NEXT: buffer_gl0_inv
10994 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
10995 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
10996 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
10997 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
10998 ; GFX10-NEXT: s_cbranch_execnz .LBB49_1
10999 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
11000 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
11001 ; GFX10-NEXT: s_setpc_b64 s[30:31]
11003 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
11005 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11006 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
11007 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
11008 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v4
11009 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
11010 ; GFX90A-NEXT: v_and_b32_e32 v4, 3, v4
11011 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11012 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
11013 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v4, s4
11014 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
11015 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
11016 ; GFX90A-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11017 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
11018 ; GFX90A-NEXT: .LBB49_1: ; %atomicrmw.start
11019 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
11020 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11021 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11022 ; GFX90A-NEXT: v_add_f32_e32 v2, v2, v6
11023 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
11024 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
11025 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s6
11026 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11027 ; GFX90A-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
11028 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11029 ; GFX90A-NEXT: v_and_or_b32 v2, v3, v5, v2
11030 ; GFX90A-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11031 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11032 ; GFX90A-NEXT: buffer_wbinvl1
11033 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11034 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11035 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
11036 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
11037 ; GFX90A-NEXT: s_cbranch_execnz .LBB49_1
11038 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
11039 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
11040 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
11042 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
11044 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11045 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
11046 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
11047 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v4
11048 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
11049 ; GFX908-NEXT: v_and_b32_e32 v4, 3, v4
11050 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11051 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
11052 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v4, s4
11053 ; GFX908-NEXT: v_not_b32_e32 v5, v5
11054 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
11055 ; GFX908-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11056 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
11057 ; GFX908-NEXT: .LBB49_1: ; %atomicrmw.start
11058 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
11059 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11060 ; GFX908-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11061 ; GFX908-NEXT: v_add_f32_e32 v2, v2, v6
11062 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
11063 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
11064 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s6
11065 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11066 ; GFX908-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
11067 ; GFX908-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11068 ; GFX908-NEXT: v_and_or_b32 v2, v3, v5, v2
11069 ; GFX908-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11070 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11071 ; GFX908-NEXT: buffer_wbinvl1
11072 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11073 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11074 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
11075 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
11076 ; GFX908-NEXT: s_cbranch_execnz .LBB49_1
11077 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
11078 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
11079 ; GFX908-NEXT: s_setpc_b64 s[30:31]
11081 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
11083 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11084 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7fe, v0
11085 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
11086 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v4
11087 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
11088 ; GFX8-NEXT: v_and_b32_e32 v4, 3, v4
11089 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11090 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
11091 ; GFX8-NEXT: v_lshlrev_b32_e64 v5, v4, s4
11092 ; GFX8-NEXT: v_not_b32_e32 v5, v5
11093 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
11094 ; GFX8-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11095 ; GFX8-NEXT: .LBB49_1: ; %atomicrmw.start
11096 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
11097 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11098 ; GFX8-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11099 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v6
11100 ; GFX8-NEXT: v_bfe_u32 v8, v2, 16, 1
11101 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v2
11102 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
11103 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v2
11104 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11105 ; GFX8-NEXT: v_cndmask_b32_e32 v2, v8, v9, vcc
11106 ; GFX8-NEXT: v_and_b32_e32 v7, v3, v5
11107 ; GFX8-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11108 ; GFX8-NEXT: v_or_b32_e32 v2, v7, v2
11109 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11110 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11111 ; GFX8-NEXT: buffer_wbinvl1
11112 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11113 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11114 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
11115 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
11116 ; GFX8-NEXT: s_cbranch_execnz .LBB49_1
11117 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
11118 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
11119 ; GFX8-NEXT: s_setpc_b64 s[30:31]
11121 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
11123 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11124 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
11125 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
11126 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
11127 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
11128 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
11129 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11130 ; GFX7-NEXT: v_lshl_b32_e32 v5, 0xffff, v4
11131 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
11132 ; GFX7-NEXT: v_not_b32_e32 v5, v5
11133 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
11134 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
11135 ; GFX7-NEXT: .LBB49_1: ; %atomicrmw.start
11136 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
11137 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11138 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
11139 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11140 ; GFX7-NEXT: v_add_f32_e32 v2, v2, v6
11141 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11142 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v5
11143 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
11144 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
11145 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11146 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11147 ; GFX7-NEXT: buffer_wbinvl1
11148 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11149 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11150 ; GFX7-NEXT: v_mov_b32_e32 v3, v2
11151 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
11152 ; GFX7-NEXT: s_cbranch_execnz .LBB49_1
11153 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
11154 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
11155 ; GFX7-NEXT: s_setpc_b64 s[30:31]
11156 %gep = getelementptr bfloat, ptr %ptr, i64 1023
11157 %unused = atomicrmw fadd ptr %gep, bfloat %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
11161 define void @flat_agent_atomic_fadd_noret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
11162 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
11164 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11165 ; GFX12-NEXT: s_wait_expcnt 0x0
11166 ; GFX12-NEXT: s_wait_samplecnt 0x0
11167 ; GFX12-NEXT: s_wait_bvhcnt 0x0
11168 ; GFX12-NEXT: s_wait_kmcnt 0x0
11169 ; GFX12-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
11170 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
11171 ; GFX12-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11172 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
11173 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v4
11174 ; GFX12-NEXT: v_and_b32_e32 v4, 3, v4
11175 ; GFX12-NEXT: s_mov_b32 s0, 0
11176 ; GFX12-NEXT: flat_load_b32 v3, v[0:1]
11177 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11178 ; GFX12-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
11179 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
11180 ; GFX12-NEXT: v_not_b32_e32 v5, v5
11181 ; GFX12-NEXT: .LBB50_1: ; %atomicrmw.start
11182 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
11183 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11184 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, v4, v3
11185 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11186 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11187 ; GFX12-NEXT: v_add_f32_e32 v2, v2, v6
11188 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
11189 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
11190 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v2
11191 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
11192 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
11193 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11194 ; GFX12-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
11195 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11196 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11197 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, v4, v2
11198 ; GFX12-NEXT: v_and_or_b32 v2, v3, v5, v2
11199 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
11200 ; GFX12-NEXT: s_wait_storecnt 0x0
11201 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
11202 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11203 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
11204 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
11205 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
11206 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
11207 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11208 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11209 ; GFX12-NEXT: s_cbranch_execnz .LBB50_1
11210 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
11211 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
11212 ; GFX12-NEXT: s_setpc_b64 s[30:31]
11214 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
11216 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11217 ; GFX940-NEXT: s_movk_i32 s0, 0xf800
11218 ; GFX940-NEXT: s_mov_b32 s1, -1
11219 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
11220 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
11221 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
11222 ; GFX940-NEXT: flat_load_dword v3, v[0:1]
11223 ; GFX940-NEXT: v_and_b32_e32 v4, 3, v4
11224 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11225 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
11226 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v4, s0
11227 ; GFX940-NEXT: v_not_b32_e32 v5, v5
11228 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
11229 ; GFX940-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11230 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
11231 ; GFX940-NEXT: .LBB50_1: ; %atomicrmw.start
11232 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
11233 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11234 ; GFX940-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11235 ; GFX940-NEXT: s_nop 0
11236 ; GFX940-NEXT: v_add_f32_e32 v2, v2, v6
11237 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
11238 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
11239 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s2
11240 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11241 ; GFX940-NEXT: s_nop 1
11242 ; GFX940-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
11243 ; GFX940-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11244 ; GFX940-NEXT: v_and_or_b32 v2, v3, v5, v2
11245 ; GFX940-NEXT: buffer_wbl2 sc1
11246 ; GFX940-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] sc0
11247 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11248 ; GFX940-NEXT: buffer_inv sc1
11249 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11250 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
11251 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
11252 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
11253 ; GFX940-NEXT: s_cbranch_execnz .LBB50_1
11254 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
11255 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
11256 ; GFX940-NEXT: s_setpc_b64 s[30:31]
11258 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
11260 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11261 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
11262 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
11263 ; GFX11-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11264 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
11265 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v4
11266 ; GFX11-NEXT: v_and_b32_e32 v4, 3, v4
11267 ; GFX11-NEXT: s_mov_b32 s0, 0
11268 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
11269 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11270 ; GFX11-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
11271 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
11272 ; GFX11-NEXT: v_not_b32_e32 v5, v5
11273 ; GFX11-NEXT: .p2align 6
11274 ; GFX11-NEXT: .LBB50_1: ; %atomicrmw.start
11275 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
11276 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11277 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, v4, v3
11278 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11279 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11280 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v6
11281 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
11282 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
11283 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v2
11284 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
11285 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
11286 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11287 ; GFX11-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
11288 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11289 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11290 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, v4, v2
11291 ; GFX11-NEXT: v_and_or_b32 v2, v3, v5, v2
11292 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
11293 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] glc
11294 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11295 ; GFX11-NEXT: buffer_gl1_inv
11296 ; GFX11-NEXT: buffer_gl0_inv
11297 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
11298 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
11299 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
11300 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11301 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11302 ; GFX11-NEXT: s_cbranch_execnz .LBB50_1
11303 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
11304 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
11305 ; GFX11-NEXT: s_setpc_b64 s[30:31]
11307 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
11309 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11310 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v0
11311 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
11312 ; GFX10-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11313 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v4
11314 ; GFX10-NEXT: v_and_b32_e32 v4, 3, v4
11315 ; GFX10-NEXT: s_mov_b32 s4, 0
11316 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
11317 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11318 ; GFX10-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
11319 ; GFX10-NEXT: v_not_b32_e32 v5, v5
11320 ; GFX10-NEXT: .LBB50_1: ; %atomicrmw.start
11321 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
11322 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11323 ; GFX10-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11324 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v6
11325 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
11326 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v2
11327 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
11328 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
11329 ; GFX10-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
11330 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11331 ; GFX10-NEXT: v_and_or_b32 v2, v3, v5, v2
11332 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
11333 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11334 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11335 ; GFX10-NEXT: buffer_gl1_inv
11336 ; GFX10-NEXT: buffer_gl0_inv
11337 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
11338 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
11339 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
11340 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
11341 ; GFX10-NEXT: s_cbranch_execnz .LBB50_1
11342 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
11343 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
11344 ; GFX10-NEXT: s_setpc_b64 s[30:31]
11346 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
11348 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11349 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
11350 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
11351 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v4
11352 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
11353 ; GFX90A-NEXT: v_and_b32_e32 v4, 3, v4
11354 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11355 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
11356 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v4, s4
11357 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
11358 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
11359 ; GFX90A-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11360 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
11361 ; GFX90A-NEXT: .LBB50_1: ; %atomicrmw.start
11362 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
11363 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11364 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11365 ; GFX90A-NEXT: v_add_f32_e32 v2, v2, v6
11366 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
11367 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
11368 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s6
11369 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11370 ; GFX90A-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
11371 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11372 ; GFX90A-NEXT: v_and_or_b32 v2, v3, v5, v2
11373 ; GFX90A-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11374 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11375 ; GFX90A-NEXT: buffer_wbinvl1
11376 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11377 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11378 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
11379 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
11380 ; GFX90A-NEXT: s_cbranch_execnz .LBB50_1
11381 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
11382 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
11383 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
11385 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
11387 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11388 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
11389 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
11390 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v4
11391 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
11392 ; GFX908-NEXT: v_and_b32_e32 v4, 3, v4
11393 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11394 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
11395 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v4, s4
11396 ; GFX908-NEXT: v_not_b32_e32 v5, v5
11397 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
11398 ; GFX908-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11399 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
11400 ; GFX908-NEXT: .LBB50_1: ; %atomicrmw.start
11401 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
11402 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11403 ; GFX908-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11404 ; GFX908-NEXT: v_add_f32_e32 v2, v2, v6
11405 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
11406 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
11407 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s6
11408 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11409 ; GFX908-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
11410 ; GFX908-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11411 ; GFX908-NEXT: v_and_or_b32 v2, v3, v5, v2
11412 ; GFX908-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11413 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11414 ; GFX908-NEXT: buffer_wbinvl1
11415 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11416 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11417 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
11418 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
11419 ; GFX908-NEXT: s_cbranch_execnz .LBB50_1
11420 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
11421 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
11422 ; GFX908-NEXT: s_setpc_b64 s[30:31]
11424 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
11426 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11427 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0xfffff800, v0
11428 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
11429 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v4
11430 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
11431 ; GFX8-NEXT: v_and_b32_e32 v4, 3, v4
11432 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11433 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
11434 ; GFX8-NEXT: v_lshlrev_b32_e64 v5, v4, s4
11435 ; GFX8-NEXT: v_not_b32_e32 v5, v5
11436 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
11437 ; GFX8-NEXT: v_lshlrev_b32_e32 v6, 16, v2
11438 ; GFX8-NEXT: .LBB50_1: ; %atomicrmw.start
11439 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
11440 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11441 ; GFX8-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
11442 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v6
11443 ; GFX8-NEXT: v_bfe_u32 v8, v2, 16, 1
11444 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v2
11445 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
11446 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v2
11447 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11448 ; GFX8-NEXT: v_cndmask_b32_e32 v2, v8, v9, vcc
11449 ; GFX8-NEXT: v_and_b32_e32 v7, v3, v5
11450 ; GFX8-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11451 ; GFX8-NEXT: v_or_b32_e32 v2, v7, v2
11452 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11453 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11454 ; GFX8-NEXT: buffer_wbinvl1
11455 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11456 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11457 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
11458 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
11459 ; GFX8-NEXT: s_cbranch_execnz .LBB50_1
11460 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
11461 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
11462 ; GFX8-NEXT: s_setpc_b64 s[30:31]
11464 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
11466 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11467 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
11468 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
11469 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
11470 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
11471 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
11472 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
11473 ; GFX7-NEXT: v_lshl_b32_e32 v5, 0xffff, v4
11474 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
11475 ; GFX7-NEXT: v_not_b32_e32 v5, v5
11476 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
11477 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
11478 ; GFX7-NEXT: .LBB50_1: ; %atomicrmw.start
11479 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
11480 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11481 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
11482 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11483 ; GFX7-NEXT: v_add_f32_e32 v2, v2, v6
11484 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11485 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v5
11486 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
11487 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
11488 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11489 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11490 ; GFX7-NEXT: buffer_wbinvl1
11491 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11492 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11493 ; GFX7-NEXT: v_mov_b32_e32 v3, v2
11494 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
11495 ; GFX7-NEXT: s_cbranch_execnz .LBB50_1
11496 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
11497 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
11498 ; GFX7-NEXT: s_setpc_b64 s[30:31]
11499 %gep = getelementptr bfloat, ptr %ptr, i64 -1024
11500 %unused = atomicrmw fadd ptr %gep, bfloat %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
11504 define bfloat @flat_agent_atomic_fadd_ret_bf16__offset12b_pos__align4__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
11505 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
11507 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11508 ; GFX12-NEXT: s_wait_expcnt 0x0
11509 ; GFX12-NEXT: s_wait_samplecnt 0x0
11510 ; GFX12-NEXT: s_wait_bvhcnt 0x0
11511 ; GFX12-NEXT: s_wait_kmcnt 0x0
11512 ; GFX12-NEXT: flat_load_b32 v3, v[0:1] offset:2046
11513 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11514 ; GFX12-NEXT: s_mov_b32 s0, 0
11515 ; GFX12-NEXT: .LBB51_1: ; %atomicrmw.start
11516 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
11517 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11518 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
11519 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11520 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v4
11521 ; GFX12-NEXT: v_add_f32_e32 v3, v3, v2
11522 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
11523 ; GFX12-NEXT: v_bfe_u32 v5, v3, 16, 1
11524 ; GFX12-NEXT: v_or_b32_e32 v6, 0x400000, v3
11525 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
11526 ; GFX12-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
11527 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11528 ; GFX12-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
11529 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, 16, v3
11530 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
11531 ; GFX12-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
11532 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
11533 ; GFX12-NEXT: s_wait_storecnt 0x0
11534 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2046 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
11535 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11536 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
11537 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11538 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
11539 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11540 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11541 ; GFX12-NEXT: s_cbranch_execnz .LBB51_1
11542 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
11543 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
11544 ; GFX12-NEXT: v_mov_b32_e32 v0, v3
11545 ; GFX12-NEXT: s_setpc_b64 s[30:31]
11547 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
11549 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11550 ; GFX940-NEXT: flat_load_dword v3, v[0:1] offset:2046
11551 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
11552 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11553 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
11554 ; GFX940-NEXT: s_mov_b32 s3, 0xffff0000
11555 ; GFX940-NEXT: .LBB51_1: ; %atomicrmw.start
11556 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
11557 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11558 ; GFX940-NEXT: v_mov_b32_e32 v5, v3
11559 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 16, v5
11560 ; GFX940-NEXT: v_add_f32_e32 v3, v3, v2
11561 ; GFX940-NEXT: v_bfe_u32 v4, v3, 16, 1
11562 ; GFX940-NEXT: v_or_b32_e32 v6, 0x400000, v3
11563 ; GFX940-NEXT: v_add3_u32 v4, v4, v3, s2
11564 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
11565 ; GFX940-NEXT: s_nop 1
11566 ; GFX940-NEXT: v_cndmask_b32_e32 v3, v4, v6, vcc
11567 ; GFX940-NEXT: v_lshrrev_b32_e32 v3, 16, v3
11568 ; GFX940-NEXT: v_and_or_b32 v4, v5, s3, v3
11569 ; GFX940-NEXT: buffer_wbl2 sc1
11570 ; GFX940-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2046 sc0
11571 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11572 ; GFX940-NEXT: buffer_inv sc1
11573 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
11574 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
11575 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
11576 ; GFX940-NEXT: s_cbranch_execnz .LBB51_1
11577 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
11578 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
11579 ; GFX940-NEXT: v_mov_b32_e32 v0, v3
11580 ; GFX940-NEXT: s_setpc_b64 s[30:31]
11582 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
11584 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11585 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2046
11586 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11587 ; GFX11-NEXT: s_mov_b32 s0, 0
11588 ; GFX11-NEXT: .p2align 6
11589 ; GFX11-NEXT: .LBB51_1: ; %atomicrmw.start
11590 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
11591 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11592 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
11593 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11594 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v4
11595 ; GFX11-NEXT: v_add_f32_e32 v3, v3, v2
11596 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
11597 ; GFX11-NEXT: v_bfe_u32 v5, v3, 16, 1
11598 ; GFX11-NEXT: v_or_b32_e32 v6, 0x400000, v3
11599 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
11600 ; GFX11-NEXT: v_add3_u32 v5, v5, v3, 0x7fff
11601 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11602 ; GFX11-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc_lo
11603 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v3
11604 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
11605 ; GFX11-NEXT: v_and_or_b32 v3, 0xffff0000, v4, v3
11606 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
11607 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2046 glc
11608 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11609 ; GFX11-NEXT: buffer_gl1_inv
11610 ; GFX11-NEXT: buffer_gl0_inv
11611 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
11612 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
11613 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11614 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11615 ; GFX11-NEXT: s_cbranch_execnz .LBB51_1
11616 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
11617 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
11618 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
11619 ; GFX11-NEXT: s_setpc_b64 s[30:31]
11621 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
11623 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11624 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
11625 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
11626 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 16, v2
11627 ; GFX10-NEXT: s_mov_b32 s4, 0
11628 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
11629 ; GFX10-NEXT: .LBB51_1: ; %atomicrmw.start
11630 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
11631 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11632 ; GFX10-NEXT: v_mov_b32_e32 v6, v0
11633 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 16, v6
11634 ; GFX10-NEXT: v_add_f32_e32 v0, v0, v1
11635 ; GFX10-NEXT: v_bfe_u32 v2, v0, 16, 1
11636 ; GFX10-NEXT: v_or_b32_e32 v5, 0x400000, v0
11637 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v0, v0
11638 ; GFX10-NEXT: v_add3_u32 v2, v2, v0, 0x7fff
11639 ; GFX10-NEXT: v_cndmask_b32_e32 v0, v2, v5, vcc_lo
11640 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, 16, v0
11641 ; GFX10-NEXT: v_and_or_b32 v5, 0xffff0000, v6, v0
11642 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
11643 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
11644 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11645 ; GFX10-NEXT: buffer_gl1_inv
11646 ; GFX10-NEXT: buffer_gl0_inv
11647 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v6
11648 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
11649 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
11650 ; GFX10-NEXT: s_cbranch_execnz .LBB51_1
11651 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
11652 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
11653 ; GFX10-NEXT: s_setpc_b64 s[30:31]
11655 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
11657 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11658 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2046
11659 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
11660 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11661 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
11662 ; GFX90A-NEXT: s_mov_b32 s7, 0xffff0000
11663 ; GFX90A-NEXT: .LBB51_1: ; %atomicrmw.start
11664 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
11665 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11666 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
11667 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v5
11668 ; GFX90A-NEXT: v_add_f32_e32 v3, v3, v2
11669 ; GFX90A-NEXT: v_bfe_u32 v4, v3, 16, 1
11670 ; GFX90A-NEXT: v_or_b32_e32 v6, 0x400000, v3
11671 ; GFX90A-NEXT: v_add3_u32 v4, v4, v3, s6
11672 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
11673 ; GFX90A-NEXT: v_cndmask_b32_e32 v3, v4, v6, vcc
11674 ; GFX90A-NEXT: v_lshrrev_b32_e32 v3, 16, v3
11675 ; GFX90A-NEXT: v_and_or_b32 v4, v5, s7, v3
11676 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2046 glc
11677 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11678 ; GFX90A-NEXT: buffer_wbinvl1
11679 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
11680 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11681 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
11682 ; GFX90A-NEXT: s_cbranch_execnz .LBB51_1
11683 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
11684 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
11685 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
11686 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
11688 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
11690 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11691 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2046
11692 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
11693 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
11694 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
11695 ; GFX908-NEXT: s_mov_b32 s7, 0xffff0000
11696 ; GFX908-NEXT: .LBB51_1: ; %atomicrmw.start
11697 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
11698 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11699 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
11700 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v4
11701 ; GFX908-NEXT: v_add_f32_e32 v3, v3, v2
11702 ; GFX908-NEXT: v_bfe_u32 v5, v3, 16, 1
11703 ; GFX908-NEXT: v_or_b32_e32 v6, 0x400000, v3
11704 ; GFX908-NEXT: v_add3_u32 v5, v5, v3, s6
11705 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
11706 ; GFX908-NEXT: v_cndmask_b32_e32 v3, v5, v6, vcc
11707 ; GFX908-NEXT: v_lshrrev_b32_e32 v3, 16, v3
11708 ; GFX908-NEXT: v_and_or_b32 v3, v4, s7, v3
11709 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2046 glc
11710 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11711 ; GFX908-NEXT: buffer_wbinvl1
11712 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
11713 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11714 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
11715 ; GFX908-NEXT: s_cbranch_execnz .LBB51_1
11716 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
11717 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
11718 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
11719 ; GFX908-NEXT: s_setpc_b64 s[30:31]
11721 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
11723 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11724 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
11725 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
11726 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
11727 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
11728 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 16, v2
11729 ; GFX8-NEXT: .LBB51_1: ; %atomicrmw.start
11730 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
11731 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11732 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
11733 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v6
11734 ; GFX8-NEXT: v_add_f32_e32 v0, v0, v1
11735 ; GFX8-NEXT: v_bfe_u32 v5, v0, 16, 1
11736 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, v5, v0
11737 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, 0x7fff, v5
11738 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v0
11739 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v0, v0
11740 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
11741 ; GFX8-NEXT: v_cndmask_b32_e32 v0, v5, v7, vcc
11742 ; GFX8-NEXT: v_or_b32_sdwa v5, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
11743 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
11744 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11745 ; GFX8-NEXT: buffer_wbinvl1
11746 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
11747 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11748 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
11749 ; GFX8-NEXT: s_cbranch_execnz .LBB51_1
11750 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
11751 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
11752 ; GFX8-NEXT: s_setpc_b64 s[30:31]
11754 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_bf16__offset12b_pos__align4__amdgpu_no_fine_grained_memory:
11756 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11757 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fe, v0
11758 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
11759 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
11760 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
11761 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
11762 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
11763 ; GFX7-NEXT: .LBB51_1: ; %atomicrmw.start
11764 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
11765 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11766 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
11767 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v4
11768 ; GFX7-NEXT: v_add_f32_e32 v3, v3, v2
11769 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v4
11770 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v3
11771 ; GFX7-NEXT: v_or_b32_e32 v3, v5, v3
11772 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
11773 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11774 ; GFX7-NEXT: buffer_wbinvl1
11775 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
11776 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11777 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
11778 ; GFX7-NEXT: s_cbranch_execnz .LBB51_1
11779 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
11780 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
11781 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v3
11782 ; GFX7-NEXT: s_setpc_b64 s[30:31]
11783 %gep = getelementptr bfloat, ptr %ptr, i64 1023
11784 %result = atomicrmw fadd ptr %gep, bfloat %val syncscope("agent") seq_cst, align 4, !amdgpu.no.fine.grained.memory !0
11788 define void @flat_agent_atomic_fadd_noret_bf16__offset12b__align4_pos__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
11789 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
11791 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11792 ; GFX12-NEXT: s_wait_expcnt 0x0
11793 ; GFX12-NEXT: s_wait_samplecnt 0x0
11794 ; GFX12-NEXT: s_wait_bvhcnt 0x0
11795 ; GFX12-NEXT: s_wait_kmcnt 0x0
11796 ; GFX12-NEXT: flat_load_b32 v3, v[0:1] offset:2046
11797 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 16, v2
11798 ; GFX12-NEXT: s_mov_b32 s0, 0
11799 ; GFX12-NEXT: .LBB52_1: ; %atomicrmw.start
11800 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
11801 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11802 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v3
11803 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11804 ; GFX12-NEXT: v_add_f32_e32 v2, v2, v4
11805 ; GFX12-NEXT: v_bfe_u32 v5, v2, 16, 1
11806 ; GFX12-NEXT: v_or_b32_e32 v6, 0x400000, v2
11807 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
11808 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
11809 ; GFX12-NEXT: v_add3_u32 v5, v5, v2, 0x7fff
11810 ; GFX12-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc_lo
11811 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11812 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11813 ; GFX12-NEXT: v_and_or_b32 v2, 0xffff0000, v3, v2
11814 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
11815 ; GFX12-NEXT: s_wait_storecnt 0x0
11816 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:2046 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
11817 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
11818 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
11819 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
11820 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
11821 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
11822 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11823 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11824 ; GFX12-NEXT: s_cbranch_execnz .LBB52_1
11825 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
11826 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
11827 ; GFX12-NEXT: s_setpc_b64 s[30:31]
11829 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
11831 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11832 ; GFX940-NEXT: flat_load_dword v3, v[0:1] offset:2046
11833 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
11834 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 16, v2
11835 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
11836 ; GFX940-NEXT: s_mov_b32 s3, 0xffff0000
11837 ; GFX940-NEXT: .LBB52_1: ; %atomicrmw.start
11838 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
11839 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11840 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v3
11841 ; GFX940-NEXT: v_add_f32_e32 v2, v2, v4
11842 ; GFX940-NEXT: v_bfe_u32 v5, v2, 16, 1
11843 ; GFX940-NEXT: v_or_b32_e32 v6, 0x400000, v2
11844 ; GFX940-NEXT: v_add3_u32 v5, v5, v2, s2
11845 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11846 ; GFX940-NEXT: s_nop 1
11847 ; GFX940-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc
11848 ; GFX940-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11849 ; GFX940-NEXT: v_and_or_b32 v2, v3, s3, v2
11850 ; GFX940-NEXT: buffer_wbl2 sc1
11851 ; GFX940-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:2046 sc0
11852 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11853 ; GFX940-NEXT: buffer_inv sc1
11854 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11855 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
11856 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
11857 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
11858 ; GFX940-NEXT: s_cbranch_execnz .LBB52_1
11859 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
11860 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
11861 ; GFX940-NEXT: s_setpc_b64 s[30:31]
11863 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
11865 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11866 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2046
11867 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
11868 ; GFX11-NEXT: s_mov_b32 s0, 0
11869 ; GFX11-NEXT: .p2align 6
11870 ; GFX11-NEXT: .LBB52_1: ; %atomicrmw.start
11871 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
11872 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11873 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
11874 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11875 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v4
11876 ; GFX11-NEXT: v_bfe_u32 v5, v2, 16, 1
11877 ; GFX11-NEXT: v_or_b32_e32 v6, 0x400000, v2
11878 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
11879 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
11880 ; GFX11-NEXT: v_add3_u32 v5, v5, v2, 0x7fff
11881 ; GFX11-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc_lo
11882 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
11883 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11884 ; GFX11-NEXT: v_and_or_b32 v2, 0xffff0000, v3, v2
11885 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
11886 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:2046 glc
11887 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11888 ; GFX11-NEXT: buffer_gl1_inv
11889 ; GFX11-NEXT: buffer_gl0_inv
11890 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
11891 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
11892 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
11893 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
11894 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
11895 ; GFX11-NEXT: s_cbranch_execnz .LBB52_1
11896 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
11897 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
11898 ; GFX11-NEXT: s_setpc_b64 s[30:31]
11900 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
11902 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11903 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fe, v0
11904 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
11905 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
11906 ; GFX10-NEXT: s_mov_b32 s4, 0
11907 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
11908 ; GFX10-NEXT: .LBB52_1: ; %atomicrmw.start
11909 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
11910 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11911 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
11912 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v4
11913 ; GFX10-NEXT: v_bfe_u32 v5, v2, 16, 1
11914 ; GFX10-NEXT: v_or_b32_e32 v6, 0x400000, v2
11915 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
11916 ; GFX10-NEXT: v_add3_u32 v5, v5, v2, 0x7fff
11917 ; GFX10-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc_lo
11918 ; GFX10-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11919 ; GFX10-NEXT: v_and_or_b32 v2, 0xffff0000, v3, v2
11920 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
11921 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11922 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11923 ; GFX10-NEXT: buffer_gl1_inv
11924 ; GFX10-NEXT: buffer_gl0_inv
11925 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
11926 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
11927 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
11928 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
11929 ; GFX10-NEXT: s_cbranch_execnz .LBB52_1
11930 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
11931 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
11932 ; GFX10-NEXT: s_setpc_b64 s[30:31]
11934 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
11936 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11937 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2046
11938 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
11939 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
11940 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
11941 ; GFX90A-NEXT: s_mov_b32 s7, 0xffff0000
11942 ; GFX90A-NEXT: .LBB52_1: ; %atomicrmw.start
11943 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
11944 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11945 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
11946 ; GFX90A-NEXT: v_add_f32_e32 v2, v2, v4
11947 ; GFX90A-NEXT: v_bfe_u32 v5, v2, 16, 1
11948 ; GFX90A-NEXT: v_or_b32_e32 v6, 0x400000, v2
11949 ; GFX90A-NEXT: v_add3_u32 v5, v5, v2, s6
11950 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11951 ; GFX90A-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc
11952 ; GFX90A-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11953 ; GFX90A-NEXT: v_and_or_b32 v2, v3, s7, v2
11954 ; GFX90A-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:2046 glc
11955 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11956 ; GFX90A-NEXT: buffer_wbinvl1
11957 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11958 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11959 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
11960 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
11961 ; GFX90A-NEXT: s_cbranch_execnz .LBB52_1
11962 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
11963 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
11964 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
11966 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
11968 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
11969 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2046
11970 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
11971 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
11972 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
11973 ; GFX908-NEXT: s_mov_b32 s7, 0xffff0000
11974 ; GFX908-NEXT: .LBB52_1: ; %atomicrmw.start
11975 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
11976 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11977 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
11978 ; GFX908-NEXT: v_add_f32_e32 v2, v2, v4
11979 ; GFX908-NEXT: v_bfe_u32 v5, v2, 16, 1
11980 ; GFX908-NEXT: v_or_b32_e32 v6, 0x400000, v2
11981 ; GFX908-NEXT: v_add3_u32 v5, v5, v2, s6
11982 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
11983 ; GFX908-NEXT: v_cndmask_b32_e32 v2, v5, v6, vcc
11984 ; GFX908-NEXT: v_lshrrev_b32_e32 v2, 16, v2
11985 ; GFX908-NEXT: v_and_or_b32 v2, v3, s7, v2
11986 ; GFX908-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:2046 glc
11987 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11988 ; GFX908-NEXT: buffer_wbinvl1
11989 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
11990 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
11991 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
11992 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
11993 ; GFX908-NEXT: s_cbranch_execnz .LBB52_1
11994 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
11995 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
11996 ; GFX908-NEXT: s_setpc_b64 s[30:31]
11998 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
12000 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12001 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fe, v0
12002 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
12003 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
12004 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
12005 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
12006 ; GFX8-NEXT: .LBB52_1: ; %atomicrmw.start
12007 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
12008 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12009 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
12010 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v4
12011 ; GFX8-NEXT: v_bfe_u32 v6, v2, 16, 1
12012 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, v6, v2
12013 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x7fff, v6
12014 ; GFX8-NEXT: v_or_b32_e32 v7, 0x400000, v2
12015 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
12016 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
12017 ; GFX8-NEXT: v_cndmask_b32_e32 v2, v6, v7, vcc
12018 ; GFX8-NEXT: v_or_b32_sdwa v2, v5, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12019 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12020 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12021 ; GFX8-NEXT: buffer_wbinvl1
12022 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12023 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12024 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
12025 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
12026 ; GFX8-NEXT: s_cbranch_execnz .LBB52_1
12027 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
12028 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
12029 ; GFX8-NEXT: s_setpc_b64 s[30:31]
12031 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_bf16__offset12b__align4_pos__amdgpu_no_fine_grained_memory:
12033 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12034 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fe, v0
12035 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
12036 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
12037 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
12038 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
12039 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v2
12040 ; GFX7-NEXT: .LBB52_1: ; %atomicrmw.start
12041 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
12042 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12043 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v3
12044 ; GFX7-NEXT: v_add_f32_e32 v2, v2, v4
12045 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v3
12046 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
12047 ; GFX7-NEXT: v_or_b32_e32 v2, v5, v2
12048 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12049 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12050 ; GFX7-NEXT: buffer_wbinvl1
12051 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12052 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12053 ; GFX7-NEXT: v_mov_b32_e32 v3, v2
12054 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
12055 ; GFX7-NEXT: s_cbranch_execnz .LBB52_1
12056 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
12057 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
12058 ; GFX7-NEXT: s_setpc_b64 s[30:31]
12059 %gep = getelementptr bfloat, ptr %ptr, i64 1023
12060 %unused = atomicrmw fadd ptr %gep, bfloat %val syncscope("agent") seq_cst, align 4, !amdgpu.no.fine.grained.memory !0
12064 define void @flat_agent_atomic_fadd_noret_bf16__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
12065 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_bf16__amdgpu_no_fine_grained_memory:
12067 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12068 ; GFX12-NEXT: s_wait_expcnt 0x0
12069 ; GFX12-NEXT: s_wait_samplecnt 0x0
12070 ; GFX12-NEXT: s_wait_bvhcnt 0x0
12071 ; GFX12-NEXT: s_wait_kmcnt 0x0
12072 ; GFX12-NEXT: v_dual_mov_b32 v3, v0 :: v_dual_lshlrev_b32 v2, 16, v2
12073 ; GFX12-NEXT: s_mov_b32 s0, 0
12074 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
12075 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
12076 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
12077 ; GFX12-NEXT: flat_load_b32 v4, v[0:1]
12078 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 3, v3
12079 ; GFX12-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
12080 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
12081 ; GFX12-NEXT: v_not_b32_e32 v6, v3
12082 ; GFX12-NEXT: .LBB53_1: ; %atomicrmw.start
12083 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
12084 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12085 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, v5, v4
12086 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12087 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 16, v3
12088 ; GFX12-NEXT: v_add_f32_e32 v3, v3, v2
12089 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
12090 ; GFX12-NEXT: v_bfe_u32 v7, v3, 16, 1
12091 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v3
12092 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
12093 ; GFX12-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
12094 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12095 ; GFX12-NEXT: v_cndmask_b32_e32 v3, v7, v8, vcc_lo
12096 ; GFX12-NEXT: v_lshrrev_b32_e32 v3, 16, v3
12097 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12098 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, v5, v3
12099 ; GFX12-NEXT: v_and_or_b32 v3, v4, v6, v3
12100 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
12101 ; GFX12-NEXT: s_wait_storecnt 0x0
12102 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] th:TH_ATOMIC_RETURN scope:SCOPE_DEV
12103 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12104 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
12105 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
12106 ; GFX12-NEXT: v_mov_b32_e32 v4, v3
12107 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
12108 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12109 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12110 ; GFX12-NEXT: s_cbranch_execnz .LBB53_1
12111 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
12112 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
12113 ; GFX12-NEXT: s_setpc_b64 s[30:31]
12115 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_bf16__amdgpu_no_fine_grained_memory:
12117 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12118 ; GFX940-NEXT: v_mov_b32_e32 v3, v0
12119 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v3
12120 ; GFX940-NEXT: flat_load_dword v5, v[0:1]
12121 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v3
12122 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12123 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
12124 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
12125 ; GFX940-NEXT: v_not_b32_e32 v6, v4
12126 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
12127 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12128 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
12129 ; GFX940-NEXT: .LBB53_1: ; %atomicrmw.start
12130 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
12131 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12132 ; GFX940-NEXT: v_lshrrev_b32_sdwa v4, v3, v5 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12133 ; GFX940-NEXT: s_nop 0
12134 ; GFX940-NEXT: v_add_f32_e32 v4, v4, v2
12135 ; GFX940-NEXT: v_bfe_u32 v7, v4, 16, 1
12136 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v4
12137 ; GFX940-NEXT: v_add3_u32 v7, v7, v4, s2
12138 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
12139 ; GFX940-NEXT: s_nop 1
12140 ; GFX940-NEXT: v_cndmask_b32_e32 v4, v7, v8, vcc
12141 ; GFX940-NEXT: v_lshlrev_b32_sdwa v4, v3, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12142 ; GFX940-NEXT: v_and_or_b32 v4, v5, v6, v4
12143 ; GFX940-NEXT: buffer_wbl2 sc1
12144 ; GFX940-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] sc0
12145 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12146 ; GFX940-NEXT: buffer_inv sc1
12147 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
12148 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
12149 ; GFX940-NEXT: v_mov_b32_e32 v5, v4
12150 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
12151 ; GFX940-NEXT: s_cbranch_execnz .LBB53_1
12152 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
12153 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
12154 ; GFX940-NEXT: s_setpc_b64 s[30:31]
12156 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_bf16__amdgpu_no_fine_grained_memory:
12158 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12159 ; GFX11-NEXT: v_dual_mov_b32 v3, v0 :: v_dual_lshlrev_b32 v2, 16, v2
12160 ; GFX11-NEXT: s_mov_b32 s0, 0
12161 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
12162 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
12163 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
12164 ; GFX11-NEXT: flat_load_b32 v4, v[0:1]
12165 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 3, v3
12166 ; GFX11-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
12167 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
12168 ; GFX11-NEXT: v_not_b32_e32 v6, v3
12169 ; GFX11-NEXT: .p2align 6
12170 ; GFX11-NEXT: .LBB53_1: ; %atomicrmw.start
12171 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
12172 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12173 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, v5, v4
12174 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12175 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v3
12176 ; GFX11-NEXT: v_add_f32_e32 v3, v3, v2
12177 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
12178 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
12179 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v3
12180 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
12181 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
12182 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12183 ; GFX11-NEXT: v_cndmask_b32_e32 v3, v7, v8, vcc_lo
12184 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v3
12185 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12186 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, v5, v3
12187 ; GFX11-NEXT: v_and_or_b32 v3, v4, v6, v3
12188 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
12189 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
12190 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12191 ; GFX11-NEXT: buffer_gl1_inv
12192 ; GFX11-NEXT: buffer_gl0_inv
12193 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
12194 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
12195 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
12196 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12197 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12198 ; GFX11-NEXT: s_cbranch_execnz .LBB53_1
12199 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
12200 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
12201 ; GFX11-NEXT: s_setpc_b64 s[30:31]
12203 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_bf16__amdgpu_no_fine_grained_memory:
12205 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12206 ; GFX10-NEXT: v_mov_b32_e32 v3, v0
12207 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12208 ; GFX10-NEXT: s_mov_b32 s4, 0
12209 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
12210 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
12211 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
12212 ; GFX10-NEXT: v_lshlrev_b32_e32 v5, 3, v3
12213 ; GFX10-NEXT: v_lshlrev_b32_e64 v3, v5, 0xffff
12214 ; GFX10-NEXT: v_not_b32_e32 v6, v3
12215 ; GFX10-NEXT: .LBB53_1: ; %atomicrmw.start
12216 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
12217 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12218 ; GFX10-NEXT: v_lshrrev_b32_sdwa v3, v5, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12219 ; GFX10-NEXT: v_add_f32_e32 v3, v3, v2
12220 ; GFX10-NEXT: v_bfe_u32 v7, v3, 16, 1
12221 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v3
12222 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v3, v3
12223 ; GFX10-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
12224 ; GFX10-NEXT: v_cndmask_b32_e32 v3, v7, v8, vcc_lo
12225 ; GFX10-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12226 ; GFX10-NEXT: v_and_or_b32 v3, v4, v6, v3
12227 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
12228 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
12229 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12230 ; GFX10-NEXT: buffer_gl1_inv
12231 ; GFX10-NEXT: buffer_gl0_inv
12232 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
12233 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
12234 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
12235 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
12236 ; GFX10-NEXT: s_cbranch_execnz .LBB53_1
12237 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
12238 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
12239 ; GFX10-NEXT: s_setpc_b64 s[30:31]
12241 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_bf16__amdgpu_no_fine_grained_memory:
12243 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12244 ; GFX90A-NEXT: v_mov_b32_e32 v3, v0
12245 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
12246 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
12247 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
12248 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12249 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
12250 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
12251 ; GFX90A-NEXT: v_not_b32_e32 v6, v4
12252 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
12253 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12254 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
12255 ; GFX90A-NEXT: .LBB53_1: ; %atomicrmw.start
12256 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
12257 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12258 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v4, v3, v5 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12259 ; GFX90A-NEXT: v_add_f32_e32 v4, v4, v2
12260 ; GFX90A-NEXT: v_bfe_u32 v7, v4, 16, 1
12261 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v4
12262 ; GFX90A-NEXT: v_add3_u32 v7, v7, v4, s6
12263 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v4, v4
12264 ; GFX90A-NEXT: v_cndmask_b32_e32 v4, v7, v8, vcc
12265 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v4, v3, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12266 ; GFX90A-NEXT: v_and_or_b32 v4, v5, v6, v4
12267 ; GFX90A-NEXT: flat_atomic_cmpswap v4, v[0:1], v[4:5] glc
12268 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12269 ; GFX90A-NEXT: buffer_wbinvl1
12270 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v4, v5
12271 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12272 ; GFX90A-NEXT: v_mov_b32_e32 v5, v4
12273 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
12274 ; GFX90A-NEXT: s_cbranch_execnz .LBB53_1
12275 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
12276 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
12277 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
12279 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_bf16__amdgpu_no_fine_grained_memory:
12281 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12282 ; GFX908-NEXT: v_mov_b32_e32 v3, v0
12283 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
12284 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
12285 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
12286 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, 3, v3
12287 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
12288 ; GFX908-NEXT: v_lshlrev_b32_e64 v3, v5, s4
12289 ; GFX908-NEXT: v_not_b32_e32 v6, v3
12290 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
12291 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12292 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
12293 ; GFX908-NEXT: .LBB53_1: ; %atomicrmw.start
12294 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
12295 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12296 ; GFX908-NEXT: v_lshrrev_b32_sdwa v3, v5, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12297 ; GFX908-NEXT: v_add_f32_e32 v3, v3, v2
12298 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
12299 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
12300 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s6
12301 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
12302 ; GFX908-NEXT: v_cndmask_b32_e32 v3, v7, v8, vcc
12303 ; GFX908-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12304 ; GFX908-NEXT: v_and_or_b32 v3, v4, v6, v3
12305 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
12306 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12307 ; GFX908-NEXT: buffer_wbinvl1
12308 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
12309 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12310 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
12311 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
12312 ; GFX908-NEXT: s_cbranch_execnz .LBB53_1
12313 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
12314 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
12315 ; GFX908-NEXT: s_setpc_b64 s[30:31]
12317 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_bf16__amdgpu_no_fine_grained_memory:
12319 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12320 ; GFX8-NEXT: v_mov_b32_e32 v3, v0
12321 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
12322 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
12323 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
12324 ; GFX8-NEXT: v_lshlrev_b32_e32 v5, 3, v3
12325 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
12326 ; GFX8-NEXT: v_lshlrev_b32_e64 v3, v5, s4
12327 ; GFX8-NEXT: v_not_b32_e32 v6, v3
12328 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
12329 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12330 ; GFX8-NEXT: .LBB53_1: ; %atomicrmw.start
12331 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
12332 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12333 ; GFX8-NEXT: v_lshrrev_b32_sdwa v3, v5, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12334 ; GFX8-NEXT: v_add_f32_e32 v3, v3, v2
12335 ; GFX8-NEXT: v_bfe_u32 v8, v3, 16, 1
12336 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v3
12337 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
12338 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v3
12339 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
12340 ; GFX8-NEXT: v_cndmask_b32_e32 v3, v8, v9, vcc
12341 ; GFX8-NEXT: v_and_b32_e32 v7, v4, v6
12342 ; GFX8-NEXT: v_lshlrev_b32_sdwa v3, v5, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12343 ; GFX8-NEXT: v_or_b32_e32 v3, v7, v3
12344 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
12345 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12346 ; GFX8-NEXT: buffer_wbinvl1
12347 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
12348 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12349 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
12350 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
12351 ; GFX8-NEXT: s_cbranch_execnz .LBB53_1
12352 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
12353 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
12354 ; GFX8-NEXT: s_setpc_b64 s[30:31]
12356 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_bf16__amdgpu_no_fine_grained_memory:
12358 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12359 ; GFX7-NEXT: v_mov_b32_e32 v3, v0
12360 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
12361 ; GFX7-NEXT: flat_load_dword v4, v[0:1]
12362 ; GFX7-NEXT: v_and_b32_e32 v3, 3, v3
12363 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 3, v3
12364 ; GFX7-NEXT: v_lshl_b32_e32 v3, 0xffff, v5
12365 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
12366 ; GFX7-NEXT: v_not_b32_e32 v6, v3
12367 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
12368 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
12369 ; GFX7-NEXT: .LBB53_1: ; %atomicrmw.start
12370 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
12371 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12372 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, v5, v4
12373 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
12374 ; GFX7-NEXT: v_add_f32_e32 v3, v3, v2
12375 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v3
12376 ; GFX7-NEXT: v_and_b32_e32 v7, v4, v6
12377 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, v5, v3
12378 ; GFX7-NEXT: v_or_b32_e32 v3, v7, v3
12379 ; GFX7-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
12380 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12381 ; GFX7-NEXT: buffer_wbinvl1
12382 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
12383 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12384 ; GFX7-NEXT: v_mov_b32_e32 v4, v3
12385 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
12386 ; GFX7-NEXT: s_cbranch_execnz .LBB53_1
12387 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
12388 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
12389 ; GFX7-NEXT: s_setpc_b64 s[30:31]
12390 %unused = atomicrmw fadd ptr %ptr, bfloat %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
12394 define bfloat @flat_system_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
12395 ; GFX12-LABEL: flat_system_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12397 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12398 ; GFX12-NEXT: s_wait_expcnt 0x0
12399 ; GFX12-NEXT: s_wait_samplecnt 0x0
12400 ; GFX12-NEXT: s_wait_bvhcnt 0x0
12401 ; GFX12-NEXT: s_wait_kmcnt 0x0
12402 ; GFX12-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
12403 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
12404 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12405 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
12406 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v3
12407 ; GFX12-NEXT: v_and_b32_e32 v3, 3, v3
12408 ; GFX12-NEXT: s_mov_b32 s0, 0
12409 ; GFX12-NEXT: flat_load_b32 v5, v[0:1]
12410 ; GFX12-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12411 ; GFX12-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
12412 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
12413 ; GFX12-NEXT: v_not_b32_e32 v4, v4
12414 ; GFX12-NEXT: .LBB54_1: ; %atomicrmw.start
12415 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
12416 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12417 ; GFX12-NEXT: v_mov_b32_e32 v6, v5
12418 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12419 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, v3, v6
12420 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, 16, v5
12421 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12422 ; GFX12-NEXT: v_add_f32_e32 v5, v5, v2
12423 ; GFX12-NEXT: v_bfe_u32 v7, v5, 16, 1
12424 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v5
12425 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
12426 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
12427 ; GFX12-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
12428 ; GFX12-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
12429 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12430 ; GFX12-NEXT: v_lshrrev_b32_e32 v5, 16, v5
12431 ; GFX12-NEXT: v_lshlrev_b32_e32 v5, v3, v5
12432 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
12433 ; GFX12-NEXT: v_and_or_b32 v5, v6, v4, v5
12434 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
12435 ; GFX12-NEXT: s_wait_storecnt 0x0
12436 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
12437 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12438 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
12439 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
12440 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
12441 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12442 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12443 ; GFX12-NEXT: s_cbranch_execnz .LBB54_1
12444 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
12445 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
12446 ; GFX12-NEXT: v_lshrrev_b32_e32 v0, v3, v5
12447 ; GFX12-NEXT: s_setpc_b64 s[30:31]
12449 ; GFX940-LABEL: flat_system_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12451 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12452 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
12453 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
12454 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
12455 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
12456 ; GFX940-NEXT: flat_load_dword v5, v[0:1]
12457 ; GFX940-NEXT: v_and_b32_e32 v3, 3, v4
12458 ; GFX940-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12459 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
12460 ; GFX940-NEXT: v_lshlrev_b32_e64 v4, v3, s0
12461 ; GFX940-NEXT: v_not_b32_e32 v4, v4
12462 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
12463 ; GFX940-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12464 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
12465 ; GFX940-NEXT: .LBB54_1: ; %atomicrmw.start
12466 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
12467 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12468 ; GFX940-NEXT: v_mov_b32_e32 v7, v5
12469 ; GFX940-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12470 ; GFX940-NEXT: s_nop 0
12471 ; GFX940-NEXT: v_add_f32_e32 v5, v5, v2
12472 ; GFX940-NEXT: v_bfe_u32 v6, v5, 16, 1
12473 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v5
12474 ; GFX940-NEXT: v_add3_u32 v6, v6, v5, s2
12475 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
12476 ; GFX940-NEXT: s_nop 1
12477 ; GFX940-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
12478 ; GFX940-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12479 ; GFX940-NEXT: v_and_or_b32 v6, v7, v4, v5
12480 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
12481 ; GFX940-NEXT: flat_atomic_cmpswap v5, v[0:1], v[6:7] sc0 sc1
12482 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12483 ; GFX940-NEXT: buffer_inv sc0 sc1
12484 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
12485 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
12486 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
12487 ; GFX940-NEXT: s_cbranch_execnz .LBB54_1
12488 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
12489 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
12490 ; GFX940-NEXT: v_lshrrev_b32_e32 v0, v3, v5
12491 ; GFX940-NEXT: s_setpc_b64 s[30:31]
12493 ; GFX11-LABEL: flat_system_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12495 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12496 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
12497 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
12498 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12499 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
12500 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v3
12501 ; GFX11-NEXT: v_and_b32_e32 v3, 3, v3
12502 ; GFX11-NEXT: s_mov_b32 s0, 0
12503 ; GFX11-NEXT: flat_load_b32 v5, v[0:1]
12504 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12505 ; GFX11-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
12506 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
12507 ; GFX11-NEXT: v_not_b32_e32 v4, v4
12508 ; GFX11-NEXT: .p2align 6
12509 ; GFX11-NEXT: .LBB54_1: ; %atomicrmw.start
12510 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
12511 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12512 ; GFX11-NEXT: v_mov_b32_e32 v6, v5
12513 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12514 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, v3, v6
12515 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, 16, v5
12516 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12517 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
12518 ; GFX11-NEXT: v_bfe_u32 v7, v5, 16, 1
12519 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v5
12520 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
12521 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
12522 ; GFX11-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
12523 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
12524 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12525 ; GFX11-NEXT: v_lshrrev_b32_e32 v5, 16, v5
12526 ; GFX11-NEXT: v_lshlrev_b32_e32 v5, v3, v5
12527 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
12528 ; GFX11-NEXT: v_and_or_b32 v5, v6, v4, v5
12529 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
12530 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v5, v[0:1], v[5:6] glc
12531 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12532 ; GFX11-NEXT: buffer_gl1_inv
12533 ; GFX11-NEXT: buffer_gl0_inv
12534 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
12535 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
12536 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12537 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12538 ; GFX11-NEXT: s_cbranch_execnz .LBB54_1
12539 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
12540 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
12541 ; GFX11-NEXT: v_lshrrev_b32_e32 v0, v3, v5
12542 ; GFX11-NEXT: s_setpc_b64 s[30:31]
12544 ; GFX10-LABEL: flat_system_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12546 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12547 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fe, v0
12548 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
12549 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12550 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v3
12551 ; GFX10-NEXT: v_and_b32_e32 v3, 3, v3
12552 ; GFX10-NEXT: s_mov_b32 s4, 0
12553 ; GFX10-NEXT: flat_load_dword v5, v[0:1]
12554 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12555 ; GFX10-NEXT: v_lshlrev_b32_e64 v4, v3, 0xffff
12556 ; GFX10-NEXT: v_not_b32_e32 v4, v4
12557 ; GFX10-NEXT: .LBB54_1: ; %atomicrmw.start
12558 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
12559 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12560 ; GFX10-NEXT: v_mov_b32_e32 v6, v5
12561 ; GFX10-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12562 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
12563 ; GFX10-NEXT: v_bfe_u32 v7, v5, 16, 1
12564 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v5
12565 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
12566 ; GFX10-NEXT: v_add3_u32 v7, v7, v5, 0x7fff
12567 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc_lo
12568 ; GFX10-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12569 ; GFX10-NEXT: v_and_or_b32 v5, v6, v4, v5
12570 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
12571 ; GFX10-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
12572 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12573 ; GFX10-NEXT: buffer_gl1_inv
12574 ; GFX10-NEXT: buffer_gl0_inv
12575 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v5, v6
12576 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
12577 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
12578 ; GFX10-NEXT: s_cbranch_execnz .LBB54_1
12579 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
12580 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
12581 ; GFX10-NEXT: v_lshrrev_b32_e32 v0, v3, v5
12582 ; GFX10-NEXT: s_setpc_b64 s[30:31]
12584 ; GFX90A-LABEL: flat_system_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12586 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12587 ; GFX90A-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
12588 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
12589 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v3
12590 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
12591 ; GFX90A-NEXT: v_and_b32_e32 v3, 3, v3
12592 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12593 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
12594 ; GFX90A-NEXT: v_lshlrev_b32_e64 v4, v3, s4
12595 ; GFX90A-NEXT: v_not_b32_e32 v4, v4
12596 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
12597 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12598 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
12599 ; GFX90A-NEXT: .LBB54_1: ; %atomicrmw.start
12600 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
12601 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12602 ; GFX90A-NEXT: v_mov_b32_e32 v7, v5
12603 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v5, v3, v7 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12604 ; GFX90A-NEXT: v_add_f32_e32 v5, v5, v2
12605 ; GFX90A-NEXT: v_bfe_u32 v6, v5, 16, 1
12606 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v5
12607 ; GFX90A-NEXT: v_add3_u32 v6, v6, v5, s6
12608 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
12609 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v6, v8, vcc
12610 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12611 ; GFX90A-NEXT: v_and_or_b32 v6, v7, v4, v5
12612 ; GFX90A-NEXT: buffer_wbl2
12613 ; GFX90A-NEXT: flat_atomic_cmpswap v5, v[0:1], v[6:7] glc
12614 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12615 ; GFX90A-NEXT: buffer_invl2
12616 ; GFX90A-NEXT: buffer_wbinvl1
12617 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v5, v7
12618 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12619 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
12620 ; GFX90A-NEXT: s_cbranch_execnz .LBB54_1
12621 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
12622 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
12623 ; GFX90A-NEXT: v_lshrrev_b32_e32 v0, v3, v5
12624 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
12626 ; GFX908-LABEL: flat_system_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12628 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12629 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0x7fe, v0
12630 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
12631 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v3
12632 ; GFX908-NEXT: flat_load_dword v5, v[0:1]
12633 ; GFX908-NEXT: v_and_b32_e32 v3, 3, v3
12634 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12635 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
12636 ; GFX908-NEXT: v_lshlrev_b32_e64 v4, v3, s4
12637 ; GFX908-NEXT: v_not_b32_e32 v4, v4
12638 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
12639 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12640 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
12641 ; GFX908-NEXT: .LBB54_1: ; %atomicrmw.start
12642 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
12643 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12644 ; GFX908-NEXT: v_mov_b32_e32 v6, v5
12645 ; GFX908-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12646 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
12647 ; GFX908-NEXT: v_bfe_u32 v7, v5, 16, 1
12648 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v5
12649 ; GFX908-NEXT: v_add3_u32 v7, v7, v5, s6
12650 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
12651 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v7, v8, vcc
12652 ; GFX908-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12653 ; GFX908-NEXT: v_and_or_b32 v5, v6, v4, v5
12654 ; GFX908-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
12655 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12656 ; GFX908-NEXT: buffer_wbinvl1
12657 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
12658 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12659 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
12660 ; GFX908-NEXT: s_cbranch_execnz .LBB54_1
12661 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
12662 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
12663 ; GFX908-NEXT: v_lshrrev_b32_e32 v0, v3, v5
12664 ; GFX908-NEXT: s_setpc_b64 s[30:31]
12666 ; GFX8-LABEL: flat_system_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12668 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12669 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fe, v0
12670 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
12671 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v3
12672 ; GFX8-NEXT: flat_load_dword v5, v[0:1]
12673 ; GFX8-NEXT: v_and_b32_e32 v3, 3, v3
12674 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12675 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
12676 ; GFX8-NEXT: v_lshlrev_b32_e64 v4, v3, s4
12677 ; GFX8-NEXT: v_not_b32_e32 v4, v4
12678 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
12679 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12680 ; GFX8-NEXT: .LBB54_1: ; %atomicrmw.start
12681 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
12682 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12683 ; GFX8-NEXT: v_mov_b32_e32 v6, v5
12684 ; GFX8-NEXT: v_lshrrev_b32_sdwa v5, v3, v6 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12685 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
12686 ; GFX8-NEXT: v_bfe_u32 v8, v5, 16, 1
12687 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v5
12688 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
12689 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v5
12690 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
12691 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v8, v9, vcc
12692 ; GFX8-NEXT: v_and_b32_e32 v7, v6, v4
12693 ; GFX8-NEXT: v_lshlrev_b32_sdwa v5, v3, v5 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12694 ; GFX8-NEXT: v_or_b32_e32 v5, v7, v5
12695 ; GFX8-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
12696 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12697 ; GFX8-NEXT: buffer_wbinvl1
12698 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
12699 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12700 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
12701 ; GFX8-NEXT: s_cbranch_execnz .LBB54_1
12702 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
12703 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
12704 ; GFX8-NEXT: v_lshrrev_b32_e32 v0, v3, v5
12705 ; GFX8-NEXT: s_setpc_b64 s[30:31]
12707 ; GFX7-LABEL: flat_system_atomic_fadd_ret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12709 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12710 ; GFX7-NEXT: v_add_i32_e32 v3, vcc, 0x7fe, v0
12711 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
12712 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v3
12713 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
12714 ; GFX7-NEXT: v_and_b32_e32 v3, 3, v3
12715 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 3, v3
12716 ; GFX7-NEXT: v_lshl_b32_e32 v4, 0xffff, v3
12717 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
12718 ; GFX7-NEXT: v_not_b32_e32 v4, v4
12719 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
12720 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
12721 ; GFX7-NEXT: .LBB54_1: ; %atomicrmw.start
12722 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
12723 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12724 ; GFX7-NEXT: v_mov_b32_e32 v6, v5
12725 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, v3, v6
12726 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
12727 ; GFX7-NEXT: v_add_f32_e32 v5, v5, v2
12728 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v5
12729 ; GFX7-NEXT: v_and_b32_e32 v7, v6, v4
12730 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, v3, v5
12731 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v5
12732 ; GFX7-NEXT: flat_atomic_cmpswap v5, v[0:1], v[5:6] glc
12733 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12734 ; GFX7-NEXT: buffer_wbinvl1
12735 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v5, v6
12736 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12737 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
12738 ; GFX7-NEXT: s_cbranch_execnz .LBB54_1
12739 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
12740 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
12741 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, v3, v5
12742 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
12743 ; GFX7-NEXT: s_setpc_b64 s[30:31]
12744 %gep = getelementptr bfloat, ptr %ptr, i64 1023
12745 %result = atomicrmw fadd ptr %gep, bfloat %val seq_cst, !amdgpu.no.fine.grained.memory !0
12749 define void @flat_system_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, bfloat %val) #0 {
12750 ; GFX12-LABEL: flat_system_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12752 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12753 ; GFX12-NEXT: s_wait_expcnt 0x0
12754 ; GFX12-NEXT: s_wait_samplecnt 0x0
12755 ; GFX12-NEXT: s_wait_bvhcnt 0x0
12756 ; GFX12-NEXT: s_wait_kmcnt 0x0
12757 ; GFX12-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
12758 ; GFX12-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
12759 ; GFX12-NEXT: v_lshlrev_b32_e32 v6, 16, v2
12760 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
12761 ; GFX12-NEXT: v_and_b32_e32 v0, -4, v4
12762 ; GFX12-NEXT: v_and_b32_e32 v4, 3, v4
12763 ; GFX12-NEXT: s_mov_b32 s0, 0
12764 ; GFX12-NEXT: flat_load_b32 v3, v[0:1]
12765 ; GFX12-NEXT: v_lshlrev_b32_e32 v4, 3, v4
12766 ; GFX12-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
12767 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1)
12768 ; GFX12-NEXT: v_not_b32_e32 v5, v5
12769 ; GFX12-NEXT: .LBB55_1: ; %atomicrmw.start
12770 ; GFX12-NEXT: ; =>This Inner Loop Header: Depth=1
12771 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12772 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, v4, v3
12773 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12774 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12775 ; GFX12-NEXT: v_add_f32_e32 v2, v2, v6
12776 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
12777 ; GFX12-NEXT: v_bfe_u32 v7, v2, 16, 1
12778 ; GFX12-NEXT: v_or_b32_e32 v8, 0x400000, v2
12779 ; GFX12-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
12780 ; GFX12-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
12781 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12782 ; GFX12-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
12783 ; GFX12-NEXT: v_lshrrev_b32_e32 v2, 16, v2
12784 ; GFX12-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12785 ; GFX12-NEXT: v_lshlrev_b32_e32 v2, v4, v2
12786 ; GFX12-NEXT: v_and_or_b32 v2, v3, v5, v2
12787 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
12788 ; GFX12-NEXT: s_wait_storecnt 0x0
12789 ; GFX12-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] th:TH_ATOMIC_RETURN scope:SCOPE_SYS
12790 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
12791 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
12792 ; GFX12-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12793 ; GFX12-NEXT: v_mov_b32_e32 v3, v2
12794 ; GFX12-NEXT: s_or_b32 s0, vcc_lo, s0
12795 ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12796 ; GFX12-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12797 ; GFX12-NEXT: s_cbranch_execnz .LBB55_1
12798 ; GFX12-NEXT: ; %bb.2: ; %atomicrmw.end
12799 ; GFX12-NEXT: s_or_b32 exec_lo, exec_lo, s0
12800 ; GFX12-NEXT: s_setpc_b64 s[30:31]
12802 ; GFX940-LABEL: flat_system_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12804 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12805 ; GFX940-NEXT: s_mov_b64 s[0:1], 0x7fe
12806 ; GFX940-NEXT: v_lshl_add_u64 v[4:5], v[0:1], 0, s[0:1]
12807 ; GFX940-NEXT: v_and_b32_e32 v0, -4, v4
12808 ; GFX940-NEXT: v_mov_b32_e32 v1, v5
12809 ; GFX940-NEXT: flat_load_dword v3, v[0:1]
12810 ; GFX940-NEXT: v_and_b32_e32 v4, 3, v4
12811 ; GFX940-NEXT: v_lshlrev_b32_e32 v4, 3, v4
12812 ; GFX940-NEXT: s_mov_b32 s0, 0xffff
12813 ; GFX940-NEXT: v_lshlrev_b32_e64 v5, v4, s0
12814 ; GFX940-NEXT: v_not_b32_e32 v5, v5
12815 ; GFX940-NEXT: s_mov_b64 s[0:1], 0
12816 ; GFX940-NEXT: v_lshlrev_b32_e32 v6, 16, v2
12817 ; GFX940-NEXT: s_movk_i32 s2, 0x7fff
12818 ; GFX940-NEXT: .LBB55_1: ; %atomicrmw.start
12819 ; GFX940-NEXT: ; =>This Inner Loop Header: Depth=1
12820 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12821 ; GFX940-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12822 ; GFX940-NEXT: s_nop 0
12823 ; GFX940-NEXT: v_add_f32_e32 v2, v2, v6
12824 ; GFX940-NEXT: v_bfe_u32 v7, v2, 16, 1
12825 ; GFX940-NEXT: v_or_b32_e32 v8, 0x400000, v2
12826 ; GFX940-NEXT: v_add3_u32 v7, v7, v2, s2
12827 ; GFX940-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
12828 ; GFX940-NEXT: s_nop 1
12829 ; GFX940-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
12830 ; GFX940-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12831 ; GFX940-NEXT: v_and_or_b32 v2, v3, v5, v2
12832 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
12833 ; GFX940-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] sc0 sc1
12834 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12835 ; GFX940-NEXT: buffer_inv sc0 sc1
12836 ; GFX940-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12837 ; GFX940-NEXT: s_or_b64 s[0:1], vcc, s[0:1]
12838 ; GFX940-NEXT: v_mov_b32_e32 v3, v2
12839 ; GFX940-NEXT: s_andn2_b64 exec, exec, s[0:1]
12840 ; GFX940-NEXT: s_cbranch_execnz .LBB55_1
12841 ; GFX940-NEXT: ; %bb.2: ; %atomicrmw.end
12842 ; GFX940-NEXT: s_or_b64 exec, exec, s[0:1]
12843 ; GFX940-NEXT: s_setpc_b64 s[30:31]
12845 ; GFX11-LABEL: flat_system_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12847 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12848 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
12849 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
12850 ; GFX11-NEXT: v_lshlrev_b32_e32 v6, 16, v2
12851 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_1)
12852 ; GFX11-NEXT: v_and_b32_e32 v0, -4, v4
12853 ; GFX11-NEXT: v_and_b32_e32 v4, 3, v4
12854 ; GFX11-NEXT: s_mov_b32 s0, 0
12855 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
12856 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 3, v4
12857 ; GFX11-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
12858 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
12859 ; GFX11-NEXT: v_not_b32_e32 v5, v5
12860 ; GFX11-NEXT: .p2align 6
12861 ; GFX11-NEXT: .LBB55_1: ; %atomicrmw.start
12862 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
12863 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12864 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, v4, v3
12865 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12866 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v2
12867 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v6
12868 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_3)
12869 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
12870 ; GFX11-NEXT: v_or_b32_e32 v8, 0x400000, v2
12871 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
12872 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
12873 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12874 ; GFX11-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
12875 ; GFX11-NEXT: v_lshrrev_b32_e32 v2, 16, v2
12876 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
12877 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, v4, v2
12878 ; GFX11-NEXT: v_and_or_b32 v2, v3, v5, v2
12879 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
12880 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] glc
12881 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12882 ; GFX11-NEXT: buffer_gl1_inv
12883 ; GFX11-NEXT: buffer_gl0_inv
12884 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12885 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
12886 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
12887 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
12888 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
12889 ; GFX11-NEXT: s_cbranch_execnz .LBB55_1
12890 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
12891 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
12892 ; GFX11-NEXT: s_setpc_b64 s[30:31]
12894 ; GFX10-LABEL: flat_system_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12896 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12897 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x7fe, v0
12898 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
12899 ; GFX10-NEXT: v_lshlrev_b32_e32 v6, 16, v2
12900 ; GFX10-NEXT: v_and_b32_e32 v0, -4, v4
12901 ; GFX10-NEXT: v_and_b32_e32 v4, 3, v4
12902 ; GFX10-NEXT: s_mov_b32 s4, 0
12903 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
12904 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 3, v4
12905 ; GFX10-NEXT: v_lshlrev_b32_e64 v5, v4, 0xffff
12906 ; GFX10-NEXT: v_not_b32_e32 v5, v5
12907 ; GFX10-NEXT: .LBB55_1: ; %atomicrmw.start
12908 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
12909 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12910 ; GFX10-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12911 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v6
12912 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
12913 ; GFX10-NEXT: v_or_b32_e32 v8, 0x400000, v2
12914 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v2, v2
12915 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
12916 ; GFX10-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc_lo
12917 ; GFX10-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12918 ; GFX10-NEXT: v_and_or_b32 v2, v3, v5, v2
12919 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
12920 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12921 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12922 ; GFX10-NEXT: buffer_gl1_inv
12923 ; GFX10-NEXT: buffer_gl0_inv
12924 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
12925 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
12926 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
12927 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
12928 ; GFX10-NEXT: s_cbranch_execnz .LBB55_1
12929 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
12930 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
12931 ; GFX10-NEXT: s_setpc_b64 s[30:31]
12933 ; GFX90A-LABEL: flat_system_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12935 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12936 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
12937 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
12938 ; GFX90A-NEXT: v_and_b32_e32 v0, -4, v4
12939 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
12940 ; GFX90A-NEXT: v_and_b32_e32 v4, 3, v4
12941 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 3, v4
12942 ; GFX90A-NEXT: s_mov_b32 s4, 0xffff
12943 ; GFX90A-NEXT: v_lshlrev_b32_e64 v5, v4, s4
12944 ; GFX90A-NEXT: v_not_b32_e32 v5, v5
12945 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
12946 ; GFX90A-NEXT: v_lshlrev_b32_e32 v6, 16, v2
12947 ; GFX90A-NEXT: s_movk_i32 s6, 0x7fff
12948 ; GFX90A-NEXT: .LBB55_1: ; %atomicrmw.start
12949 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
12950 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12951 ; GFX90A-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12952 ; GFX90A-NEXT: v_add_f32_e32 v2, v2, v6
12953 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
12954 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
12955 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s6
12956 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
12957 ; GFX90A-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
12958 ; GFX90A-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
12959 ; GFX90A-NEXT: v_and_or_b32 v2, v3, v5, v2
12960 ; GFX90A-NEXT: buffer_wbl2
12961 ; GFX90A-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12962 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12963 ; GFX90A-NEXT: buffer_invl2
12964 ; GFX90A-NEXT: buffer_wbinvl1
12965 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
12966 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
12967 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
12968 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
12969 ; GFX90A-NEXT: s_cbranch_execnz .LBB55_1
12970 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
12971 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
12972 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
12974 ; GFX908-LABEL: flat_system_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
12976 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12977 ; GFX908-NEXT: v_add_co_u32_e32 v4, vcc, 0x7fe, v0
12978 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
12979 ; GFX908-NEXT: v_and_b32_e32 v0, -4, v4
12980 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
12981 ; GFX908-NEXT: v_and_b32_e32 v4, 3, v4
12982 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 3, v4
12983 ; GFX908-NEXT: s_mov_b32 s4, 0xffff
12984 ; GFX908-NEXT: v_lshlrev_b32_e64 v5, v4, s4
12985 ; GFX908-NEXT: v_not_b32_e32 v5, v5
12986 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
12987 ; GFX908-NEXT: v_lshlrev_b32_e32 v6, 16, v2
12988 ; GFX908-NEXT: s_movk_i32 s6, 0x7fff
12989 ; GFX908-NEXT: .LBB55_1: ; %atomicrmw.start
12990 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
12991 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12992 ; GFX908-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
12993 ; GFX908-NEXT: v_add_f32_e32 v2, v2, v6
12994 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
12995 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
12996 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s6
12997 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
12998 ; GFX908-NEXT: v_cndmask_b32_e32 v2, v7, v8, vcc
12999 ; GFX908-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
13000 ; GFX908-NEXT: v_and_or_b32 v2, v3, v5, v2
13001 ; GFX908-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13002 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13003 ; GFX908-NEXT: buffer_wbinvl1
13004 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
13005 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13006 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
13007 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
13008 ; GFX908-NEXT: s_cbranch_execnz .LBB55_1
13009 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
13010 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
13011 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13013 ; GFX8-LABEL: flat_system_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
13015 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13016 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x7fe, v0
13017 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
13018 ; GFX8-NEXT: v_and_b32_e32 v0, -4, v4
13019 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
13020 ; GFX8-NEXT: v_and_b32_e32 v4, 3, v4
13021 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 3, v4
13022 ; GFX8-NEXT: s_mov_b32 s4, 0xffff
13023 ; GFX8-NEXT: v_lshlrev_b32_e64 v5, v4, s4
13024 ; GFX8-NEXT: v_not_b32_e32 v5, v5
13025 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
13026 ; GFX8-NEXT: v_lshlrev_b32_e32 v6, 16, v2
13027 ; GFX8-NEXT: .LBB55_1: ; %atomicrmw.start
13028 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
13029 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13030 ; GFX8-NEXT: v_lshrrev_b32_sdwa v2, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
13031 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v6
13032 ; GFX8-NEXT: v_bfe_u32 v8, v2, 16, 1
13033 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, v8, v2
13034 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x7fff, v8
13035 ; GFX8-NEXT: v_or_b32_e32 v9, 0x400000, v2
13036 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v2, v2
13037 ; GFX8-NEXT: v_cndmask_b32_e32 v2, v8, v9, vcc
13038 ; GFX8-NEXT: v_and_b32_e32 v7, v3, v5
13039 ; GFX8-NEXT: v_lshlrev_b32_sdwa v2, v4, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:WORD_1
13040 ; GFX8-NEXT: v_or_b32_e32 v2, v7, v2
13041 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13042 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13043 ; GFX8-NEXT: buffer_wbinvl1
13044 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
13045 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13046 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
13047 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
13048 ; GFX8-NEXT: s_cbranch_execnz .LBB55_1
13049 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
13050 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
13051 ; GFX8-NEXT: s_setpc_b64 s[30:31]
13053 ; GFX7-LABEL: flat_system_atomic_fadd_noret_bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
13055 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13056 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fe, v0
13057 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
13058 ; GFX7-NEXT: v_and_b32_e32 v0, -4, v4
13059 ; GFX7-NEXT: flat_load_dword v3, v[0:1]
13060 ; GFX7-NEXT: v_and_b32_e32 v4, 3, v4
13061 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 3, v4
13062 ; GFX7-NEXT: v_lshl_b32_e32 v5, 0xffff, v4
13063 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
13064 ; GFX7-NEXT: v_not_b32_e32 v5, v5
13065 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
13066 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v2
13067 ; GFX7-NEXT: .LBB55_1: ; %atomicrmw.start
13068 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
13069 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13070 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, v4, v3
13071 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v2
13072 ; GFX7-NEXT: v_add_f32_e32 v2, v2, v6
13073 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
13074 ; GFX7-NEXT: v_and_b32_e32 v7, v3, v5
13075 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, v4, v2
13076 ; GFX7-NEXT: v_or_b32_e32 v2, v7, v2
13077 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13078 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13079 ; GFX7-NEXT: buffer_wbinvl1
13080 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
13081 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13082 ; GFX7-NEXT: v_mov_b32_e32 v3, v2
13083 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
13084 ; GFX7-NEXT: s_cbranch_execnz .LBB55_1
13085 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
13086 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
13087 ; GFX7-NEXT: s_setpc_b64 s[30:31]
13088 %gep = getelementptr bfloat, ptr %ptr, i64 1023
13089 %unused = atomicrmw fadd ptr %gep, bfloat %val seq_cst, !amdgpu.no.fine.grained.memory !0
13093 ; --------------------------------------------------------------------
13095 ; --------------------------------------------------------------------
13097 define <2 x half> @flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x half> %val) #0 {
13098 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory:
13100 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13101 ; GFX12-NEXT: s_wait_expcnt 0x0
13102 ; GFX12-NEXT: s_wait_samplecnt 0x0
13103 ; GFX12-NEXT: s_wait_bvhcnt 0x0
13104 ; GFX12-NEXT: s_wait_kmcnt 0x0
13105 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
13106 ; GFX12-NEXT: s_wait_storecnt 0x0
13107 ; GFX12-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
13108 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13109 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
13110 ; GFX12-NEXT: s_setpc_b64 s[30:31]
13112 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory:
13114 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13115 ; GFX940-NEXT: buffer_wbl2 sc1
13116 ; GFX940-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 sc0
13117 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13118 ; GFX940-NEXT: buffer_inv sc1
13119 ; GFX940-NEXT: s_setpc_b64 s[30:31]
13121 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory:
13123 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13124 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
13125 ; GFX11-NEXT: s_mov_b32 s0, 0
13126 ; GFX11-NEXT: .LBB56_1: ; %atomicrmw.start
13127 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
13128 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13129 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
13130 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
13131 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
13132 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
13133 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
13134 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13135 ; GFX11-NEXT: buffer_gl1_inv
13136 ; GFX11-NEXT: buffer_gl0_inv
13137 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
13138 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
13139 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13140 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
13141 ; GFX11-NEXT: s_cbranch_execnz .LBB56_1
13142 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
13143 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
13144 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
13145 ; GFX11-NEXT: s_setpc_b64 s[30:31]
13147 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory:
13149 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13150 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
13151 ; GFX10-NEXT: s_mov_b32 s4, 0
13152 ; GFX10-NEXT: .LBB56_1: ; %atomicrmw.start
13153 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
13154 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13155 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
13156 ; GFX10-NEXT: v_pk_add_f16 v3, v4, v2
13157 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
13158 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
13159 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13160 ; GFX10-NEXT: buffer_gl1_inv
13161 ; GFX10-NEXT: buffer_gl0_inv
13162 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
13163 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
13164 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
13165 ; GFX10-NEXT: s_cbranch_execnz .LBB56_1
13166 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
13167 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
13168 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
13169 ; GFX10-NEXT: s_setpc_b64 s[30:31]
13171 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory:
13173 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13174 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
13175 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
13176 ; GFX90A-NEXT: .LBB56_1: ; %atomicrmw.start
13177 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
13178 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13179 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
13180 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
13181 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc
13182 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13183 ; GFX90A-NEXT: buffer_wbinvl1
13184 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
13185 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13186 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
13187 ; GFX90A-NEXT: s_cbranch_execnz .LBB56_1
13188 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
13189 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
13190 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
13191 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
13193 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory:
13195 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13196 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
13197 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
13198 ; GFX908-NEXT: .LBB56_1: ; %atomicrmw.start
13199 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
13200 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13201 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
13202 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
13203 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
13204 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13205 ; GFX908-NEXT: buffer_wbinvl1
13206 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
13207 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13208 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
13209 ; GFX908-NEXT: s_cbranch_execnz .LBB56_1
13210 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
13211 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
13212 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
13213 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13215 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory:
13217 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13218 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
13219 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
13220 ; GFX8-NEXT: .LBB56_1: ; %atomicrmw.start
13221 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
13222 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13223 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
13224 ; GFX8-NEXT: v_add_f16_sdwa v3, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
13225 ; GFX8-NEXT: v_add_f16_e32 v5, v4, v2
13226 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
13227 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
13228 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13229 ; GFX8-NEXT: buffer_wbinvl1
13230 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
13231 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13232 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
13233 ; GFX8-NEXT: s_cbranch_execnz .LBB56_1
13234 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
13235 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
13236 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
13237 ; GFX8-NEXT: s_setpc_b64 s[30:31]
13239 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory:
13241 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13242 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
13243 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
13244 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
13245 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
13246 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v3
13247 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13248 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
13249 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
13250 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
13251 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v6
13252 ; GFX7-NEXT: .LBB56_1: ; %atomicrmw.start
13253 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
13254 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
13255 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
13256 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v3
13257 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v2
13258 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
13259 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v4
13260 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v5
13261 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
13262 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
13263 ; GFX7-NEXT: v_or_b32_e32 v7, v2, v3
13264 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v6
13265 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v2
13266 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[6:7] glc
13267 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13268 ; GFX7-NEXT: buffer_wbinvl1
13269 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v6
13270 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v6
13271 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
13272 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v7
13273 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13274 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
13275 ; GFX7-NEXT: s_cbranch_execnz .LBB56_1
13276 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
13277 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
13278 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
13279 ; GFX7-NEXT: v_mov_b32_e32 v1, v3
13280 ; GFX7-NEXT: s_setpc_b64 s[30:31]
13281 %result = atomicrmw fadd ptr %ptr, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
13282 ret <2 x half> %result
13285 define <2 x half> @flat_agent_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x half> %val) #0 {
13286 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13288 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13289 ; GFX12-NEXT: s_wait_expcnt 0x0
13290 ; GFX12-NEXT: s_wait_samplecnt 0x0
13291 ; GFX12-NEXT: s_wait_bvhcnt 0x0
13292 ; GFX12-NEXT: s_wait_kmcnt 0x0
13293 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
13294 ; GFX12-NEXT: s_wait_storecnt 0x0
13295 ; GFX12-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
13296 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13297 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
13298 ; GFX12-NEXT: s_setpc_b64 s[30:31]
13300 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13302 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13303 ; GFX940-NEXT: buffer_wbl2 sc1
13304 ; GFX940-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 offset:2044 sc0
13305 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13306 ; GFX940-NEXT: buffer_inv sc1
13307 ; GFX940-NEXT: s_setpc_b64 s[30:31]
13309 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13311 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13312 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2044
13313 ; GFX11-NEXT: s_mov_b32 s0, 0
13314 ; GFX11-NEXT: .LBB57_1: ; %atomicrmw.start
13315 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
13316 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13317 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
13318 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
13319 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
13320 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
13321 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
13322 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13323 ; GFX11-NEXT: buffer_gl1_inv
13324 ; GFX11-NEXT: buffer_gl0_inv
13325 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
13326 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
13327 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13328 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
13329 ; GFX11-NEXT: s_cbranch_execnz .LBB57_1
13330 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
13331 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
13332 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
13333 ; GFX11-NEXT: s_setpc_b64 s[30:31]
13335 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13337 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13338 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fc, v0
13339 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
13340 ; GFX10-NEXT: s_mov_b32 s4, 0
13341 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
13342 ; GFX10-NEXT: .LBB57_1: ; %atomicrmw.start
13343 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
13344 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13345 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
13346 ; GFX10-NEXT: v_pk_add_f16 v0, v1, v2
13347 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
13348 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
13349 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13350 ; GFX10-NEXT: buffer_gl1_inv
13351 ; GFX10-NEXT: buffer_gl0_inv
13352 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
13353 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
13354 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
13355 ; GFX10-NEXT: s_cbranch_execnz .LBB57_1
13356 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
13357 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
13358 ; GFX10-NEXT: s_setpc_b64 s[30:31]
13360 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13362 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13363 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2044
13364 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
13365 ; GFX90A-NEXT: .LBB57_1: ; %atomicrmw.start
13366 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
13367 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13368 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
13369 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
13370 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
13371 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13372 ; GFX90A-NEXT: buffer_wbinvl1
13373 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
13374 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13375 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
13376 ; GFX90A-NEXT: s_cbranch_execnz .LBB57_1
13377 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
13378 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
13379 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
13380 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
13382 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13384 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13385 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
13386 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
13387 ; GFX908-NEXT: .LBB57_1: ; %atomicrmw.start
13388 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
13389 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13390 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
13391 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
13392 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
13393 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13394 ; GFX908-NEXT: buffer_wbinvl1
13395 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
13396 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13397 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
13398 ; GFX908-NEXT: s_cbranch_execnz .LBB57_1
13399 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
13400 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
13401 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
13402 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13404 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13406 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13407 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
13408 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
13409 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
13410 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
13411 ; GFX8-NEXT: .LBB57_1: ; %atomicrmw.start
13412 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
13413 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13414 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
13415 ; GFX8-NEXT: v_add_f16_sdwa v0, v1, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
13416 ; GFX8-NEXT: v_add_f16_e32 v5, v1, v2
13417 ; GFX8-NEXT: v_or_b32_e32 v0, v5, v0
13418 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
13419 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13420 ; GFX8-NEXT: buffer_wbinvl1
13421 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
13422 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13423 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
13424 ; GFX8-NEXT: s_cbranch_execnz .LBB57_1
13425 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
13426 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
13427 ; GFX8-NEXT: s_setpc_b64 s[30:31]
13429 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13431 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13432 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fc, v0
13433 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
13434 ; GFX7-NEXT: flat_load_dword v1, v[4:5]
13435 ; GFX7-NEXT: v_cvt_f16_f32_e32 v0, v3
13436 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v2
13437 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
13438 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v0
13439 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
13440 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13441 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v1
13442 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
13443 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
13444 ; GFX7-NEXT: .LBB57_1: ; %atomicrmw.start
13445 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
13446 ; GFX7-NEXT: v_cvt_f16_f32_e32 v1, v1
13447 ; GFX7-NEXT: v_cvt_f16_f32_e32 v0, v0
13448 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v1
13449 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v0
13450 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 16, v1
13451 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
13452 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
13453 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
13454 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
13455 ; GFX7-NEXT: v_or_b32_e32 v7, v0, v1
13456 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v6
13457 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v0
13458 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[4:5], v[6:7] glc
13459 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13460 ; GFX7-NEXT: buffer_wbinvl1
13461 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v6
13462 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v6
13463 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
13464 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v7
13465 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13466 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
13467 ; GFX7-NEXT: s_cbranch_execnz .LBB57_1
13468 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
13469 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
13470 ; GFX7-NEXT: s_setpc_b64 s[30:31]
13471 %gep = getelementptr <2 x half>, ptr %ptr, i64 511
13472 %result = atomicrmw fadd ptr %gep, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
13473 ret <2 x half> %result
13476 define <2 x half> @flat_agent_atomic_fadd_ret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x half> %val) #0 {
13477 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
13479 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13480 ; GFX12-NEXT: s_wait_expcnt 0x0
13481 ; GFX12-NEXT: s_wait_samplecnt 0x0
13482 ; GFX12-NEXT: s_wait_bvhcnt 0x0
13483 ; GFX12-NEXT: s_wait_kmcnt 0x0
13484 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
13485 ; GFX12-NEXT: s_wait_storecnt 0x0
13486 ; GFX12-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
13487 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13488 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
13489 ; GFX12-NEXT: s_setpc_b64 s[30:31]
13491 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
13493 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13494 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
13495 ; GFX940-NEXT: s_nop 1
13496 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
13497 ; GFX940-NEXT: buffer_wbl2 sc1
13498 ; GFX940-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 sc0
13499 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13500 ; GFX940-NEXT: buffer_inv sc1
13501 ; GFX940-NEXT: s_setpc_b64 s[30:31]
13503 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
13505 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13506 ; GFX11-NEXT: v_mov_b32_e32 v3, v0
13507 ; GFX11-NEXT: s_mov_b32 s0, 0
13508 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
13509 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v3
13510 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, -1, v1, vcc_lo
13511 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v3
13512 ; GFX11-NEXT: flat_load_b32 v0, v[4:5]
13513 ; GFX11-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, -1, v1, vcc_lo
13514 ; GFX11-NEXT: .LBB58_1: ; %atomicrmw.start
13515 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
13516 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13517 ; GFX11-NEXT: v_mov_b32_e32 v1, v0
13518 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
13519 ; GFX11-NEXT: v_pk_add_f16 v0, v1, v2
13520 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
13521 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v0, v[3:4], v[0:1] glc
13522 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13523 ; GFX11-NEXT: buffer_gl1_inv
13524 ; GFX11-NEXT: buffer_gl0_inv
13525 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
13526 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
13527 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13528 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
13529 ; GFX11-NEXT: s_cbranch_execnz .LBB58_1
13530 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
13531 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
13532 ; GFX11-NEXT: s_setpc_b64 s[30:31]
13534 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
13536 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13537 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
13538 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, -1, v1, vcc_lo
13539 ; GFX10-NEXT: s_mov_b32 s4, 0
13540 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
13541 ; GFX10-NEXT: .LBB58_1: ; %atomicrmw.start
13542 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
13543 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13544 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
13545 ; GFX10-NEXT: v_pk_add_f16 v0, v1, v2
13546 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
13547 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
13548 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13549 ; GFX10-NEXT: buffer_gl1_inv
13550 ; GFX10-NEXT: buffer_gl0_inv
13551 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
13552 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
13553 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
13554 ; GFX10-NEXT: s_cbranch_execnz .LBB58_1
13555 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
13556 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
13557 ; GFX10-NEXT: s_setpc_b64 s[30:31]
13559 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
13561 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13562 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
13563 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, -1, v1, vcc
13564 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
13565 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
13566 ; GFX90A-NEXT: flat_load_dword v0, v[0:1]
13567 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
13568 ; GFX90A-NEXT: .LBB58_1: ; %atomicrmw.start
13569 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
13570 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13571 ; GFX90A-NEXT: v_mov_b32_e32 v1, v0
13572 ; GFX90A-NEXT: v_pk_add_f16 v0, v1, v2
13573 ; GFX90A-NEXT: flat_atomic_cmpswap v0, v[4:5], v[0:1] glc
13574 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13575 ; GFX90A-NEXT: buffer_wbinvl1
13576 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
13577 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13578 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
13579 ; GFX90A-NEXT: s_cbranch_execnz .LBB58_1
13580 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
13581 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
13582 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
13584 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
13586 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13587 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
13588 ; GFX908-NEXT: v_addc_co_u32_e32 v4, vcc, -1, v1, vcc
13589 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
13590 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
13591 ; GFX908-NEXT: flat_load_dword v0, v[0:1]
13592 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
13593 ; GFX908-NEXT: .LBB58_1: ; %atomicrmw.start
13594 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
13595 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13596 ; GFX908-NEXT: v_mov_b32_e32 v1, v0
13597 ; GFX908-NEXT: v_pk_add_f16 v0, v1, v2
13598 ; GFX908-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
13599 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13600 ; GFX908-NEXT: buffer_wbinvl1
13601 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
13602 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13603 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
13604 ; GFX908-NEXT: s_cbranch_execnz .LBB58_1
13605 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
13606 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
13607 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13609 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
13611 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13612 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
13613 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
13614 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
13615 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
13616 ; GFX8-NEXT: .LBB58_1: ; %atomicrmw.start
13617 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
13618 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13619 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
13620 ; GFX8-NEXT: v_add_f16_sdwa v0, v1, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
13621 ; GFX8-NEXT: v_add_f16_e32 v5, v1, v2
13622 ; GFX8-NEXT: v_or_b32_e32 v0, v5, v0
13623 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
13624 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13625 ; GFX8-NEXT: buffer_wbinvl1
13626 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
13627 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13628 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
13629 ; GFX8-NEXT: s_cbranch_execnz .LBB58_1
13630 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
13631 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
13632 ; GFX8-NEXT: s_setpc_b64 s[30:31]
13634 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
13636 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13637 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
13638 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, -1, v1, vcc
13639 ; GFX7-NEXT: flat_load_dword v1, v[4:5]
13640 ; GFX7-NEXT: v_cvt_f16_f32_e32 v0, v3
13641 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v2
13642 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
13643 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v0
13644 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
13645 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13646 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v1
13647 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
13648 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
13649 ; GFX7-NEXT: .LBB58_1: ; %atomicrmw.start
13650 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
13651 ; GFX7-NEXT: v_cvt_f16_f32_e32 v1, v1
13652 ; GFX7-NEXT: v_cvt_f16_f32_e32 v0, v0
13653 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v1
13654 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v0
13655 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 16, v1
13656 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
13657 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
13658 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
13659 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
13660 ; GFX7-NEXT: v_or_b32_e32 v7, v0, v1
13661 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v6
13662 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v0
13663 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[4:5], v[6:7] glc
13664 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13665 ; GFX7-NEXT: buffer_wbinvl1
13666 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v6
13667 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v6
13668 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
13669 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v7
13670 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13671 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
13672 ; GFX7-NEXT: s_cbranch_execnz .LBB58_1
13673 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
13674 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
13675 ; GFX7-NEXT: s_setpc_b64 s[30:31]
13676 %gep = getelementptr <2 x half>, ptr %ptr, i64 -512
13677 %result = atomicrmw fadd ptr %gep, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
13678 ret <2 x half> %result
13681 define void @flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x half> %val) #0 {
13682 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory:
13684 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13685 ; GFX12-NEXT: s_wait_expcnt 0x0
13686 ; GFX12-NEXT: s_wait_samplecnt 0x0
13687 ; GFX12-NEXT: s_wait_bvhcnt 0x0
13688 ; GFX12-NEXT: s_wait_kmcnt 0x0
13689 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
13690 ; GFX12-NEXT: s_wait_storecnt 0x0
13691 ; GFX12-NEXT: flat_atomic_pk_add_f16 v[0:1], v2 scope:SCOPE_DEV
13692 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
13693 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
13694 ; GFX12-NEXT: s_setpc_b64 s[30:31]
13696 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory:
13698 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13699 ; GFX940-NEXT: buffer_wbl2 sc1
13700 ; GFX940-NEXT: flat_atomic_pk_add_f16 v[0:1], v2
13701 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13702 ; GFX940-NEXT: buffer_inv sc1
13703 ; GFX940-NEXT: s_setpc_b64 s[30:31]
13705 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory:
13707 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13708 ; GFX11-NEXT: flat_load_b32 v4, v[0:1]
13709 ; GFX11-NEXT: s_mov_b32 s0, 0
13710 ; GFX11-NEXT: .LBB59_1: ; %atomicrmw.start
13711 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
13712 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13713 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
13714 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
13715 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
13716 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13717 ; GFX11-NEXT: buffer_gl1_inv
13718 ; GFX11-NEXT: buffer_gl0_inv
13719 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
13720 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
13721 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
13722 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13723 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
13724 ; GFX11-NEXT: s_cbranch_execnz .LBB59_1
13725 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
13726 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
13727 ; GFX11-NEXT: s_setpc_b64 s[30:31]
13729 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory:
13731 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13732 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
13733 ; GFX10-NEXT: s_mov_b32 s4, 0
13734 ; GFX10-NEXT: .LBB59_1: ; %atomicrmw.start
13735 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
13736 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13737 ; GFX10-NEXT: v_pk_add_f16 v3, v4, v2
13738 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
13739 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
13740 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13741 ; GFX10-NEXT: buffer_gl1_inv
13742 ; GFX10-NEXT: buffer_gl0_inv
13743 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
13744 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
13745 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
13746 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
13747 ; GFX10-NEXT: s_cbranch_execnz .LBB59_1
13748 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
13749 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
13750 ; GFX10-NEXT: s_setpc_b64 s[30:31]
13752 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory:
13754 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13755 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
13756 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
13757 ; GFX90A-NEXT: .LBB59_1: ; %atomicrmw.start
13758 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
13759 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13760 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
13761 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc
13762 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13763 ; GFX90A-NEXT: buffer_wbinvl1
13764 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
13765 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13766 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
13767 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
13768 ; GFX90A-NEXT: s_cbranch_execnz .LBB59_1
13769 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
13770 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
13771 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
13773 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory:
13775 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13776 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
13777 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
13778 ; GFX908-NEXT: .LBB59_1: ; %atomicrmw.start
13779 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
13780 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13781 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
13782 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
13783 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13784 ; GFX908-NEXT: buffer_wbinvl1
13785 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
13786 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13787 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
13788 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
13789 ; GFX908-NEXT: s_cbranch_execnz .LBB59_1
13790 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
13791 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
13792 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13794 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory:
13796 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13797 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
13798 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
13799 ; GFX8-NEXT: .LBB59_1: ; %atomicrmw.start
13800 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
13801 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13802 ; GFX8-NEXT: v_add_f16_sdwa v3, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
13803 ; GFX8-NEXT: v_add_f16_e32 v5, v4, v2
13804 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
13805 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
13806 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13807 ; GFX8-NEXT: buffer_wbinvl1
13808 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
13809 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13810 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
13811 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
13812 ; GFX8-NEXT: s_cbranch_execnz .LBB59_1
13813 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
13814 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
13815 ; GFX8-NEXT: s_setpc_b64 s[30:31]
13817 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory:
13819 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13820 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
13821 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
13822 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
13823 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
13824 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
13825 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13826 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
13827 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
13828 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
13829 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
13830 ; GFX7-NEXT: .LBB59_1: ; %atomicrmw.start
13831 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
13832 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
13833 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
13834 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
13835 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
13836 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
13837 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
13838 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
13839 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
13840 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
13841 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
13842 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
13843 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
13844 ; GFX7-NEXT: flat_atomic_cmpswap v7, v[0:1], v[5:6] glc
13845 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13846 ; GFX7-NEXT: buffer_wbinvl1
13847 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
13848 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
13849 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
13850 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
13851 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13852 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
13853 ; GFX7-NEXT: s_cbranch_execnz .LBB59_1
13854 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
13855 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
13856 ; GFX7-NEXT: s_setpc_b64 s[30:31]
13857 %unused = atomicrmw fadd ptr %ptr, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
13861 define void @flat_agent_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x half> %val) #0 {
13862 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13864 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
13865 ; GFX12-NEXT: s_wait_expcnt 0x0
13866 ; GFX12-NEXT: s_wait_samplecnt 0x0
13867 ; GFX12-NEXT: s_wait_bvhcnt 0x0
13868 ; GFX12-NEXT: s_wait_kmcnt 0x0
13869 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
13870 ; GFX12-NEXT: s_wait_storecnt 0x0
13871 ; GFX12-NEXT: flat_atomic_pk_add_f16 v[0:1], v2 offset:2044 scope:SCOPE_DEV
13872 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
13873 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
13874 ; GFX12-NEXT: s_setpc_b64 s[30:31]
13876 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13878 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13879 ; GFX940-NEXT: buffer_wbl2 sc1
13880 ; GFX940-NEXT: flat_atomic_pk_add_f16 v[0:1], v2 offset:2044
13881 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13882 ; GFX940-NEXT: buffer_inv sc1
13883 ; GFX940-NEXT: s_setpc_b64 s[30:31]
13885 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13887 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13888 ; GFX11-NEXT: flat_load_b32 v4, v[0:1] offset:2044
13889 ; GFX11-NEXT: s_mov_b32 s0, 0
13890 ; GFX11-NEXT: .LBB60_1: ; %atomicrmw.start
13891 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
13892 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13893 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
13894 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
13895 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
13896 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13897 ; GFX11-NEXT: buffer_gl1_inv
13898 ; GFX11-NEXT: buffer_gl0_inv
13899 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
13900 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
13901 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
13902 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
13903 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
13904 ; GFX11-NEXT: s_cbranch_execnz .LBB60_1
13905 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
13906 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
13907 ; GFX11-NEXT: s_setpc_b64 s[30:31]
13909 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13911 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13912 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
13913 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
13914 ; GFX10-NEXT: s_mov_b32 s4, 0
13915 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
13916 ; GFX10-NEXT: .LBB60_1: ; %atomicrmw.start
13917 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
13918 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13919 ; GFX10-NEXT: v_pk_add_f16 v3, v4, v2
13920 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
13921 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
13922 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13923 ; GFX10-NEXT: buffer_gl1_inv
13924 ; GFX10-NEXT: buffer_gl0_inv
13925 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
13926 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
13927 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
13928 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
13929 ; GFX10-NEXT: s_cbranch_execnz .LBB60_1
13930 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
13931 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
13932 ; GFX10-NEXT: s_setpc_b64 s[30:31]
13934 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13936 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13937 ; GFX90A-NEXT: flat_load_dword v5, v[0:1] offset:2044
13938 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
13939 ; GFX90A-NEXT: .LBB60_1: ; %atomicrmw.start
13940 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
13941 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13942 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
13943 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
13944 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13945 ; GFX90A-NEXT: buffer_wbinvl1
13946 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
13947 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13948 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
13949 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
13950 ; GFX90A-NEXT: s_cbranch_execnz .LBB60_1
13951 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
13952 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
13953 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
13955 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13957 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13958 ; GFX908-NEXT: flat_load_dword v4, v[0:1] offset:2044
13959 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
13960 ; GFX908-NEXT: .LBB60_1: ; %atomicrmw.start
13961 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
13962 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13963 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
13964 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
13965 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13966 ; GFX908-NEXT: buffer_wbinvl1
13967 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
13968 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13969 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
13970 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
13971 ; GFX908-NEXT: s_cbranch_execnz .LBB60_1
13972 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
13973 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
13974 ; GFX908-NEXT: s_setpc_b64 s[30:31]
13976 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
13978 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13979 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
13980 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
13981 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
13982 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
13983 ; GFX8-NEXT: .LBB60_1: ; %atomicrmw.start
13984 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
13985 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13986 ; GFX8-NEXT: v_add_f16_sdwa v3, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
13987 ; GFX8-NEXT: v_add_f16_e32 v5, v4, v2
13988 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
13989 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
13990 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
13991 ; GFX8-NEXT: buffer_wbinvl1
13992 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
13993 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
13994 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
13995 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
13996 ; GFX8-NEXT: s_cbranch_execnz .LBB60_1
13997 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
13998 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
13999 ; GFX8-NEXT: s_setpc_b64 s[30:31]
14001 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14003 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14004 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
14005 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
14006 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
14007 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
14008 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
14009 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
14010 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
14011 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14012 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
14013 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
14014 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
14015 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
14016 ; GFX7-NEXT: .LBB60_1: ; %atomicrmw.start
14017 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
14018 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
14019 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
14020 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
14021 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
14022 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
14023 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
14024 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
14025 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
14026 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
14027 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
14028 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
14029 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
14030 ; GFX7-NEXT: flat_atomic_cmpswap v7, v[0:1], v[5:6] glc
14031 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14032 ; GFX7-NEXT: buffer_wbinvl1
14033 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
14034 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
14035 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
14036 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
14037 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14038 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
14039 ; GFX7-NEXT: s_cbranch_execnz .LBB60_1
14040 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
14041 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
14042 ; GFX7-NEXT: s_setpc_b64 s[30:31]
14043 %gep = getelementptr <2 x half>, ptr %ptr, i64 511
14044 %unused = atomicrmw fadd ptr %gep, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
14048 define void @flat_agent_atomic_fadd_noret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x half> %val) #0 {
14049 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
14051 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
14052 ; GFX12-NEXT: s_wait_expcnt 0x0
14053 ; GFX12-NEXT: s_wait_samplecnt 0x0
14054 ; GFX12-NEXT: s_wait_bvhcnt 0x0
14055 ; GFX12-NEXT: s_wait_kmcnt 0x0
14056 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
14057 ; GFX12-NEXT: s_wait_storecnt 0x0
14058 ; GFX12-NEXT: flat_atomic_pk_add_f16 v[0:1], v2 offset:-2048 scope:SCOPE_DEV
14059 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
14060 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
14061 ; GFX12-NEXT: s_setpc_b64 s[30:31]
14063 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
14065 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14066 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
14067 ; GFX940-NEXT: s_nop 1
14068 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
14069 ; GFX940-NEXT: buffer_wbl2 sc1
14070 ; GFX940-NEXT: flat_atomic_pk_add_f16 v[0:1], v2
14071 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14072 ; GFX940-NEXT: buffer_inv sc1
14073 ; GFX940-NEXT: s_setpc_b64 s[30:31]
14075 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
14077 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14078 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
14079 ; GFX11-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, -1, v1, vcc_lo
14080 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
14081 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
14082 ; GFX11-NEXT: flat_load_b32 v4, v[3:4]
14083 ; GFX11-NEXT: s_mov_b32 s0, 0
14084 ; GFX11-NEXT: .LBB61_1: ; %atomicrmw.start
14085 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
14086 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14087 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
14088 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
14089 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
14090 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14091 ; GFX11-NEXT: buffer_gl1_inv
14092 ; GFX11-NEXT: buffer_gl0_inv
14093 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
14094 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
14095 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
14096 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14097 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
14098 ; GFX11-NEXT: s_cbranch_execnz .LBB61_1
14099 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
14100 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
14101 ; GFX11-NEXT: s_setpc_b64 s[30:31]
14103 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
14105 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14106 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
14107 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
14108 ; GFX10-NEXT: s_mov_b32 s4, 0
14109 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
14110 ; GFX10-NEXT: .LBB61_1: ; %atomicrmw.start
14111 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
14112 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14113 ; GFX10-NEXT: v_pk_add_f16 v3, v4, v2
14114 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
14115 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14116 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14117 ; GFX10-NEXT: buffer_gl1_inv
14118 ; GFX10-NEXT: buffer_gl0_inv
14119 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
14120 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
14121 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
14122 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
14123 ; GFX10-NEXT: s_cbranch_execnz .LBB61_1
14124 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
14125 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
14126 ; GFX10-NEXT: s_setpc_b64 s[30:31]
14128 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
14130 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14131 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
14132 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, -1, v1, vcc
14133 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
14134 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
14135 ; GFX90A-NEXT: flat_load_dword v1, v[0:1]
14136 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
14137 ; GFX90A-NEXT: .LBB61_1: ; %atomicrmw.start
14138 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
14139 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14140 ; GFX90A-NEXT: v_pk_add_f16 v0, v1, v2
14141 ; GFX90A-NEXT: flat_atomic_cmpswap v0, v[4:5], v[0:1] glc
14142 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14143 ; GFX90A-NEXT: buffer_wbinvl1
14144 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
14145 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14146 ; GFX90A-NEXT: v_mov_b32_e32 v1, v0
14147 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
14148 ; GFX90A-NEXT: s_cbranch_execnz .LBB61_1
14149 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
14150 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
14151 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
14153 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
14155 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14156 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
14157 ; GFX908-NEXT: v_addc_co_u32_e32 v4, vcc, -1, v1, vcc
14158 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
14159 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
14160 ; GFX908-NEXT: flat_load_dword v1, v[0:1]
14161 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
14162 ; GFX908-NEXT: .LBB61_1: ; %atomicrmw.start
14163 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
14164 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14165 ; GFX908-NEXT: v_pk_add_f16 v0, v1, v2
14166 ; GFX908-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
14167 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14168 ; GFX908-NEXT: buffer_wbinvl1
14169 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
14170 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14171 ; GFX908-NEXT: v_mov_b32_e32 v1, v0
14172 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
14173 ; GFX908-NEXT: s_cbranch_execnz .LBB61_1
14174 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
14175 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
14176 ; GFX908-NEXT: s_setpc_b64 s[30:31]
14178 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
14180 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14181 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff800, v0
14182 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
14183 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
14184 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
14185 ; GFX8-NEXT: .LBB61_1: ; %atomicrmw.start
14186 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
14187 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14188 ; GFX8-NEXT: v_add_f16_sdwa v3, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
14189 ; GFX8-NEXT: v_add_f16_e32 v5, v4, v2
14190 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
14191 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14192 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14193 ; GFX8-NEXT: buffer_wbinvl1
14194 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
14195 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14196 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
14197 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
14198 ; GFX8-NEXT: s_cbranch_execnz .LBB61_1
14199 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
14200 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
14201 ; GFX8-NEXT: s_setpc_b64 s[30:31]
14203 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2f16__offset12b_neg__amdgpu_no_fine_grained_memory:
14205 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14206 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0xfffff800, v0
14207 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
14208 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
14209 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
14210 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
14211 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
14212 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
14213 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14214 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
14215 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
14216 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
14217 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
14218 ; GFX7-NEXT: .LBB61_1: ; %atomicrmw.start
14219 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
14220 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
14221 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
14222 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
14223 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
14224 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
14225 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
14226 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
14227 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
14228 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
14229 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
14230 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
14231 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
14232 ; GFX7-NEXT: flat_atomic_cmpswap v7, v[0:1], v[5:6] glc
14233 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14234 ; GFX7-NEXT: buffer_wbinvl1
14235 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
14236 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
14237 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
14238 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
14239 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14240 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
14241 ; GFX7-NEXT: s_cbranch_execnz .LBB61_1
14242 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
14243 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
14244 ; GFX7-NEXT: s_setpc_b64 s[30:31]
14245 %gep = getelementptr <2 x half>, ptr %ptr, i64 -512
14246 %unused = atomicrmw fadd ptr %gep, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
14250 define <2 x half> @flat_system_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x half> %val) #0 {
14251 ; GFX12-LABEL: flat_system_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14253 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
14254 ; GFX12-NEXT: s_wait_expcnt 0x0
14255 ; GFX12-NEXT: s_wait_samplecnt 0x0
14256 ; GFX12-NEXT: s_wait_bvhcnt 0x0
14257 ; GFX12-NEXT: s_wait_kmcnt 0x0
14258 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
14259 ; GFX12-NEXT: s_wait_storecnt 0x0
14260 ; GFX12-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
14261 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
14262 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
14263 ; GFX12-NEXT: s_setpc_b64 s[30:31]
14265 ; GFX940-LABEL: flat_system_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14267 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14268 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
14269 ; GFX940-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 offset:2044 sc0 sc1
14270 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14271 ; GFX940-NEXT: buffer_inv sc0 sc1
14272 ; GFX940-NEXT: s_setpc_b64 s[30:31]
14274 ; GFX11-LABEL: flat_system_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14276 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14277 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2044
14278 ; GFX11-NEXT: s_mov_b32 s0, 0
14279 ; GFX11-NEXT: .LBB62_1: ; %atomicrmw.start
14280 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
14281 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14282 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
14283 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
14284 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
14285 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
14286 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
14287 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14288 ; GFX11-NEXT: buffer_gl1_inv
14289 ; GFX11-NEXT: buffer_gl0_inv
14290 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
14291 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
14292 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14293 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
14294 ; GFX11-NEXT: s_cbranch_execnz .LBB62_1
14295 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
14296 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
14297 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
14298 ; GFX11-NEXT: s_setpc_b64 s[30:31]
14300 ; GFX10-LABEL: flat_system_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14302 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14303 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fc, v0
14304 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
14305 ; GFX10-NEXT: s_mov_b32 s4, 0
14306 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
14307 ; GFX10-NEXT: .LBB62_1: ; %atomicrmw.start
14308 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
14309 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14310 ; GFX10-NEXT: v_mov_b32_e32 v1, v0
14311 ; GFX10-NEXT: v_pk_add_f16 v0, v1, v2
14312 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
14313 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
14314 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14315 ; GFX10-NEXT: buffer_gl1_inv
14316 ; GFX10-NEXT: buffer_gl0_inv
14317 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v1
14318 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
14319 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
14320 ; GFX10-NEXT: s_cbranch_execnz .LBB62_1
14321 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
14322 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
14323 ; GFX10-NEXT: s_setpc_b64 s[30:31]
14325 ; GFX90A-LABEL: flat_system_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14327 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14328 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2044
14329 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
14330 ; GFX90A-NEXT: .LBB62_1: ; %atomicrmw.start
14331 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
14332 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14333 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
14334 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
14335 ; GFX90A-NEXT: buffer_wbl2
14336 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
14337 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14338 ; GFX90A-NEXT: buffer_invl2
14339 ; GFX90A-NEXT: buffer_wbinvl1
14340 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
14341 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14342 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
14343 ; GFX90A-NEXT: s_cbranch_execnz .LBB62_1
14344 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
14345 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
14346 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
14347 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
14349 ; GFX908-LABEL: flat_system_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14351 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14352 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
14353 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
14354 ; GFX908-NEXT: .LBB62_1: ; %atomicrmw.start
14355 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
14356 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14357 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
14358 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
14359 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
14360 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14361 ; GFX908-NEXT: buffer_wbinvl1
14362 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
14363 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14364 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
14365 ; GFX908-NEXT: s_cbranch_execnz .LBB62_1
14366 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
14367 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
14368 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
14369 ; GFX908-NEXT: s_setpc_b64 s[30:31]
14371 ; GFX8-LABEL: flat_system_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14373 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14374 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
14375 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
14376 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
14377 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
14378 ; GFX8-NEXT: .LBB62_1: ; %atomicrmw.start
14379 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
14380 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14381 ; GFX8-NEXT: v_mov_b32_e32 v1, v0
14382 ; GFX8-NEXT: v_add_f16_sdwa v0, v1, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
14383 ; GFX8-NEXT: v_add_f16_e32 v5, v1, v2
14384 ; GFX8-NEXT: v_or_b32_e32 v0, v5, v0
14385 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
14386 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14387 ; GFX8-NEXT: buffer_wbinvl1
14388 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
14389 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14390 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
14391 ; GFX8-NEXT: s_cbranch_execnz .LBB62_1
14392 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
14393 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
14394 ; GFX8-NEXT: s_setpc_b64 s[30:31]
14396 ; GFX7-LABEL: flat_system_atomic_fadd_ret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14398 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14399 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fc, v0
14400 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
14401 ; GFX7-NEXT: flat_load_dword v1, v[4:5]
14402 ; GFX7-NEXT: v_cvt_f16_f32_e32 v0, v3
14403 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v2
14404 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
14405 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v0
14406 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
14407 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14408 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v1
14409 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
14410 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
14411 ; GFX7-NEXT: .LBB62_1: ; %atomicrmw.start
14412 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
14413 ; GFX7-NEXT: v_cvt_f16_f32_e32 v1, v1
14414 ; GFX7-NEXT: v_cvt_f16_f32_e32 v0, v0
14415 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v1
14416 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v0
14417 ; GFX7-NEXT: v_lshlrev_b32_e32 v1, 16, v1
14418 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
14419 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
14420 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
14421 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
14422 ; GFX7-NEXT: v_or_b32_e32 v7, v0, v1
14423 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v6
14424 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v0
14425 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[4:5], v[6:7] glc
14426 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14427 ; GFX7-NEXT: buffer_wbinvl1
14428 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v6
14429 ; GFX7-NEXT: v_cvt_f32_f16_e32 v0, v6
14430 ; GFX7-NEXT: v_cvt_f32_f16_e32 v1, v1
14431 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v7
14432 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14433 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
14434 ; GFX7-NEXT: s_cbranch_execnz .LBB62_1
14435 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
14436 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
14437 ; GFX7-NEXT: s_setpc_b64 s[30:31]
14438 %gep = getelementptr <2 x half>, ptr %ptr, i64 511
14439 %result = atomicrmw fadd ptr %gep, <2 x half> %val seq_cst, !amdgpu.no.fine.grained.memory !0
14440 ret <2 x half> %result
14443 define void @flat_system_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x half> %val) #0 {
14444 ; GFX12-LABEL: flat_system_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14446 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
14447 ; GFX12-NEXT: s_wait_expcnt 0x0
14448 ; GFX12-NEXT: s_wait_samplecnt 0x0
14449 ; GFX12-NEXT: s_wait_bvhcnt 0x0
14450 ; GFX12-NEXT: s_wait_kmcnt 0x0
14451 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
14452 ; GFX12-NEXT: s_wait_storecnt 0x0
14453 ; GFX12-NEXT: flat_atomic_pk_add_f16 v[0:1], v2 offset:2044 scope:SCOPE_SYS
14454 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
14455 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
14456 ; GFX12-NEXT: s_setpc_b64 s[30:31]
14458 ; GFX940-LABEL: flat_system_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14460 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14461 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
14462 ; GFX940-NEXT: flat_atomic_pk_add_f16 v[0:1], v2 offset:2044 sc1
14463 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14464 ; GFX940-NEXT: buffer_inv sc0 sc1
14465 ; GFX940-NEXT: s_setpc_b64 s[30:31]
14467 ; GFX11-LABEL: flat_system_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14469 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14470 ; GFX11-NEXT: flat_load_b32 v4, v[0:1] offset:2044
14471 ; GFX11-NEXT: s_mov_b32 s0, 0
14472 ; GFX11-NEXT: .LBB63_1: ; %atomicrmw.start
14473 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
14474 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14475 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
14476 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
14477 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] offset:2044 glc
14478 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14479 ; GFX11-NEXT: buffer_gl1_inv
14480 ; GFX11-NEXT: buffer_gl0_inv
14481 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
14482 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
14483 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
14484 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14485 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
14486 ; GFX11-NEXT: s_cbranch_execnz .LBB63_1
14487 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
14488 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
14489 ; GFX11-NEXT: s_setpc_b64 s[30:31]
14491 ; GFX10-LABEL: flat_system_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14493 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14494 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
14495 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
14496 ; GFX10-NEXT: s_mov_b32 s4, 0
14497 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
14498 ; GFX10-NEXT: .LBB63_1: ; %atomicrmw.start
14499 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
14500 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14501 ; GFX10-NEXT: v_pk_add_f16 v3, v4, v2
14502 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
14503 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14504 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14505 ; GFX10-NEXT: buffer_gl1_inv
14506 ; GFX10-NEXT: buffer_gl0_inv
14507 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
14508 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
14509 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
14510 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
14511 ; GFX10-NEXT: s_cbranch_execnz .LBB63_1
14512 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
14513 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
14514 ; GFX10-NEXT: s_setpc_b64 s[30:31]
14516 ; GFX90A-LABEL: flat_system_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14518 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14519 ; GFX90A-NEXT: flat_load_dword v5, v[0:1] offset:2044
14520 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
14521 ; GFX90A-NEXT: .LBB63_1: ; %atomicrmw.start
14522 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
14523 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14524 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
14525 ; GFX90A-NEXT: buffer_wbl2
14526 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] offset:2044 glc
14527 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14528 ; GFX90A-NEXT: buffer_invl2
14529 ; GFX90A-NEXT: buffer_wbinvl1
14530 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
14531 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14532 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
14533 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
14534 ; GFX90A-NEXT: s_cbranch_execnz .LBB63_1
14535 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
14536 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
14537 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
14539 ; GFX908-LABEL: flat_system_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14541 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14542 ; GFX908-NEXT: flat_load_dword v4, v[0:1] offset:2044
14543 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
14544 ; GFX908-NEXT: .LBB63_1: ; %atomicrmw.start
14545 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
14546 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14547 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
14548 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] offset:2044 glc
14549 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14550 ; GFX908-NEXT: buffer_wbinvl1
14551 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
14552 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14553 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
14554 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
14555 ; GFX908-NEXT: s_cbranch_execnz .LBB63_1
14556 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
14557 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
14558 ; GFX908-NEXT: s_setpc_b64 s[30:31]
14560 ; GFX8-LABEL: flat_system_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14562 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14563 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
14564 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
14565 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
14566 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
14567 ; GFX8-NEXT: .LBB63_1: ; %atomicrmw.start
14568 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
14569 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14570 ; GFX8-NEXT: v_add_f16_sdwa v3, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
14571 ; GFX8-NEXT: v_add_f16_e32 v5, v4, v2
14572 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
14573 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14574 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14575 ; GFX8-NEXT: buffer_wbinvl1
14576 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
14577 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14578 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
14579 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
14580 ; GFX8-NEXT: s_cbranch_execnz .LBB63_1
14581 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
14582 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
14583 ; GFX8-NEXT: s_setpc_b64 s[30:31]
14585 ; GFX7-LABEL: flat_system_atomic_fadd_noret_v2f16__offset12b_pos__amdgpu_no_fine_grained_memory:
14587 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14588 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
14589 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
14590 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
14591 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
14592 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
14593 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
14594 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
14595 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14596 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
14597 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
14598 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
14599 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
14600 ; GFX7-NEXT: .LBB63_1: ; %atomicrmw.start
14601 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
14602 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
14603 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
14604 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
14605 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
14606 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
14607 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
14608 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
14609 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
14610 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
14611 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
14612 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
14613 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
14614 ; GFX7-NEXT: flat_atomic_cmpswap v7, v[0:1], v[5:6] glc
14615 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14616 ; GFX7-NEXT: buffer_wbinvl1
14617 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
14618 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
14619 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
14620 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
14621 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14622 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
14623 ; GFX7-NEXT: s_cbranch_execnz .LBB63_1
14624 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
14625 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
14626 ; GFX7-NEXT: s_setpc_b64 s[30:31]
14627 %gep = getelementptr <2 x half>, ptr %ptr, i64 511
14628 %unused = atomicrmw fadd ptr %gep, <2 x half> %val seq_cst, !amdgpu.no.fine.grained.memory !0
14632 define <2 x half> @flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_remote_memory(ptr %ptr, <2 x half> %val) #0 {
14633 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_remote_memory:
14635 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
14636 ; GFX12-NEXT: s_wait_expcnt 0x0
14637 ; GFX12-NEXT: s_wait_samplecnt 0x0
14638 ; GFX12-NEXT: s_wait_bvhcnt 0x0
14639 ; GFX12-NEXT: s_wait_kmcnt 0x0
14640 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
14641 ; GFX12-NEXT: s_wait_storecnt 0x0
14642 ; GFX12-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
14643 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
14644 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
14645 ; GFX12-NEXT: s_setpc_b64 s[30:31]
14647 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_remote_memory:
14649 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14650 ; GFX940-NEXT: buffer_wbl2 sc1
14651 ; GFX940-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 sc0
14652 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14653 ; GFX940-NEXT: buffer_inv sc1
14654 ; GFX940-NEXT: s_setpc_b64 s[30:31]
14656 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_remote_memory:
14658 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14659 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
14660 ; GFX11-NEXT: s_mov_b32 s0, 0
14661 ; GFX11-NEXT: .LBB64_1: ; %atomicrmw.start
14662 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
14663 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14664 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
14665 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
14666 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
14667 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
14668 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
14669 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14670 ; GFX11-NEXT: buffer_gl1_inv
14671 ; GFX11-NEXT: buffer_gl0_inv
14672 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
14673 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
14674 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14675 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
14676 ; GFX11-NEXT: s_cbranch_execnz .LBB64_1
14677 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
14678 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
14679 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
14680 ; GFX11-NEXT: s_setpc_b64 s[30:31]
14682 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_remote_memory:
14684 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14685 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
14686 ; GFX10-NEXT: s_mov_b32 s4, 0
14687 ; GFX10-NEXT: .LBB64_1: ; %atomicrmw.start
14688 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
14689 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14690 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
14691 ; GFX10-NEXT: v_pk_add_f16 v3, v4, v2
14692 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
14693 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14694 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14695 ; GFX10-NEXT: buffer_gl1_inv
14696 ; GFX10-NEXT: buffer_gl0_inv
14697 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
14698 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
14699 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
14700 ; GFX10-NEXT: s_cbranch_execnz .LBB64_1
14701 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
14702 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
14703 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
14704 ; GFX10-NEXT: s_setpc_b64 s[30:31]
14706 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_remote_memory:
14708 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14709 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
14710 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
14711 ; GFX90A-NEXT: .LBB64_1: ; %atomicrmw.start
14712 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
14713 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14714 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
14715 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
14716 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc
14717 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14718 ; GFX90A-NEXT: buffer_wbinvl1
14719 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
14720 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14721 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
14722 ; GFX90A-NEXT: s_cbranch_execnz .LBB64_1
14723 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
14724 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
14725 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
14726 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
14728 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_remote_memory:
14730 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14731 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
14732 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
14733 ; GFX908-NEXT: .LBB64_1: ; %atomicrmw.start
14734 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
14735 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14736 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
14737 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
14738 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14739 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14740 ; GFX908-NEXT: buffer_wbinvl1
14741 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
14742 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14743 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
14744 ; GFX908-NEXT: s_cbranch_execnz .LBB64_1
14745 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
14746 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
14747 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
14748 ; GFX908-NEXT: s_setpc_b64 s[30:31]
14750 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_remote_memory:
14752 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14753 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
14754 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
14755 ; GFX8-NEXT: .LBB64_1: ; %atomicrmw.start
14756 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
14757 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14758 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
14759 ; GFX8-NEXT: v_add_f16_sdwa v3, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
14760 ; GFX8-NEXT: v_add_f16_e32 v5, v4, v2
14761 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
14762 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14763 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14764 ; GFX8-NEXT: buffer_wbinvl1
14765 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
14766 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14767 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
14768 ; GFX8-NEXT: s_cbranch_execnz .LBB64_1
14769 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
14770 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
14771 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
14772 ; GFX8-NEXT: s_setpc_b64 s[30:31]
14774 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_remote_memory:
14776 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14777 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
14778 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
14779 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
14780 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
14781 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v3
14782 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14783 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
14784 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
14785 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
14786 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v6
14787 ; GFX7-NEXT: .LBB64_1: ; %atomicrmw.start
14788 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
14789 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
14790 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
14791 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v3
14792 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v2
14793 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
14794 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v4
14795 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v5
14796 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
14797 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
14798 ; GFX7-NEXT: v_or_b32_e32 v7, v2, v3
14799 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v6
14800 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v2
14801 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[6:7] glc
14802 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14803 ; GFX7-NEXT: buffer_wbinvl1
14804 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v6
14805 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v6
14806 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
14807 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v7
14808 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14809 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
14810 ; GFX7-NEXT: s_cbranch_execnz .LBB64_1
14811 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
14812 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
14813 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
14814 ; GFX7-NEXT: v_mov_b32_e32 v1, v3
14815 ; GFX7-NEXT: s_setpc_b64 s[30:31]
14816 %result = atomicrmw fadd ptr %ptr, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.remote.memory !0
14817 ret <2 x half> %result
14820 define void @flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_remote_memory(ptr %ptr, <2 x half> %val) #0 {
14821 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_remote_memory:
14823 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
14824 ; GFX12-NEXT: s_wait_expcnt 0x0
14825 ; GFX12-NEXT: s_wait_samplecnt 0x0
14826 ; GFX12-NEXT: s_wait_bvhcnt 0x0
14827 ; GFX12-NEXT: s_wait_kmcnt 0x0
14828 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
14829 ; GFX12-NEXT: s_wait_storecnt 0x0
14830 ; GFX12-NEXT: flat_atomic_pk_add_f16 v[0:1], v2 scope:SCOPE_DEV
14831 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
14832 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
14833 ; GFX12-NEXT: s_setpc_b64 s[30:31]
14835 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_remote_memory:
14837 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14838 ; GFX940-NEXT: buffer_wbl2 sc1
14839 ; GFX940-NEXT: flat_atomic_pk_add_f16 v[0:1], v2
14840 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14841 ; GFX940-NEXT: buffer_inv sc1
14842 ; GFX940-NEXT: s_setpc_b64 s[30:31]
14844 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_remote_memory:
14846 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14847 ; GFX11-NEXT: flat_load_b32 v4, v[0:1]
14848 ; GFX11-NEXT: s_mov_b32 s0, 0
14849 ; GFX11-NEXT: .LBB65_1: ; %atomicrmw.start
14850 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
14851 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14852 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
14853 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
14854 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
14855 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14856 ; GFX11-NEXT: buffer_gl1_inv
14857 ; GFX11-NEXT: buffer_gl0_inv
14858 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
14859 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
14860 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
14861 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
14862 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
14863 ; GFX11-NEXT: s_cbranch_execnz .LBB65_1
14864 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
14865 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
14866 ; GFX11-NEXT: s_setpc_b64 s[30:31]
14868 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_remote_memory:
14870 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14871 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
14872 ; GFX10-NEXT: s_mov_b32 s4, 0
14873 ; GFX10-NEXT: .LBB65_1: ; %atomicrmw.start
14874 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
14875 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14876 ; GFX10-NEXT: v_pk_add_f16 v3, v4, v2
14877 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
14878 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14879 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14880 ; GFX10-NEXT: buffer_gl1_inv
14881 ; GFX10-NEXT: buffer_gl0_inv
14882 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
14883 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
14884 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
14885 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
14886 ; GFX10-NEXT: s_cbranch_execnz .LBB65_1
14887 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
14888 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
14889 ; GFX10-NEXT: s_setpc_b64 s[30:31]
14891 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_remote_memory:
14893 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14894 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
14895 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
14896 ; GFX90A-NEXT: .LBB65_1: ; %atomicrmw.start
14897 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
14898 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14899 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
14900 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc
14901 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14902 ; GFX90A-NEXT: buffer_wbinvl1
14903 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
14904 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14905 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
14906 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
14907 ; GFX90A-NEXT: s_cbranch_execnz .LBB65_1
14908 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
14909 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
14910 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
14912 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_remote_memory:
14914 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14915 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
14916 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
14917 ; GFX908-NEXT: .LBB65_1: ; %atomicrmw.start
14918 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
14919 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14920 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
14921 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14922 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14923 ; GFX908-NEXT: buffer_wbinvl1
14924 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
14925 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14926 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
14927 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
14928 ; GFX908-NEXT: s_cbranch_execnz .LBB65_1
14929 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
14930 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
14931 ; GFX908-NEXT: s_setpc_b64 s[30:31]
14933 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_remote_memory:
14935 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14936 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
14937 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
14938 ; GFX8-NEXT: .LBB65_1: ; %atomicrmw.start
14939 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
14940 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14941 ; GFX8-NEXT: v_add_f16_sdwa v3, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
14942 ; GFX8-NEXT: v_add_f16_e32 v5, v4, v2
14943 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
14944 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
14945 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14946 ; GFX8-NEXT: buffer_wbinvl1
14947 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
14948 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14949 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
14950 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
14951 ; GFX8-NEXT: s_cbranch_execnz .LBB65_1
14952 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
14953 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
14954 ; GFX8-NEXT: s_setpc_b64 s[30:31]
14956 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_remote_memory:
14958 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
14959 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
14960 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
14961 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
14962 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
14963 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
14964 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14965 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
14966 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
14967 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
14968 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
14969 ; GFX7-NEXT: .LBB65_1: ; %atomicrmw.start
14970 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
14971 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
14972 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
14973 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
14974 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
14975 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
14976 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
14977 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
14978 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
14979 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
14980 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
14981 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
14982 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
14983 ; GFX7-NEXT: flat_atomic_cmpswap v7, v[0:1], v[5:6] glc
14984 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
14985 ; GFX7-NEXT: buffer_wbinvl1
14986 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
14987 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
14988 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
14989 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
14990 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
14991 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
14992 ; GFX7-NEXT: s_cbranch_execnz .LBB65_1
14993 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
14994 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
14995 ; GFX7-NEXT: s_setpc_b64 s[30:31]
14996 %unused = atomicrmw fadd ptr %ptr, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.remote.memory !0
15000 define <2 x half> @flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory(ptr %ptr, <2 x half> %val) #0 {
15001 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15003 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15004 ; GFX12-NEXT: s_wait_expcnt 0x0
15005 ; GFX12-NEXT: s_wait_samplecnt 0x0
15006 ; GFX12-NEXT: s_wait_bvhcnt 0x0
15007 ; GFX12-NEXT: s_wait_kmcnt 0x0
15008 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
15009 ; GFX12-NEXT: s_wait_storecnt 0x0
15010 ; GFX12-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
15011 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15012 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
15013 ; GFX12-NEXT: s_setpc_b64 s[30:31]
15015 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15017 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15018 ; GFX940-NEXT: buffer_wbl2 sc1
15019 ; GFX940-NEXT: flat_atomic_pk_add_f16 v0, v[0:1], v2 sc0
15020 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15021 ; GFX940-NEXT: buffer_inv sc1
15022 ; GFX940-NEXT: s_setpc_b64 s[30:31]
15024 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15026 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15027 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
15028 ; GFX11-NEXT: s_mov_b32 s0, 0
15029 ; GFX11-NEXT: .LBB66_1: ; %atomicrmw.start
15030 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
15031 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15032 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
15033 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
15034 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
15035 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
15036 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
15037 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15038 ; GFX11-NEXT: buffer_gl1_inv
15039 ; GFX11-NEXT: buffer_gl0_inv
15040 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
15041 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
15042 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
15043 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
15044 ; GFX11-NEXT: s_cbranch_execnz .LBB66_1
15045 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
15046 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
15047 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
15048 ; GFX11-NEXT: s_setpc_b64 s[30:31]
15050 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15052 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15053 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
15054 ; GFX10-NEXT: s_mov_b32 s4, 0
15055 ; GFX10-NEXT: .LBB66_1: ; %atomicrmw.start
15056 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
15057 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15058 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
15059 ; GFX10-NEXT: v_pk_add_f16 v3, v4, v2
15060 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
15061 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
15062 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15063 ; GFX10-NEXT: buffer_gl1_inv
15064 ; GFX10-NEXT: buffer_gl0_inv
15065 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
15066 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
15067 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
15068 ; GFX10-NEXT: s_cbranch_execnz .LBB66_1
15069 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
15070 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
15071 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
15072 ; GFX10-NEXT: s_setpc_b64 s[30:31]
15074 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15076 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15077 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
15078 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
15079 ; GFX90A-NEXT: .LBB66_1: ; %atomicrmw.start
15080 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
15081 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15082 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
15083 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
15084 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc
15085 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15086 ; GFX90A-NEXT: buffer_wbinvl1
15087 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
15088 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15089 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
15090 ; GFX90A-NEXT: s_cbranch_execnz .LBB66_1
15091 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
15092 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
15093 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
15094 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
15096 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15098 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15099 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
15100 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
15101 ; GFX908-NEXT: .LBB66_1: ; %atomicrmw.start
15102 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
15103 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15104 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
15105 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
15106 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
15107 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15108 ; GFX908-NEXT: buffer_wbinvl1
15109 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
15110 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15111 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
15112 ; GFX908-NEXT: s_cbranch_execnz .LBB66_1
15113 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
15114 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
15115 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
15116 ; GFX908-NEXT: s_setpc_b64 s[30:31]
15118 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15120 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15121 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
15122 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
15123 ; GFX8-NEXT: .LBB66_1: ; %atomicrmw.start
15124 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
15125 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15126 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
15127 ; GFX8-NEXT: v_add_f16_sdwa v3, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
15128 ; GFX8-NEXT: v_add_f16_e32 v5, v4, v2
15129 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
15130 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
15131 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15132 ; GFX8-NEXT: buffer_wbinvl1
15133 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
15134 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15135 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
15136 ; GFX8-NEXT: s_cbranch_execnz .LBB66_1
15137 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
15138 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
15139 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
15140 ; GFX8-NEXT: s_setpc_b64 s[30:31]
15142 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15144 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15145 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
15146 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
15147 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
15148 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
15149 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v3
15150 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15151 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
15152 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v5
15153 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
15154 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v6
15155 ; GFX7-NEXT: .LBB66_1: ; %atomicrmw.start
15156 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
15157 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
15158 ; GFX7-NEXT: v_cvt_f16_f32_e32 v2, v2
15159 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v3
15160 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v2
15161 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v3
15162 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v4
15163 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v5
15164 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v6
15165 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v7
15166 ; GFX7-NEXT: v_or_b32_e32 v7, v2, v3
15167 ; GFX7-NEXT: v_lshlrev_b32_e32 v2, 16, v6
15168 ; GFX7-NEXT: v_or_b32_e32 v6, v8, v2
15169 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[6:7] glc
15170 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15171 ; GFX7-NEXT: buffer_wbinvl1
15172 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v6
15173 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v6
15174 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v3
15175 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v7
15176 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15177 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
15178 ; GFX7-NEXT: s_cbranch_execnz .LBB66_1
15179 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
15180 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
15181 ; GFX7-NEXT: v_mov_b32_e32 v0, v2
15182 ; GFX7-NEXT: v_mov_b32_e32 v1, v3
15183 ; GFX7-NEXT: s_setpc_b64 s[30:31]
15184 %result = atomicrmw fadd ptr %ptr, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory !0
15185 ret <2 x half> %result
15188 define void @flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory(ptr %ptr, <2 x half> %val) #0 {
15189 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15191 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15192 ; GFX12-NEXT: s_wait_expcnt 0x0
15193 ; GFX12-NEXT: s_wait_samplecnt 0x0
15194 ; GFX12-NEXT: s_wait_bvhcnt 0x0
15195 ; GFX12-NEXT: s_wait_kmcnt 0x0
15196 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
15197 ; GFX12-NEXT: s_wait_storecnt 0x0
15198 ; GFX12-NEXT: flat_atomic_pk_add_f16 v[0:1], v2 scope:SCOPE_DEV
15199 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
15200 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
15201 ; GFX12-NEXT: s_setpc_b64 s[30:31]
15203 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15205 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15206 ; GFX940-NEXT: buffer_wbl2 sc1
15207 ; GFX940-NEXT: flat_atomic_pk_add_f16 v[0:1], v2
15208 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15209 ; GFX940-NEXT: buffer_inv sc1
15210 ; GFX940-NEXT: s_setpc_b64 s[30:31]
15212 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15214 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15215 ; GFX11-NEXT: flat_load_b32 v4, v[0:1]
15216 ; GFX11-NEXT: s_mov_b32 s0, 0
15217 ; GFX11-NEXT: .LBB67_1: ; %atomicrmw.start
15218 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
15219 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15220 ; GFX11-NEXT: v_pk_add_f16 v3, v4, v2
15221 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
15222 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[3:4] glc
15223 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15224 ; GFX11-NEXT: buffer_gl1_inv
15225 ; GFX11-NEXT: buffer_gl0_inv
15226 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
15227 ; GFX11-NEXT: v_mov_b32_e32 v4, v3
15228 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
15229 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
15230 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
15231 ; GFX11-NEXT: s_cbranch_execnz .LBB67_1
15232 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
15233 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s0
15234 ; GFX11-NEXT: s_setpc_b64 s[30:31]
15236 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15238 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15239 ; GFX10-NEXT: flat_load_dword v4, v[0:1]
15240 ; GFX10-NEXT: s_mov_b32 s4, 0
15241 ; GFX10-NEXT: .LBB67_1: ; %atomicrmw.start
15242 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
15243 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15244 ; GFX10-NEXT: v_pk_add_f16 v3, v4, v2
15245 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
15246 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
15247 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15248 ; GFX10-NEXT: buffer_gl1_inv
15249 ; GFX10-NEXT: buffer_gl0_inv
15250 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v4
15251 ; GFX10-NEXT: v_mov_b32_e32 v4, v3
15252 ; GFX10-NEXT: s_or_b32 s4, vcc_lo, s4
15253 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s4
15254 ; GFX10-NEXT: s_cbranch_execnz .LBB67_1
15255 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
15256 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s4
15257 ; GFX10-NEXT: s_setpc_b64 s[30:31]
15259 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15261 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15262 ; GFX90A-NEXT: flat_load_dword v5, v[0:1]
15263 ; GFX90A-NEXT: s_mov_b64 s[4:5], 0
15264 ; GFX90A-NEXT: .LBB67_1: ; %atomicrmw.start
15265 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
15266 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15267 ; GFX90A-NEXT: v_pk_add_f16 v4, v5, v2
15268 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[4:5] glc
15269 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15270 ; GFX90A-NEXT: buffer_wbinvl1
15271 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v5
15272 ; GFX90A-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15273 ; GFX90A-NEXT: v_mov_b32_e32 v5, v3
15274 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[4:5]
15275 ; GFX90A-NEXT: s_cbranch_execnz .LBB67_1
15276 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
15277 ; GFX90A-NEXT: s_or_b64 exec, exec, s[4:5]
15278 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
15280 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15282 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15283 ; GFX908-NEXT: flat_load_dword v4, v[0:1]
15284 ; GFX908-NEXT: s_mov_b64 s[4:5], 0
15285 ; GFX908-NEXT: .LBB67_1: ; %atomicrmw.start
15286 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
15287 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15288 ; GFX908-NEXT: v_pk_add_f16 v3, v4, v2
15289 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
15290 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15291 ; GFX908-NEXT: buffer_wbinvl1
15292 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
15293 ; GFX908-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15294 ; GFX908-NEXT: v_mov_b32_e32 v4, v3
15295 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[4:5]
15296 ; GFX908-NEXT: s_cbranch_execnz .LBB67_1
15297 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
15298 ; GFX908-NEXT: s_or_b64 exec, exec, s[4:5]
15299 ; GFX908-NEXT: s_setpc_b64 s[30:31]
15301 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15303 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15304 ; GFX8-NEXT: flat_load_dword v4, v[0:1]
15305 ; GFX8-NEXT: s_mov_b64 s[4:5], 0
15306 ; GFX8-NEXT: .LBB67_1: ; %atomicrmw.start
15307 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
15308 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15309 ; GFX8-NEXT: v_add_f16_sdwa v3, v4, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
15310 ; GFX8-NEXT: v_add_f16_e32 v5, v4, v2
15311 ; GFX8-NEXT: v_or_b32_e32 v3, v5, v3
15312 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[3:4] glc
15313 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15314 ; GFX8-NEXT: buffer_wbinvl1
15315 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v4
15316 ; GFX8-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15317 ; GFX8-NEXT: v_mov_b32_e32 v4, v3
15318 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[4:5]
15319 ; GFX8-NEXT: s_cbranch_execnz .LBB67_1
15320 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
15321 ; GFX8-NEXT: s_or_b64 exec, exec, s[4:5]
15322 ; GFX8-NEXT: s_setpc_b64 s[30:31]
15324 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2f16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
15326 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15327 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
15328 ; GFX7-NEXT: v_cvt_f16_f32_e32 v3, v3
15329 ; GFX7-NEXT: v_cvt_f16_f32_e32 v6, v2
15330 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
15331 ; GFX7-NEXT: v_cvt_f32_f16_e32 v2, v3
15332 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15333 ; GFX7-NEXT: v_lshrrev_b32_e32 v3, 16, v5
15334 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v5
15335 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v3
15336 ; GFX7-NEXT: v_cvt_f32_f16_e32 v3, v6
15337 ; GFX7-NEXT: .LBB67_1: ; %atomicrmw.start
15338 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
15339 ; GFX7-NEXT: v_cvt_f16_f32_e32 v5, v5
15340 ; GFX7-NEXT: v_cvt_f16_f32_e32 v4, v4
15341 ; GFX7-NEXT: v_cvt_f32_f16_e32 v6, v5
15342 ; GFX7-NEXT: v_cvt_f32_f16_e32 v7, v4
15343 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
15344 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
15345 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
15346 ; GFX7-NEXT: v_cvt_f16_f32_e32 v8, v6
15347 ; GFX7-NEXT: v_cvt_f16_f32_e32 v7, v7
15348 ; GFX7-NEXT: v_or_b32_e32 v6, v4, v5
15349 ; GFX7-NEXT: v_lshlrev_b32_e32 v4, 16, v8
15350 ; GFX7-NEXT: v_or_b32_e32 v5, v7, v4
15351 ; GFX7-NEXT: flat_atomic_cmpswap v7, v[0:1], v[5:6] glc
15352 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15353 ; GFX7-NEXT: buffer_wbinvl1
15354 ; GFX7-NEXT: v_lshrrev_b32_e32 v5, 16, v7
15355 ; GFX7-NEXT: v_cvt_f32_f16_e32 v4, v7
15356 ; GFX7-NEXT: v_cvt_f32_f16_e32 v5, v5
15357 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v7, v6
15358 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15359 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
15360 ; GFX7-NEXT: s_cbranch_execnz .LBB67_1
15361 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
15362 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
15363 ; GFX7-NEXT: s_setpc_b64 s[30:31]
15364 %unused = atomicrmw fadd ptr %ptr, <2 x half> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory !0
15368 ; --------------------------------------------------------------------
15370 ; --------------------------------------------------------------------
15372 define <2 x bfloat> @flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x bfloat> %val) #0 {
15373 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory:
15375 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15376 ; GFX12-NEXT: s_wait_expcnt 0x0
15377 ; GFX12-NEXT: s_wait_samplecnt 0x0
15378 ; GFX12-NEXT: s_wait_bvhcnt 0x0
15379 ; GFX12-NEXT: s_wait_kmcnt 0x0
15380 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
15381 ; GFX12-NEXT: s_wait_storecnt 0x0
15382 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
15383 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15384 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
15385 ; GFX12-NEXT: s_setpc_b64 s[30:31]
15387 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory:
15389 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15390 ; GFX940-NEXT: buffer_wbl2 sc1
15391 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 sc0
15392 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15393 ; GFX940-NEXT: buffer_inv sc1
15394 ; GFX940-NEXT: s_setpc_b64 s[30:31]
15396 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory:
15398 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15399 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
15400 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15401 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15402 ; GFX11-NEXT: s_mov_b32 s1, 0
15403 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
15404 ; GFX11-NEXT: .p2align 6
15405 ; GFX11-NEXT: .LBB68_1: ; %atomicrmw.start
15406 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
15407 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15408 ; GFX11-NEXT: v_mov_b32_e32 v6, v3
15409 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
15410 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15411 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
15412 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v6
15413 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15414 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
15415 ; GFX11-NEXT: v_add_f32_e32 v3, v3, v4
15416 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
15417 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
15418 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
15419 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
15420 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
15421 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v3
15422 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v3, v3
15423 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
15424 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
15425 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
15426 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
15427 ; GFX11-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
15428 ; GFX11-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
15429 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
15430 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[5:6] glc
15431 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15432 ; GFX11-NEXT: buffer_gl1_inv
15433 ; GFX11-NEXT: buffer_gl0_inv
15434 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
15435 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
15436 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
15437 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
15438 ; GFX11-NEXT: s_cbranch_execnz .LBB68_1
15439 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
15440 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
15441 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
15442 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
15443 ; GFX11-NEXT: s_setpc_b64 s[30:31]
15445 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory:
15447 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15448 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
15449 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15450 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15451 ; GFX10-NEXT: s_mov_b32 s5, 0
15452 ; GFX10-NEXT: .LBB68_1: ; %atomicrmw.start
15453 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
15454 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15455 ; GFX10-NEXT: v_mov_b32_e32 v6, v3
15456 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v6
15457 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15458 ; GFX10-NEXT: v_add_f32_e32 v3, v3, v4
15459 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
15460 ; GFX10-NEXT: v_bfe_u32 v7, v3, 16, 1
15461 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
15462 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v3
15463 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
15464 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
15465 ; GFX10-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
15466 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
15467 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v3, v3
15468 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
15469 ; GFX10-NEXT: v_cndmask_b32_e64 v3, v7, v9, s4
15470 ; GFX10-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
15471 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
15472 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
15473 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15474 ; GFX10-NEXT: buffer_gl1_inv
15475 ; GFX10-NEXT: buffer_gl0_inv
15476 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
15477 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
15478 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
15479 ; GFX10-NEXT: s_cbranch_execnz .LBB68_1
15480 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
15481 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
15482 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
15483 ; GFX10-NEXT: s_setpc_b64 s[30:31]
15485 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory:
15487 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15488 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
15489 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
15490 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15491 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
15492 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15493 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
15494 ; GFX90A-NEXT: .LBB68_1: ; %atomicrmw.start
15495 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
15496 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15497 ; GFX90A-NEXT: v_mov_b32_e32 v7, v3
15498 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v7
15499 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
15500 ; GFX90A-NEXT: v_add_f32_e32 v3, v3, v4
15501 ; GFX90A-NEXT: v_add_f32_e32 v5, v5, v2
15502 ; GFX90A-NEXT: v_bfe_u32 v6, v3, 16, 1
15503 ; GFX90A-NEXT: v_bfe_u32 v9, v5, 16, 1
15504 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v3
15505 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v5
15506 ; GFX90A-NEXT: v_add3_u32 v6, v6, v3, s8
15507 ; GFX90A-NEXT: v_add3_u32 v9, v9, v5, s8
15508 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
15509 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
15510 ; GFX90A-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[4:5]
15511 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
15512 ; GFX90A-NEXT: v_perm_b32 v6, v5, v3, s9
15513 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[6:7] glc
15514 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15515 ; GFX90A-NEXT: buffer_wbinvl1
15516 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
15517 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15518 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
15519 ; GFX90A-NEXT: s_cbranch_execnz .LBB68_1
15520 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
15521 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
15522 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
15523 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
15525 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory:
15527 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15528 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
15529 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
15530 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15531 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
15532 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15533 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
15534 ; GFX908-NEXT: .LBB68_1: ; %atomicrmw.start
15535 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
15536 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15537 ; GFX908-NEXT: v_mov_b32_e32 v6, v3
15538 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v6
15539 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15540 ; GFX908-NEXT: v_add_f32_e32 v3, v3, v4
15541 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
15542 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
15543 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
15544 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
15545 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
15546 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s8
15547 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
15548 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
15549 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
15550 ; GFX908-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
15551 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
15552 ; GFX908-NEXT: v_perm_b32 v5, v5, v3, s9
15553 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
15554 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15555 ; GFX908-NEXT: buffer_wbinvl1
15556 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
15557 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15558 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
15559 ; GFX908-NEXT: s_cbranch_execnz .LBB68_1
15560 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
15561 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
15562 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
15563 ; GFX908-NEXT: s_setpc_b64 s[30:31]
15565 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory:
15567 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15568 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
15569 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
15570 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15571 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15572 ; GFX8-NEXT: .LBB68_1: ; %atomicrmw.start
15573 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
15574 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15575 ; GFX8-NEXT: v_mov_b32_e32 v6, v3
15576 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 16, v6
15577 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15578 ; GFX8-NEXT: v_add_f32_e32 v3, v3, v4
15579 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
15580 ; GFX8-NEXT: v_bfe_u32 v7, v3, 16, 1
15581 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
15582 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v3
15583 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
15584 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
15585 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
15586 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
15587 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
15588 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v3
15589 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
15590 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
15591 ; GFX8-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
15592 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
15593 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v3, 16
15594 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
15595 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15596 ; GFX8-NEXT: buffer_wbinvl1
15597 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
15598 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15599 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
15600 ; GFX8-NEXT: s_cbranch_execnz .LBB68_1
15601 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
15602 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
15603 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
15604 ; GFX8-NEXT: s_setpc_b64 s[30:31]
15606 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory:
15608 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15609 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
15610 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
15611 ; GFX7-NEXT: v_mul_f32_e32 v6, 1.0, v3
15612 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
15613 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v2
15614 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15615 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v5
15616 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
15617 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15618 ; GFX7-NEXT: .LBB68_1: ; %atomicrmw.start
15619 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
15620 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
15621 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
15622 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v2
15623 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
15624 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
15625 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v5
15626 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v4
15627 ; GFX7-NEXT: v_alignbit_b32 v3, v2, v3, 16
15628 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v7
15629 ; GFX7-NEXT: v_alignbit_b32 v2, v2, v6, 16
15630 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[2:3] glc
15631 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15632 ; GFX7-NEXT: buffer_wbinvl1
15633 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v3
15634 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
15635 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15636 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v6
15637 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
15638 ; GFX7-NEXT: s_cbranch_execnz .LBB68_1
15639 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
15640 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
15641 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
15642 ; GFX7-NEXT: v_mov_b32_e32 v1, v2
15643 ; GFX7-NEXT: s_setpc_b64 s[30:31]
15644 %result = atomicrmw fadd ptr %ptr, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
15645 ret <2 x bfloat> %result
15648 define <2 x bfloat> @flat_agent_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x bfloat> %val) #0 {
15649 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
15651 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15652 ; GFX12-NEXT: s_wait_expcnt 0x0
15653 ; GFX12-NEXT: s_wait_samplecnt 0x0
15654 ; GFX12-NEXT: s_wait_bvhcnt 0x0
15655 ; GFX12-NEXT: s_wait_kmcnt 0x0
15656 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
15657 ; GFX12-NEXT: s_wait_storecnt 0x0
15658 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
15659 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15660 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
15661 ; GFX12-NEXT: s_setpc_b64 s[30:31]
15663 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
15665 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15666 ; GFX940-NEXT: buffer_wbl2 sc1
15667 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 offset:2044 sc0
15668 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15669 ; GFX940-NEXT: buffer_inv sc1
15670 ; GFX940-NEXT: s_setpc_b64 s[30:31]
15672 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
15674 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15675 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2044
15676 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15677 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15678 ; GFX11-NEXT: s_mov_b32 s1, 0
15679 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
15680 ; GFX11-NEXT: .p2align 6
15681 ; GFX11-NEXT: .LBB69_1: ; %atomicrmw.start
15682 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
15683 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15684 ; GFX11-NEXT: v_mov_b32_e32 v6, v3
15685 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
15686 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15687 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
15688 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v6
15689 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15690 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
15691 ; GFX11-NEXT: v_add_f32_e32 v3, v3, v4
15692 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
15693 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
15694 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
15695 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
15696 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
15697 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v3
15698 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v3, v3
15699 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
15700 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
15701 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
15702 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
15703 ; GFX11-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
15704 ; GFX11-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
15705 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
15706 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[5:6] offset:2044 glc
15707 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15708 ; GFX11-NEXT: buffer_gl1_inv
15709 ; GFX11-NEXT: buffer_gl0_inv
15710 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
15711 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
15712 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
15713 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
15714 ; GFX11-NEXT: s_cbranch_execnz .LBB69_1
15715 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
15716 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
15717 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
15718 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
15719 ; GFX11-NEXT: s_setpc_b64 s[30:31]
15721 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
15723 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15724 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fc, v0
15725 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
15726 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 16, v2
15727 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15728 ; GFX10-NEXT: s_mov_b32 s5, 0
15729 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
15730 ; GFX10-NEXT: .LBB69_1: ; %atomicrmw.start
15731 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
15732 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15733 ; GFX10-NEXT: v_mov_b32_e32 v6, v0
15734 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 16, v6
15735 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15736 ; GFX10-NEXT: v_add_f32_e32 v0, v0, v1
15737 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
15738 ; GFX10-NEXT: v_bfe_u32 v7, v0, 16, 1
15739 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
15740 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v0
15741 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
15742 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
15743 ; GFX10-NEXT: v_add3_u32 v7, v7, v0, 0x7fff
15744 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
15745 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v0, v0
15746 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
15747 ; GFX10-NEXT: v_cndmask_b32_e64 v0, v7, v9, s4
15748 ; GFX10-NEXT: v_perm_b32 v5, v5, v0, 0x7060302
15749 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
15750 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
15751 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15752 ; GFX10-NEXT: buffer_gl1_inv
15753 ; GFX10-NEXT: buffer_gl0_inv
15754 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v6
15755 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
15756 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
15757 ; GFX10-NEXT: s_cbranch_execnz .LBB69_1
15758 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
15759 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
15760 ; GFX10-NEXT: s_setpc_b64 s[30:31]
15762 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
15764 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15765 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2044
15766 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
15767 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15768 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
15769 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15770 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
15771 ; GFX90A-NEXT: .LBB69_1: ; %atomicrmw.start
15772 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
15773 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15774 ; GFX90A-NEXT: v_mov_b32_e32 v7, v3
15775 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v7
15776 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
15777 ; GFX90A-NEXT: v_add_f32_e32 v3, v3, v4
15778 ; GFX90A-NEXT: v_add_f32_e32 v5, v5, v2
15779 ; GFX90A-NEXT: v_bfe_u32 v6, v3, 16, 1
15780 ; GFX90A-NEXT: v_bfe_u32 v9, v5, 16, 1
15781 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v3
15782 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v5
15783 ; GFX90A-NEXT: v_add3_u32 v6, v6, v3, s8
15784 ; GFX90A-NEXT: v_add3_u32 v9, v9, v5, s8
15785 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
15786 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
15787 ; GFX90A-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[4:5]
15788 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
15789 ; GFX90A-NEXT: v_perm_b32 v6, v5, v3, s9
15790 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[6:7] offset:2044 glc
15791 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15792 ; GFX90A-NEXT: buffer_wbinvl1
15793 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
15794 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15795 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
15796 ; GFX90A-NEXT: s_cbranch_execnz .LBB69_1
15797 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
15798 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
15799 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
15800 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
15802 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
15804 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15805 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
15806 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
15807 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
15808 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
15809 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15810 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
15811 ; GFX908-NEXT: .LBB69_1: ; %atomicrmw.start
15812 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
15813 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15814 ; GFX908-NEXT: v_mov_b32_e32 v6, v3
15815 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v6
15816 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15817 ; GFX908-NEXT: v_add_f32_e32 v3, v3, v4
15818 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
15819 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
15820 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
15821 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
15822 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
15823 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s8
15824 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
15825 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
15826 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
15827 ; GFX908-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
15828 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
15829 ; GFX908-NEXT: v_perm_b32 v5, v5, v3, s9
15830 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] offset:2044 glc
15831 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15832 ; GFX908-NEXT: buffer_wbinvl1
15833 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
15834 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15835 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
15836 ; GFX908-NEXT: s_cbranch_execnz .LBB69_1
15837 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
15838 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
15839 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
15840 ; GFX908-NEXT: s_setpc_b64 s[30:31]
15842 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
15844 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15845 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
15846 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
15847 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
15848 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
15849 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 16, v2
15850 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15851 ; GFX8-NEXT: .LBB69_1: ; %atomicrmw.start
15852 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
15853 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15854 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
15855 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v6
15856 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15857 ; GFX8-NEXT: v_add_f32_e32 v0, v0, v1
15858 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
15859 ; GFX8-NEXT: v_bfe_u32 v7, v0, 16, 1
15860 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
15861 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v0
15862 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
15863 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
15864 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
15865 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
15866 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
15867 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v0
15868 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
15869 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
15870 ; GFX8-NEXT: v_cndmask_b32_e64 v0, v7, v8, s[4:5]
15871 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
15872 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v0, 16
15873 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
15874 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15875 ; GFX8-NEXT: buffer_wbinvl1
15876 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
15877 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
15878 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
15879 ; GFX8-NEXT: s_cbranch_execnz .LBB69_1
15880 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
15881 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
15882 ; GFX8-NEXT: s_setpc_b64 s[30:31]
15884 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
15886 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15887 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fc, v0
15888 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
15889 ; GFX7-NEXT: flat_load_dword v0, v[4:5]
15890 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v2
15891 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
15892 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
15893 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v1
15894 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
15895 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15896 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v0
15897 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
15898 ; GFX7-NEXT: .LBB69_1: ; %atomicrmw.start
15899 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
15900 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v1
15901 ; GFX7-NEXT: v_mul_f32_e32 v0, 1.0, v0
15902 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v1
15903 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v0
15904 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
15905 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
15906 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
15907 ; GFX7-NEXT: v_alignbit_b32 v1, v1, v0, 16
15908 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, 16, v7
15909 ; GFX7-NEXT: v_alignbit_b32 v0, v0, v6, 16
15910 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[4:5], v[0:1] glc
15911 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15912 ; GFX7-NEXT: buffer_wbinvl1
15913 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
15914 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v0
15915 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
15916 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
15917 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
15918 ; GFX7-NEXT: s_cbranch_execnz .LBB69_1
15919 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
15920 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
15921 ; GFX7-NEXT: s_setpc_b64 s[30:31]
15922 %gep = getelementptr <2 x bfloat>, ptr %ptr, i64 511
15923 %result = atomicrmw fadd ptr %gep, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
15924 ret <2 x bfloat> %result
15927 define <2 x bfloat> @flat_agent_atomic_fadd_ret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x bfloat> %val) #0 {
15928 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
15930 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15931 ; GFX12-NEXT: s_wait_expcnt 0x0
15932 ; GFX12-NEXT: s_wait_samplecnt 0x0
15933 ; GFX12-NEXT: s_wait_bvhcnt 0x0
15934 ; GFX12-NEXT: s_wait_kmcnt 0x0
15935 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
15936 ; GFX12-NEXT: s_wait_storecnt 0x0
15937 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 offset:-2048 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
15938 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
15939 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
15940 ; GFX12-NEXT: s_setpc_b64 s[30:31]
15942 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
15944 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15945 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
15946 ; GFX940-NEXT: s_nop 1
15947 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
15948 ; GFX940-NEXT: buffer_wbl2 sc1
15949 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 sc0
15950 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15951 ; GFX940-NEXT: buffer_inv sc1
15952 ; GFX940-NEXT: s_setpc_b64 s[30:31]
15954 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
15956 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
15957 ; GFX11-NEXT: v_mov_b32_e32 v3, v0
15958 ; GFX11-NEXT: s_mov_b32 s1, 0
15959 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
15960 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0xfffff800, v3
15961 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, -1, v1, vcc_lo
15962 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v3
15963 ; GFX11-NEXT: flat_load_b32 v0, v[4:5]
15964 ; GFX11-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, -1, v1, vcc_lo
15965 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 16, v2
15966 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
15967 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
15968 ; GFX11-NEXT: .p2align 6
15969 ; GFX11-NEXT: .LBB70_1: ; %atomicrmw.start
15970 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
15971 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15972 ; GFX11-NEXT: v_mov_b32_e32 v6, v0
15973 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
15974 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
15975 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
15976 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 16, v6
15977 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
15978 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
15979 ; GFX11-NEXT: v_add_f32_e32 v0, v0, v1
15980 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
15981 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
15982 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
15983 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
15984 ; GFX11-NEXT: v_bfe_u32 v7, v0, 16, 1
15985 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v0
15986 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v0, v0
15987 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
15988 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
15989 ; GFX11-NEXT: v_add3_u32 v7, v7, v0, 0x7fff
15990 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
15991 ; GFX11-NEXT: v_cndmask_b32_e64 v0, v7, v9, s0
15992 ; GFX11-NEXT: v_perm_b32 v5, v5, v0, 0x7060302
15993 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
15994 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v0, v[3:4], v[5:6] glc
15995 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
15996 ; GFX11-NEXT: buffer_gl1_inv
15997 ; GFX11-NEXT: buffer_gl0_inv
15998 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v6
15999 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
16000 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
16001 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
16002 ; GFX11-NEXT: s_cbranch_execnz .LBB70_1
16003 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
16004 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
16005 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
16006 ; GFX11-NEXT: s_setpc_b64 s[30:31]
16008 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16010 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16011 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
16012 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, -1, v1, vcc_lo
16013 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 16, v2
16014 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16015 ; GFX10-NEXT: s_mov_b32 s5, 0
16016 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
16017 ; GFX10-NEXT: .LBB70_1: ; %atomicrmw.start
16018 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
16019 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16020 ; GFX10-NEXT: v_mov_b32_e32 v6, v0
16021 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 16, v6
16022 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16023 ; GFX10-NEXT: v_add_f32_e32 v0, v0, v1
16024 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
16025 ; GFX10-NEXT: v_bfe_u32 v7, v0, 16, 1
16026 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
16027 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v0
16028 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
16029 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
16030 ; GFX10-NEXT: v_add3_u32 v7, v7, v0, 0x7fff
16031 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
16032 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v0, v0
16033 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
16034 ; GFX10-NEXT: v_cndmask_b32_e64 v0, v7, v9, s4
16035 ; GFX10-NEXT: v_perm_b32 v5, v5, v0, 0x7060302
16036 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
16037 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
16038 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16039 ; GFX10-NEXT: buffer_gl1_inv
16040 ; GFX10-NEXT: buffer_gl0_inv
16041 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v6
16042 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
16043 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
16044 ; GFX10-NEXT: s_cbranch_execnz .LBB70_1
16045 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
16046 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
16047 ; GFX10-NEXT: s_setpc_b64 s[30:31]
16049 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16051 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16052 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
16053 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, -1, v1, vcc
16054 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
16055 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
16056 ; GFX90A-NEXT: flat_load_dword v0, v[0:1]
16057 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
16058 ; GFX90A-NEXT: v_lshlrev_b32_e32 v1, 16, v2
16059 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
16060 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16061 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
16062 ; GFX90A-NEXT: .LBB70_1: ; %atomicrmw.start
16063 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
16064 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16065 ; GFX90A-NEXT: v_mov_b32_e32 v7, v0
16066 ; GFX90A-NEXT: v_lshlrev_b32_e32 v0, 16, v7
16067 ; GFX90A-NEXT: v_and_b32_e32 v3, 0xffff0000, v7
16068 ; GFX90A-NEXT: v_add_f32_e32 v0, v0, v1
16069 ; GFX90A-NEXT: v_add_f32_e32 v3, v3, v2
16070 ; GFX90A-NEXT: v_bfe_u32 v6, v0, 16, 1
16071 ; GFX90A-NEXT: v_bfe_u32 v9, v3, 16, 1
16072 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v0
16073 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v3
16074 ; GFX90A-NEXT: v_add3_u32 v6, v6, v0, s8
16075 ; GFX90A-NEXT: v_add3_u32 v9, v9, v3, s8
16076 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v3, v3
16077 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
16078 ; GFX90A-NEXT: v_cndmask_b32_e64 v0, v6, v8, s[4:5]
16079 ; GFX90A-NEXT: v_cndmask_b32_e32 v3, v9, v10, vcc
16080 ; GFX90A-NEXT: v_perm_b32 v6, v3, v0, s9
16081 ; GFX90A-NEXT: flat_atomic_cmpswap v0, v[4:5], v[6:7] glc
16082 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16083 ; GFX90A-NEXT: buffer_wbinvl1
16084 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v0, v7
16085 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16086 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
16087 ; GFX90A-NEXT: s_cbranch_execnz .LBB70_1
16088 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
16089 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
16090 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
16092 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16094 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16095 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
16096 ; GFX908-NEXT: v_addc_co_u32_e32 v4, vcc, -1, v1, vcc
16097 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
16098 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
16099 ; GFX908-NEXT: flat_load_dword v0, v[0:1]
16100 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
16101 ; GFX908-NEXT: v_lshlrev_b32_e32 v1, 16, v2
16102 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
16103 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16104 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
16105 ; GFX908-NEXT: .LBB70_1: ; %atomicrmw.start
16106 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
16107 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16108 ; GFX908-NEXT: v_mov_b32_e32 v6, v0
16109 ; GFX908-NEXT: v_lshlrev_b32_e32 v0, 16, v6
16110 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16111 ; GFX908-NEXT: v_add_f32_e32 v0, v0, v1
16112 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
16113 ; GFX908-NEXT: v_bfe_u32 v7, v0, 16, 1
16114 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
16115 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v0
16116 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
16117 ; GFX908-NEXT: v_add3_u32 v7, v7, v0, s8
16118 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
16119 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
16120 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
16121 ; GFX908-NEXT: v_cndmask_b32_e64 v0, v7, v8, s[4:5]
16122 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
16123 ; GFX908-NEXT: v_perm_b32 v5, v5, v0, s9
16124 ; GFX908-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
16125 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16126 ; GFX908-NEXT: buffer_wbinvl1
16127 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
16128 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16129 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
16130 ; GFX908-NEXT: s_cbranch_execnz .LBB70_1
16131 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
16132 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
16133 ; GFX908-NEXT: s_setpc_b64 s[30:31]
16135 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16137 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16138 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0xfffff800, v0
16139 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v1, vcc
16140 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
16141 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
16142 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 16, v2
16143 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16144 ; GFX8-NEXT: .LBB70_1: ; %atomicrmw.start
16145 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
16146 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16147 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
16148 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v6
16149 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
16150 ; GFX8-NEXT: v_add_f32_e32 v0, v0, v1
16151 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
16152 ; GFX8-NEXT: v_bfe_u32 v7, v0, 16, 1
16153 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
16154 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v0
16155 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
16156 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
16157 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
16158 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
16159 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
16160 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v0
16161 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
16162 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
16163 ; GFX8-NEXT: v_cndmask_b32_e64 v0, v7, v8, s[4:5]
16164 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
16165 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v0, 16
16166 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
16167 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16168 ; GFX8-NEXT: buffer_wbinvl1
16169 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
16170 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16171 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
16172 ; GFX8-NEXT: s_cbranch_execnz .LBB70_1
16173 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
16174 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
16175 ; GFX8-NEXT: s_setpc_b64 s[30:31]
16177 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16179 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16180 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0xfffff800, v0
16181 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, -1, v1, vcc
16182 ; GFX7-NEXT: flat_load_dword v0, v[4:5]
16183 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v2
16184 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
16185 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
16186 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v1
16187 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
16188 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16189 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v0
16190 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
16191 ; GFX7-NEXT: .LBB70_1: ; %atomicrmw.start
16192 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
16193 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v1
16194 ; GFX7-NEXT: v_mul_f32_e32 v0, 1.0, v0
16195 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v1
16196 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v0
16197 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
16198 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
16199 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
16200 ; GFX7-NEXT: v_alignbit_b32 v1, v1, v0, 16
16201 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, 16, v7
16202 ; GFX7-NEXT: v_alignbit_b32 v0, v0, v6, 16
16203 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[4:5], v[0:1] glc
16204 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16205 ; GFX7-NEXT: buffer_wbinvl1
16206 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
16207 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v0
16208 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
16209 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
16210 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
16211 ; GFX7-NEXT: s_cbranch_execnz .LBB70_1
16212 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
16213 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
16214 ; GFX7-NEXT: s_setpc_b64 s[30:31]
16215 %gep = getelementptr <2 x bfloat>, ptr %ptr, i64 -512
16216 %result = atomicrmw fadd ptr %gep, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
16217 ret <2 x bfloat> %result
16220 define void @flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x bfloat> %val) #0 {
16221 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory:
16223 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
16224 ; GFX12-NEXT: s_wait_expcnt 0x0
16225 ; GFX12-NEXT: s_wait_samplecnt 0x0
16226 ; GFX12-NEXT: s_wait_bvhcnt 0x0
16227 ; GFX12-NEXT: s_wait_kmcnt 0x0
16228 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
16229 ; GFX12-NEXT: s_wait_storecnt 0x0
16230 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2 scope:SCOPE_DEV
16231 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
16232 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
16233 ; GFX12-NEXT: s_setpc_b64 s[30:31]
16235 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory:
16237 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16238 ; GFX940-NEXT: buffer_wbl2 sc1
16239 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2
16240 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16241 ; GFX940-NEXT: buffer_inv sc1
16242 ; GFX940-NEXT: s_setpc_b64 s[30:31]
16244 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory:
16246 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16247 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
16248 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16249 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16250 ; GFX11-NEXT: s_mov_b32 s1, 0
16251 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
16252 ; GFX11-NEXT: .p2align 6
16253 ; GFX11-NEXT: .LBB71_1: ; %atomicrmw.start
16254 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
16255 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16256 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16257 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16258 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16259 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v4
16260 ; GFX11-NEXT: v_add_f32_e32 v6, v6, v5
16261 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16262 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
16263 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
16264 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
16265 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
16266 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
16267 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
16268 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
16269 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
16270 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16271 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
16272 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
16273 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
16274 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
16275 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
16276 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] glc
16277 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16278 ; GFX11-NEXT: buffer_gl1_inv
16279 ; GFX11-NEXT: buffer_gl0_inv
16280 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
16281 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
16282 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
16283 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
16284 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
16285 ; GFX11-NEXT: s_cbranch_execnz .LBB71_1
16286 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
16287 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
16288 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
16289 ; GFX11-NEXT: s_setpc_b64 s[30:31]
16291 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory:
16293 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16294 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
16295 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16296 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16297 ; GFX10-NEXT: s_mov_b32 s5, 0
16298 ; GFX10-NEXT: .LBB71_1: ; %atomicrmw.start
16299 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
16300 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16301 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16302 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16303 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v4
16304 ; GFX10-NEXT: v_add_f32_e32 v6, v6, v5
16305 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
16306 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
16307 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
16308 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
16309 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
16310 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
16311 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
16312 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
16313 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
16314 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
16315 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
16316 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
16317 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
16318 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16319 ; GFX10-NEXT: buffer_gl1_inv
16320 ; GFX10-NEXT: buffer_gl0_inv
16321 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
16322 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
16323 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
16324 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
16325 ; GFX10-NEXT: s_cbranch_execnz .LBB71_1
16326 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
16327 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
16328 ; GFX10-NEXT: s_setpc_b64 s[30:31]
16330 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory:
16332 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16333 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
16334 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
16335 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16336 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
16337 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16338 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
16339 ; GFX90A-NEXT: .LBB71_1: ; %atomicrmw.start
16340 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
16341 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16342 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16343 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16344 ; GFX90A-NEXT: v_add_f32_e32 v2, v2, v4
16345 ; GFX90A-NEXT: v_add_f32_e32 v6, v6, v5
16346 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
16347 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
16348 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
16349 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
16350 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s8
16351 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
16352 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16353 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16354 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16355 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16356 ; GFX90A-NEXT: v_perm_b32 v2, v6, v2, s9
16357 ; GFX90A-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
16358 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16359 ; GFX90A-NEXT: buffer_wbinvl1
16360 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16361 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16362 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
16363 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
16364 ; GFX90A-NEXT: s_cbranch_execnz .LBB71_1
16365 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
16366 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
16367 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
16369 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory:
16371 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16372 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
16373 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
16374 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16375 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
16376 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16377 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
16378 ; GFX908-NEXT: .LBB71_1: ; %atomicrmw.start
16379 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
16380 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16381 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16382 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16383 ; GFX908-NEXT: v_add_f32_e32 v2, v2, v4
16384 ; GFX908-NEXT: v_add_f32_e32 v6, v6, v5
16385 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
16386 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
16387 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
16388 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
16389 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s8
16390 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
16391 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16392 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16393 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16394 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16395 ; GFX908-NEXT: v_perm_b32 v2, v6, v2, s9
16396 ; GFX908-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
16397 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16398 ; GFX908-NEXT: buffer_wbinvl1
16399 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16400 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16401 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
16402 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
16403 ; GFX908-NEXT: s_cbranch_execnz .LBB71_1
16404 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
16405 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
16406 ; GFX908-NEXT: s_setpc_b64 s[30:31]
16408 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory:
16410 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16411 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
16412 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
16413 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16414 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16415 ; GFX8-NEXT: .LBB71_1: ; %atomicrmw.start
16416 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
16417 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16418 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16419 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16420 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v4
16421 ; GFX8-NEXT: v_add_f32_e32 v6, v6, v5
16422 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
16423 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
16424 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
16425 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
16426 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
16427 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
16428 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
16429 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16430 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
16431 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16432 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16433 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16434 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
16435 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
16436 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
16437 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16438 ; GFX8-NEXT: buffer_wbinvl1
16439 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16440 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16441 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
16442 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
16443 ; GFX8-NEXT: s_cbranch_execnz .LBB71_1
16444 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
16445 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
16446 ; GFX8-NEXT: s_setpc_b64 s[30:31]
16448 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory:
16450 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16451 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
16452 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
16453 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
16454 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
16455 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16456 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
16457 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16458 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
16459 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
16460 ; GFX7-NEXT: .LBB71_1: ; %atomicrmw.start
16461 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
16462 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
16463 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
16464 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
16465 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
16466 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
16467 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
16468 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
16469 ; GFX7-NEXT: v_alignbit_b32 v5, v4, v5, 16
16470 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v7
16471 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v6, 16
16472 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[4:5] glc
16473 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16474 ; GFX7-NEXT: buffer_wbinvl1
16475 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
16476 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v6
16477 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
16478 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v6
16479 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
16480 ; GFX7-NEXT: s_cbranch_execnz .LBB71_1
16481 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
16482 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
16483 ; GFX7-NEXT: s_setpc_b64 s[30:31]
16484 %unused = atomicrmw fadd ptr %ptr, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
16488 define void @flat_agent_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x bfloat> %val) #0 {
16489 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
16491 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
16492 ; GFX12-NEXT: s_wait_expcnt 0x0
16493 ; GFX12-NEXT: s_wait_samplecnt 0x0
16494 ; GFX12-NEXT: s_wait_bvhcnt 0x0
16495 ; GFX12-NEXT: s_wait_kmcnt 0x0
16496 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
16497 ; GFX12-NEXT: s_wait_storecnt 0x0
16498 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2 offset:2044 scope:SCOPE_DEV
16499 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
16500 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
16501 ; GFX12-NEXT: s_setpc_b64 s[30:31]
16503 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
16505 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16506 ; GFX940-NEXT: buffer_wbl2 sc1
16507 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2 offset:2044
16508 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16509 ; GFX940-NEXT: buffer_inv sc1
16510 ; GFX940-NEXT: s_setpc_b64 s[30:31]
16512 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
16514 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16515 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2044
16516 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16517 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16518 ; GFX11-NEXT: s_mov_b32 s1, 0
16519 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
16520 ; GFX11-NEXT: .p2align 6
16521 ; GFX11-NEXT: .LBB72_1: ; %atomicrmw.start
16522 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
16523 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16524 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16525 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16526 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16527 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v4
16528 ; GFX11-NEXT: v_add_f32_e32 v6, v6, v5
16529 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16530 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
16531 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
16532 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
16533 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
16534 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
16535 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
16536 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
16537 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
16538 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16539 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
16540 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
16541 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
16542 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
16543 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
16544 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:2044 glc
16545 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16546 ; GFX11-NEXT: buffer_gl1_inv
16547 ; GFX11-NEXT: buffer_gl0_inv
16548 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
16549 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
16550 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
16551 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
16552 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
16553 ; GFX11-NEXT: s_cbranch_execnz .LBB72_1
16554 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
16555 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
16556 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
16557 ; GFX11-NEXT: s_setpc_b64 s[30:31]
16559 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
16561 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16562 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
16563 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
16564 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16565 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16566 ; GFX10-NEXT: s_mov_b32 s5, 0
16567 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
16568 ; GFX10-NEXT: .LBB72_1: ; %atomicrmw.start
16569 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
16570 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16571 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16572 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16573 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v4
16574 ; GFX10-NEXT: v_add_f32_e32 v6, v6, v5
16575 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
16576 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
16577 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
16578 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
16579 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
16580 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
16581 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
16582 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
16583 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
16584 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
16585 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
16586 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
16587 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
16588 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16589 ; GFX10-NEXT: buffer_gl1_inv
16590 ; GFX10-NEXT: buffer_gl0_inv
16591 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
16592 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
16593 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
16594 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
16595 ; GFX10-NEXT: s_cbranch_execnz .LBB72_1
16596 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
16597 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
16598 ; GFX10-NEXT: s_setpc_b64 s[30:31]
16600 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
16602 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16603 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2044
16604 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
16605 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16606 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
16607 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16608 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
16609 ; GFX90A-NEXT: .LBB72_1: ; %atomicrmw.start
16610 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
16611 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16612 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16613 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16614 ; GFX90A-NEXT: v_add_f32_e32 v2, v2, v4
16615 ; GFX90A-NEXT: v_add_f32_e32 v6, v6, v5
16616 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
16617 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
16618 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
16619 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
16620 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s8
16621 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
16622 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16623 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16624 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16625 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16626 ; GFX90A-NEXT: v_perm_b32 v2, v6, v2, s9
16627 ; GFX90A-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:2044 glc
16628 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16629 ; GFX90A-NEXT: buffer_wbinvl1
16630 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16631 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16632 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
16633 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
16634 ; GFX90A-NEXT: s_cbranch_execnz .LBB72_1
16635 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
16636 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
16637 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
16639 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
16641 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16642 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
16643 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
16644 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16645 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
16646 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16647 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
16648 ; GFX908-NEXT: .LBB72_1: ; %atomicrmw.start
16649 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
16650 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16651 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16652 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16653 ; GFX908-NEXT: v_add_f32_e32 v2, v2, v4
16654 ; GFX908-NEXT: v_add_f32_e32 v6, v6, v5
16655 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
16656 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
16657 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
16658 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
16659 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s8
16660 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
16661 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16662 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16663 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16664 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16665 ; GFX908-NEXT: v_perm_b32 v2, v6, v2, s9
16666 ; GFX908-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:2044 glc
16667 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16668 ; GFX908-NEXT: buffer_wbinvl1
16669 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16670 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16671 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
16672 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
16673 ; GFX908-NEXT: s_cbranch_execnz .LBB72_1
16674 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
16675 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
16676 ; GFX908-NEXT: s_setpc_b64 s[30:31]
16678 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
16680 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16681 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
16682 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
16683 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
16684 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
16685 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16686 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16687 ; GFX8-NEXT: .LBB72_1: ; %atomicrmw.start
16688 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
16689 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16690 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16691 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16692 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v4
16693 ; GFX8-NEXT: v_add_f32_e32 v6, v6, v5
16694 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
16695 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
16696 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
16697 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
16698 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
16699 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
16700 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
16701 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16702 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
16703 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16704 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16705 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16706 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
16707 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
16708 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
16709 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16710 ; GFX8-NEXT: buffer_wbinvl1
16711 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
16712 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16713 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
16714 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
16715 ; GFX8-NEXT: s_cbranch_execnz .LBB72_1
16716 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
16717 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
16718 ; GFX8-NEXT: s_setpc_b64 s[30:31]
16720 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
16722 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16723 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
16724 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
16725 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
16726 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
16727 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
16728 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
16729 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16730 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
16731 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16732 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
16733 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
16734 ; GFX7-NEXT: .LBB72_1: ; %atomicrmw.start
16735 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
16736 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
16737 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
16738 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
16739 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
16740 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
16741 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
16742 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
16743 ; GFX7-NEXT: v_alignbit_b32 v5, v4, v5, 16
16744 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v7
16745 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v6, 16
16746 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[4:5] glc
16747 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16748 ; GFX7-NEXT: buffer_wbinvl1
16749 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
16750 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v6
16751 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
16752 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v6
16753 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
16754 ; GFX7-NEXT: s_cbranch_execnz .LBB72_1
16755 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
16756 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
16757 ; GFX7-NEXT: s_setpc_b64 s[30:31]
16758 %gep = getelementptr <2 x bfloat>, ptr %ptr, i64 511
16759 %unused = atomicrmw fadd ptr %gep, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
16763 define void @flat_agent_atomic_fadd_noret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x bfloat> %val) #0 {
16764 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16766 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
16767 ; GFX12-NEXT: s_wait_expcnt 0x0
16768 ; GFX12-NEXT: s_wait_samplecnt 0x0
16769 ; GFX12-NEXT: s_wait_bvhcnt 0x0
16770 ; GFX12-NEXT: s_wait_kmcnt 0x0
16771 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
16772 ; GFX12-NEXT: s_wait_storecnt 0x0
16773 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2 offset:-2048 scope:SCOPE_DEV
16774 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
16775 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
16776 ; GFX12-NEXT: s_setpc_b64 s[30:31]
16778 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16780 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16781 ; GFX940-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
16782 ; GFX940-NEXT: s_nop 1
16783 ; GFX940-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
16784 ; GFX940-NEXT: buffer_wbl2 sc1
16785 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2
16786 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16787 ; GFX940-NEXT: buffer_inv sc1
16788 ; GFX940-NEXT: s_setpc_b64 s[30:31]
16790 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16792 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16793 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, 0xfffff800, v0
16794 ; GFX11-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, -1, v1, vcc_lo
16795 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
16796 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
16797 ; GFX11-NEXT: flat_load_b32 v3, v[3:4]
16798 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16799 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16800 ; GFX11-NEXT: s_mov_b32 s1, 0
16801 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
16802 ; GFX11-NEXT: .p2align 6
16803 ; GFX11-NEXT: .LBB73_1: ; %atomicrmw.start
16804 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
16805 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16806 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16807 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16808 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16809 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v4
16810 ; GFX11-NEXT: v_add_f32_e32 v6, v6, v5
16811 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16812 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
16813 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
16814 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
16815 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
16816 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
16817 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
16818 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
16819 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
16820 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
16821 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
16822 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
16823 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
16824 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
16825 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
16826 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] glc
16827 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16828 ; GFX11-NEXT: buffer_gl1_inv
16829 ; GFX11-NEXT: buffer_gl0_inv
16830 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
16831 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
16832 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
16833 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
16834 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
16835 ; GFX11-NEXT: s_cbranch_execnz .LBB73_1
16836 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
16837 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
16838 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
16839 ; GFX11-NEXT: s_setpc_b64 s[30:31]
16841 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16843 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16844 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff800, v0
16845 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v1, vcc_lo
16846 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16847 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16848 ; GFX10-NEXT: s_mov_b32 s5, 0
16849 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
16850 ; GFX10-NEXT: .LBB73_1: ; %atomicrmw.start
16851 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
16852 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16853 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16854 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16855 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v4
16856 ; GFX10-NEXT: v_add_f32_e32 v6, v6, v5
16857 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
16858 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
16859 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
16860 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
16861 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
16862 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
16863 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
16864 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
16865 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
16866 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
16867 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
16868 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
16869 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
16870 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16871 ; GFX10-NEXT: buffer_gl1_inv
16872 ; GFX10-NEXT: buffer_gl0_inv
16873 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
16874 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
16875 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
16876 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
16877 ; GFX10-NEXT: s_cbranch_execnz .LBB73_1
16878 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
16879 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
16880 ; GFX10-NEXT: s_setpc_b64 s[30:31]
16882 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16884 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16885 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, 0xfffff800, v0
16886 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, -1, v1, vcc
16887 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
16888 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
16889 ; GFX90A-NEXT: flat_load_dword v1, v[0:1]
16890 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
16891 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v2
16892 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
16893 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16894 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
16895 ; GFX90A-NEXT: .LBB73_1: ; %atomicrmw.start
16896 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
16897 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16898 ; GFX90A-NEXT: v_lshlrev_b32_e32 v0, 16, v1
16899 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v1
16900 ; GFX90A-NEXT: v_add_f32_e32 v0, v0, v3
16901 ; GFX90A-NEXT: v_add_f32_e32 v6, v6, v2
16902 ; GFX90A-NEXT: v_bfe_u32 v7, v0, 16, 1
16903 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
16904 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v0
16905 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
16906 ; GFX90A-NEXT: v_add3_u32 v7, v7, v0, s8
16907 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
16908 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16909 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
16910 ; GFX90A-NEXT: v_cndmask_b32_e64 v0, v7, v8, s[4:5]
16911 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16912 ; GFX90A-NEXT: v_perm_b32 v0, v6, v0, s9
16913 ; GFX90A-NEXT: flat_atomic_cmpswap v0, v[4:5], v[0:1] glc
16914 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16915 ; GFX90A-NEXT: buffer_wbinvl1
16916 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
16917 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16918 ; GFX90A-NEXT: v_mov_b32_e32 v1, v0
16919 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
16920 ; GFX90A-NEXT: s_cbranch_execnz .LBB73_1
16921 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
16922 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
16923 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
16925 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16927 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16928 ; GFX908-NEXT: v_add_co_u32_e32 v3, vcc, 0xfffff800, v0
16929 ; GFX908-NEXT: v_addc_co_u32_e32 v4, vcc, -1, v1, vcc
16930 ; GFX908-NEXT: v_add_co_u32_e32 v0, vcc, 0xfffff800, v0
16931 ; GFX908-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
16932 ; GFX908-NEXT: flat_load_dword v1, v[0:1]
16933 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
16934 ; GFX908-NEXT: v_lshlrev_b32_e32 v5, 16, v2
16935 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
16936 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
16937 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
16938 ; GFX908-NEXT: .LBB73_1: ; %atomicrmw.start
16939 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
16940 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16941 ; GFX908-NEXT: v_lshlrev_b32_e32 v0, 16, v1
16942 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v1
16943 ; GFX908-NEXT: v_add_f32_e32 v0, v0, v5
16944 ; GFX908-NEXT: v_add_f32_e32 v6, v6, v2
16945 ; GFX908-NEXT: v_bfe_u32 v7, v0, 16, 1
16946 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
16947 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v0
16948 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
16949 ; GFX908-NEXT: v_add3_u32 v7, v7, v0, s8
16950 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
16951 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16952 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
16953 ; GFX908-NEXT: v_cndmask_b32_e64 v0, v7, v8, s[4:5]
16954 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16955 ; GFX908-NEXT: v_perm_b32 v0, v6, v0, s9
16956 ; GFX908-NEXT: flat_atomic_cmpswap v0, v[3:4], v[0:1] glc
16957 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16958 ; GFX908-NEXT: buffer_wbinvl1
16959 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
16960 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
16961 ; GFX908-NEXT: v_mov_b32_e32 v1, v0
16962 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
16963 ; GFX908-NEXT: s_cbranch_execnz .LBB73_1
16964 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
16965 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
16966 ; GFX908-NEXT: s_setpc_b64 s[30:31]
16968 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
16970 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16971 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0xfffff800, v0
16972 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
16973 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
16974 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
16975 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
16976 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
16977 ; GFX8-NEXT: .LBB73_1: ; %atomicrmw.start
16978 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
16979 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
16980 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
16981 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
16982 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v4
16983 ; GFX8-NEXT: v_add_f32_e32 v6, v6, v5
16984 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
16985 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
16986 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
16987 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
16988 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
16989 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
16990 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
16991 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
16992 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
16993 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
16994 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
16995 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
16996 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
16997 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
16998 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
16999 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17000 ; GFX8-NEXT: buffer_wbinvl1
17001 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
17002 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17003 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
17004 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
17005 ; GFX8-NEXT: s_cbranch_execnz .LBB73_1
17006 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
17007 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
17008 ; GFX8-NEXT: s_setpc_b64 s[30:31]
17010 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2bf16__offset12b_neg__amdgpu_no_fine_grained_memory:
17012 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17013 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0xfffff800, v0
17014 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, -1, v1, vcc
17015 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
17016 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
17017 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
17018 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
17019 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17020 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
17021 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17022 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
17023 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
17024 ; GFX7-NEXT: .LBB73_1: ; %atomicrmw.start
17025 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
17026 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
17027 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
17028 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
17029 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
17030 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
17031 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
17032 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
17033 ; GFX7-NEXT: v_alignbit_b32 v5, v4, v5, 16
17034 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v7
17035 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v6, 16
17036 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[4:5] glc
17037 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17038 ; GFX7-NEXT: buffer_wbinvl1
17039 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
17040 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v6
17041 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
17042 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v6
17043 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
17044 ; GFX7-NEXT: s_cbranch_execnz .LBB73_1
17045 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
17046 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
17047 ; GFX7-NEXT: s_setpc_b64 s[30:31]
17048 %gep = getelementptr <2 x bfloat>, ptr %ptr, i64 -512
17049 %unused = atomicrmw fadd ptr %gep, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0
17053 define <2 x bfloat> @flat_system_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x bfloat> %val) #0 {
17054 ; GFX12-LABEL: flat_system_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17056 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
17057 ; GFX12-NEXT: s_wait_expcnt 0x0
17058 ; GFX12-NEXT: s_wait_samplecnt 0x0
17059 ; GFX12-NEXT: s_wait_bvhcnt 0x0
17060 ; GFX12-NEXT: s_wait_kmcnt 0x0
17061 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
17062 ; GFX12-NEXT: s_wait_storecnt 0x0
17063 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 offset:2044 th:TH_ATOMIC_RETURN scope:SCOPE_SYS
17064 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
17065 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
17066 ; GFX12-NEXT: s_setpc_b64 s[30:31]
17068 ; GFX940-LABEL: flat_system_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17070 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17071 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
17072 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 offset:2044 sc0 sc1
17073 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17074 ; GFX940-NEXT: buffer_inv sc0 sc1
17075 ; GFX940-NEXT: s_setpc_b64 s[30:31]
17077 ; GFX11-LABEL: flat_system_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17079 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17080 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2044
17081 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17082 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17083 ; GFX11-NEXT: s_mov_b32 s1, 0
17084 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
17085 ; GFX11-NEXT: .p2align 6
17086 ; GFX11-NEXT: .LBB74_1: ; %atomicrmw.start
17087 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
17088 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17089 ; GFX11-NEXT: v_mov_b32_e32 v6, v3
17090 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
17091 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
17092 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
17093 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v6
17094 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
17095 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
17096 ; GFX11-NEXT: v_add_f32_e32 v3, v3, v4
17097 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
17098 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
17099 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
17100 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
17101 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
17102 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v3
17103 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v3, v3
17104 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
17105 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
17106 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
17107 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
17108 ; GFX11-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
17109 ; GFX11-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
17110 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
17111 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[5:6] offset:2044 glc
17112 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17113 ; GFX11-NEXT: buffer_gl1_inv
17114 ; GFX11-NEXT: buffer_gl0_inv
17115 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
17116 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
17117 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
17118 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
17119 ; GFX11-NEXT: s_cbranch_execnz .LBB74_1
17120 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
17121 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
17122 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
17123 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
17124 ; GFX11-NEXT: s_setpc_b64 s[30:31]
17126 ; GFX10-LABEL: flat_system_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17128 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17129 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, 0x7fc, v0
17130 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v1, vcc_lo
17131 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 16, v2
17132 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17133 ; GFX10-NEXT: s_mov_b32 s5, 0
17134 ; GFX10-NEXT: flat_load_dword v0, v[3:4]
17135 ; GFX10-NEXT: .LBB74_1: ; %atomicrmw.start
17136 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
17137 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17138 ; GFX10-NEXT: v_mov_b32_e32 v6, v0
17139 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 16, v6
17140 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
17141 ; GFX10-NEXT: v_add_f32_e32 v0, v0, v1
17142 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
17143 ; GFX10-NEXT: v_bfe_u32 v7, v0, 16, 1
17144 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
17145 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v0
17146 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
17147 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
17148 ; GFX10-NEXT: v_add3_u32 v7, v7, v0, 0x7fff
17149 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
17150 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v0, v0
17151 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
17152 ; GFX10-NEXT: v_cndmask_b32_e64 v0, v7, v9, s4
17153 ; GFX10-NEXT: v_perm_b32 v5, v5, v0, 0x7060302
17154 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
17155 ; GFX10-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
17156 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17157 ; GFX10-NEXT: buffer_gl1_inv
17158 ; GFX10-NEXT: buffer_gl0_inv
17159 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v0, v6
17160 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
17161 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
17162 ; GFX10-NEXT: s_cbranch_execnz .LBB74_1
17163 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
17164 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
17165 ; GFX10-NEXT: s_setpc_b64 s[30:31]
17167 ; GFX90A-LABEL: flat_system_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17169 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17170 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2044
17171 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
17172 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17173 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
17174 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17175 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
17176 ; GFX90A-NEXT: .LBB74_1: ; %atomicrmw.start
17177 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
17178 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17179 ; GFX90A-NEXT: v_mov_b32_e32 v7, v3
17180 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v7
17181 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
17182 ; GFX90A-NEXT: v_add_f32_e32 v3, v3, v4
17183 ; GFX90A-NEXT: v_add_f32_e32 v5, v5, v2
17184 ; GFX90A-NEXT: v_bfe_u32 v6, v3, 16, 1
17185 ; GFX90A-NEXT: v_bfe_u32 v9, v5, 16, 1
17186 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v3
17187 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v5
17188 ; GFX90A-NEXT: v_add3_u32 v6, v6, v3, s8
17189 ; GFX90A-NEXT: v_add3_u32 v9, v9, v5, s8
17190 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
17191 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
17192 ; GFX90A-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[4:5]
17193 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
17194 ; GFX90A-NEXT: v_perm_b32 v6, v5, v3, s9
17195 ; GFX90A-NEXT: buffer_wbl2
17196 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[6:7] offset:2044 glc
17197 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17198 ; GFX90A-NEXT: buffer_invl2
17199 ; GFX90A-NEXT: buffer_wbinvl1
17200 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
17201 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17202 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
17203 ; GFX90A-NEXT: s_cbranch_execnz .LBB74_1
17204 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
17205 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
17206 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
17207 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
17209 ; GFX908-LABEL: flat_system_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17211 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17212 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
17213 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
17214 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17215 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
17216 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17217 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
17218 ; GFX908-NEXT: .LBB74_1: ; %atomicrmw.start
17219 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
17220 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17221 ; GFX908-NEXT: v_mov_b32_e32 v6, v3
17222 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v6
17223 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
17224 ; GFX908-NEXT: v_add_f32_e32 v3, v3, v4
17225 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
17226 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
17227 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
17228 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
17229 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
17230 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s8
17231 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
17232 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
17233 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
17234 ; GFX908-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
17235 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
17236 ; GFX908-NEXT: v_perm_b32 v5, v5, v3, s9
17237 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] offset:2044 glc
17238 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17239 ; GFX908-NEXT: buffer_wbinvl1
17240 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
17241 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17242 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
17243 ; GFX908-NEXT: s_cbranch_execnz .LBB74_1
17244 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
17245 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
17246 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
17247 ; GFX908-NEXT: s_setpc_b64 s[30:31]
17249 ; GFX8-LABEL: flat_system_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17251 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17252 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x7fc, v0
17253 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v1, vcc
17254 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
17255 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
17256 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 16, v2
17257 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17258 ; GFX8-NEXT: .LBB74_1: ; %atomicrmw.start
17259 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
17260 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17261 ; GFX8-NEXT: v_mov_b32_e32 v6, v0
17262 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v6
17263 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
17264 ; GFX8-NEXT: v_add_f32_e32 v0, v0, v1
17265 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
17266 ; GFX8-NEXT: v_bfe_u32 v7, v0, 16, 1
17267 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
17268 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v0
17269 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
17270 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
17271 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
17272 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
17273 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
17274 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v0
17275 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v0, v0
17276 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
17277 ; GFX8-NEXT: v_cndmask_b32_e64 v0, v7, v8, s[4:5]
17278 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
17279 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v0, 16
17280 ; GFX8-NEXT: flat_atomic_cmpswap v0, v[3:4], v[5:6] glc
17281 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17282 ; GFX8-NEXT: buffer_wbinvl1
17283 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v0, v6
17284 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17285 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
17286 ; GFX8-NEXT: s_cbranch_execnz .LBB74_1
17287 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
17288 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
17289 ; GFX8-NEXT: s_setpc_b64 s[30:31]
17291 ; GFX7-LABEL: flat_system_atomic_fadd_ret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17293 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17294 ; GFX7-NEXT: v_add_i32_e32 v4, vcc, 0x7fc, v0
17295 ; GFX7-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
17296 ; GFX7-NEXT: flat_load_dword v0, v[4:5]
17297 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v2
17298 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
17299 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
17300 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v1
17301 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
17302 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17303 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v0
17304 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
17305 ; GFX7-NEXT: .LBB74_1: ; %atomicrmw.start
17306 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
17307 ; GFX7-NEXT: v_mul_f32_e32 v1, 1.0, v1
17308 ; GFX7-NEXT: v_mul_f32_e32 v0, 1.0, v0
17309 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v1
17310 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v0
17311 ; GFX7-NEXT: v_lshrrev_b32_e32 v1, 16, v1
17312 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
17313 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
17314 ; GFX7-NEXT: v_alignbit_b32 v1, v1, v0, 16
17315 ; GFX7-NEXT: v_lshrrev_b32_e32 v0, 16, v7
17316 ; GFX7-NEXT: v_alignbit_b32 v0, v0, v6, 16
17317 ; GFX7-NEXT: flat_atomic_cmpswap v0, v[4:5], v[0:1] glc
17318 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17319 ; GFX7-NEXT: buffer_wbinvl1
17320 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v0, v1
17321 ; GFX7-NEXT: v_and_b32_e32 v1, 0xffff0000, v0
17322 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
17323 ; GFX7-NEXT: v_lshlrev_b32_e32 v0, 16, v0
17324 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
17325 ; GFX7-NEXT: s_cbranch_execnz .LBB74_1
17326 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
17327 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
17328 ; GFX7-NEXT: s_setpc_b64 s[30:31]
17329 %gep = getelementptr <2 x bfloat>, ptr %ptr, i64 511
17330 %result = atomicrmw fadd ptr %gep, <2 x bfloat> %val seq_cst, !amdgpu.no.fine.grained.memory !0
17331 ret <2 x bfloat> %result
17334 define void @flat_system_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory(ptr %ptr, <2 x bfloat> %val) #0 {
17335 ; GFX12-LABEL: flat_system_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17337 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
17338 ; GFX12-NEXT: s_wait_expcnt 0x0
17339 ; GFX12-NEXT: s_wait_samplecnt 0x0
17340 ; GFX12-NEXT: s_wait_bvhcnt 0x0
17341 ; GFX12-NEXT: s_wait_kmcnt 0x0
17342 ; GFX12-NEXT: global_wb scope:SCOPE_SYS
17343 ; GFX12-NEXT: s_wait_storecnt 0x0
17344 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2 offset:2044 scope:SCOPE_SYS
17345 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
17346 ; GFX12-NEXT: global_inv scope:SCOPE_SYS
17347 ; GFX12-NEXT: s_setpc_b64 s[30:31]
17349 ; GFX940-LABEL: flat_system_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17351 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17352 ; GFX940-NEXT: buffer_wbl2 sc0 sc1
17353 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2 offset:2044 sc1
17354 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17355 ; GFX940-NEXT: buffer_inv sc0 sc1
17356 ; GFX940-NEXT: s_setpc_b64 s[30:31]
17358 ; GFX11-LABEL: flat_system_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17360 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17361 ; GFX11-NEXT: flat_load_b32 v3, v[0:1] offset:2044
17362 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17363 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
17364 ; GFX11-NEXT: s_mov_b32 s1, 0
17365 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
17366 ; GFX11-NEXT: .p2align 6
17367 ; GFX11-NEXT: .LBB75_1: ; %atomicrmw.start
17368 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
17369 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17370 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
17371 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
17372 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
17373 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v4
17374 ; GFX11-NEXT: v_add_f32_e32 v6, v6, v5
17375 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
17376 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
17377 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
17378 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
17379 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
17380 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
17381 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
17382 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
17383 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
17384 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
17385 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
17386 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
17387 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
17388 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
17389 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
17390 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:2044 glc
17391 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17392 ; GFX11-NEXT: buffer_gl1_inv
17393 ; GFX11-NEXT: buffer_gl0_inv
17394 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
17395 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
17396 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
17397 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
17398 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
17399 ; GFX11-NEXT: s_cbranch_execnz .LBB75_1
17400 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
17401 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
17402 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
17403 ; GFX11-NEXT: s_setpc_b64 s[30:31]
17405 ; GFX10-LABEL: flat_system_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17407 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17408 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7fc, v0
17409 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
17410 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17411 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
17412 ; GFX10-NEXT: s_mov_b32 s5, 0
17413 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
17414 ; GFX10-NEXT: .LBB75_1: ; %atomicrmw.start
17415 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
17416 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17417 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
17418 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
17419 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v4
17420 ; GFX10-NEXT: v_add_f32_e32 v6, v6, v5
17421 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
17422 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
17423 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
17424 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
17425 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
17426 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
17427 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
17428 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
17429 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
17430 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
17431 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
17432 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
17433 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
17434 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17435 ; GFX10-NEXT: buffer_gl1_inv
17436 ; GFX10-NEXT: buffer_gl0_inv
17437 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
17438 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
17439 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
17440 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
17441 ; GFX10-NEXT: s_cbranch_execnz .LBB75_1
17442 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
17443 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
17444 ; GFX10-NEXT: s_setpc_b64 s[30:31]
17446 ; GFX90A-LABEL: flat_system_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17448 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17449 ; GFX90A-NEXT: flat_load_dword v3, v[0:1] offset:2044
17450 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
17451 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17452 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
17453 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
17454 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
17455 ; GFX90A-NEXT: .LBB75_1: ; %atomicrmw.start
17456 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
17457 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17458 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
17459 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
17460 ; GFX90A-NEXT: v_add_f32_e32 v2, v2, v4
17461 ; GFX90A-NEXT: v_add_f32_e32 v6, v6, v5
17462 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
17463 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
17464 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
17465 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
17466 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s8
17467 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
17468 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
17469 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
17470 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
17471 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
17472 ; GFX90A-NEXT: v_perm_b32 v2, v6, v2, s9
17473 ; GFX90A-NEXT: buffer_wbl2
17474 ; GFX90A-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:2044 glc
17475 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17476 ; GFX90A-NEXT: buffer_invl2
17477 ; GFX90A-NEXT: buffer_wbinvl1
17478 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
17479 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17480 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
17481 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
17482 ; GFX90A-NEXT: s_cbranch_execnz .LBB75_1
17483 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
17484 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
17485 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
17487 ; GFX908-LABEL: flat_system_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17489 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17490 ; GFX908-NEXT: flat_load_dword v3, v[0:1] offset:2044
17491 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
17492 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17493 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
17494 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
17495 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
17496 ; GFX908-NEXT: .LBB75_1: ; %atomicrmw.start
17497 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
17498 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17499 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
17500 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
17501 ; GFX908-NEXT: v_add_f32_e32 v2, v2, v4
17502 ; GFX908-NEXT: v_add_f32_e32 v6, v6, v5
17503 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
17504 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
17505 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
17506 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
17507 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s8
17508 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
17509 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
17510 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
17511 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
17512 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
17513 ; GFX908-NEXT: v_perm_b32 v2, v6, v2, s9
17514 ; GFX908-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:2044 glc
17515 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17516 ; GFX908-NEXT: buffer_wbinvl1
17517 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
17518 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17519 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
17520 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
17521 ; GFX908-NEXT: s_cbranch_execnz .LBB75_1
17522 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
17523 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
17524 ; GFX908-NEXT: s_setpc_b64 s[30:31]
17526 ; GFX8-LABEL: flat_system_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17528 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17529 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, 0x7fc, v0
17530 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
17531 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
17532 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
17533 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17534 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
17535 ; GFX8-NEXT: .LBB75_1: ; %atomicrmw.start
17536 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
17537 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17538 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
17539 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
17540 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v4
17541 ; GFX8-NEXT: v_add_f32_e32 v6, v6, v5
17542 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
17543 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
17544 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
17545 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
17546 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
17547 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
17548 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
17549 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
17550 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
17551 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
17552 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
17553 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
17554 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
17555 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
17556 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
17557 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17558 ; GFX8-NEXT: buffer_wbinvl1
17559 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
17560 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17561 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
17562 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
17563 ; GFX8-NEXT: s_cbranch_execnz .LBB75_1
17564 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
17565 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
17566 ; GFX8-NEXT: s_setpc_b64 s[30:31]
17568 ; GFX7-LABEL: flat_system_atomic_fadd_noret_v2bf16__offset12b_pos__amdgpu_no_fine_grained_memory:
17570 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17571 ; GFX7-NEXT: v_add_i32_e32 v0, vcc, 0x7fc, v0
17572 ; GFX7-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
17573 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
17574 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
17575 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
17576 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
17577 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17578 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
17579 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17580 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
17581 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
17582 ; GFX7-NEXT: .LBB75_1: ; %atomicrmw.start
17583 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
17584 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
17585 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
17586 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
17587 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
17588 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
17589 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
17590 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
17591 ; GFX7-NEXT: v_alignbit_b32 v5, v4, v5, 16
17592 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v7
17593 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v6, 16
17594 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[4:5] glc
17595 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17596 ; GFX7-NEXT: buffer_wbinvl1
17597 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
17598 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v6
17599 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
17600 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v6
17601 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
17602 ; GFX7-NEXT: s_cbranch_execnz .LBB75_1
17603 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
17604 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
17605 ; GFX7-NEXT: s_setpc_b64 s[30:31]
17606 %gep = getelementptr <2 x bfloat>, ptr %ptr, i64 511
17607 %unused = atomicrmw fadd ptr %gep, <2 x bfloat> %val seq_cst, !amdgpu.no.fine.grained.memory !0
17611 define <2 x bfloat> @flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_remote_memory(ptr %ptr, <2 x bfloat> %val) #0 {
17612 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_remote_memory:
17614 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
17615 ; GFX12-NEXT: s_wait_expcnt 0x0
17616 ; GFX12-NEXT: s_wait_samplecnt 0x0
17617 ; GFX12-NEXT: s_wait_bvhcnt 0x0
17618 ; GFX12-NEXT: s_wait_kmcnt 0x0
17619 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
17620 ; GFX12-NEXT: s_wait_storecnt 0x0
17621 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
17622 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
17623 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
17624 ; GFX12-NEXT: s_setpc_b64 s[30:31]
17626 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_remote_memory:
17628 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17629 ; GFX940-NEXT: buffer_wbl2 sc1
17630 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 sc0
17631 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17632 ; GFX940-NEXT: buffer_inv sc1
17633 ; GFX940-NEXT: s_setpc_b64 s[30:31]
17635 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_remote_memory:
17637 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17638 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
17639 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17640 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17641 ; GFX11-NEXT: s_mov_b32 s1, 0
17642 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
17643 ; GFX11-NEXT: .p2align 6
17644 ; GFX11-NEXT: .LBB76_1: ; %atomicrmw.start
17645 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
17646 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17647 ; GFX11-NEXT: v_mov_b32_e32 v6, v3
17648 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
17649 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
17650 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
17651 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v6
17652 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
17653 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
17654 ; GFX11-NEXT: v_add_f32_e32 v3, v3, v4
17655 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
17656 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
17657 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
17658 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
17659 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
17660 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v3
17661 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v3, v3
17662 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
17663 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
17664 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
17665 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
17666 ; GFX11-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
17667 ; GFX11-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
17668 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
17669 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[5:6] glc
17670 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17671 ; GFX11-NEXT: buffer_gl1_inv
17672 ; GFX11-NEXT: buffer_gl0_inv
17673 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
17674 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
17675 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
17676 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
17677 ; GFX11-NEXT: s_cbranch_execnz .LBB76_1
17678 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
17679 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
17680 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
17681 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
17682 ; GFX11-NEXT: s_setpc_b64 s[30:31]
17684 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_remote_memory:
17686 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17687 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
17688 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17689 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17690 ; GFX10-NEXT: s_mov_b32 s5, 0
17691 ; GFX10-NEXT: .LBB76_1: ; %atomicrmw.start
17692 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
17693 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17694 ; GFX10-NEXT: v_mov_b32_e32 v6, v3
17695 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v6
17696 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
17697 ; GFX10-NEXT: v_add_f32_e32 v3, v3, v4
17698 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
17699 ; GFX10-NEXT: v_bfe_u32 v7, v3, 16, 1
17700 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
17701 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v3
17702 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
17703 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
17704 ; GFX10-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
17705 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
17706 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v3, v3
17707 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
17708 ; GFX10-NEXT: v_cndmask_b32_e64 v3, v7, v9, s4
17709 ; GFX10-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
17710 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
17711 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
17712 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17713 ; GFX10-NEXT: buffer_gl1_inv
17714 ; GFX10-NEXT: buffer_gl0_inv
17715 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
17716 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
17717 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
17718 ; GFX10-NEXT: s_cbranch_execnz .LBB76_1
17719 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
17720 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
17721 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
17722 ; GFX10-NEXT: s_setpc_b64 s[30:31]
17724 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_remote_memory:
17726 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17727 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
17728 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
17729 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17730 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
17731 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17732 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
17733 ; GFX90A-NEXT: .LBB76_1: ; %atomicrmw.start
17734 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
17735 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17736 ; GFX90A-NEXT: v_mov_b32_e32 v7, v3
17737 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v7
17738 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
17739 ; GFX90A-NEXT: v_add_f32_e32 v3, v3, v4
17740 ; GFX90A-NEXT: v_add_f32_e32 v5, v5, v2
17741 ; GFX90A-NEXT: v_bfe_u32 v6, v3, 16, 1
17742 ; GFX90A-NEXT: v_bfe_u32 v9, v5, 16, 1
17743 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v3
17744 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v5
17745 ; GFX90A-NEXT: v_add3_u32 v6, v6, v3, s8
17746 ; GFX90A-NEXT: v_add3_u32 v9, v9, v5, s8
17747 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
17748 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
17749 ; GFX90A-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[4:5]
17750 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
17751 ; GFX90A-NEXT: v_perm_b32 v6, v5, v3, s9
17752 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[6:7] glc
17753 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17754 ; GFX90A-NEXT: buffer_wbinvl1
17755 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
17756 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17757 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
17758 ; GFX90A-NEXT: s_cbranch_execnz .LBB76_1
17759 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
17760 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
17761 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
17762 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
17764 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_remote_memory:
17766 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17767 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
17768 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
17769 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17770 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
17771 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17772 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
17773 ; GFX908-NEXT: .LBB76_1: ; %atomicrmw.start
17774 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
17775 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17776 ; GFX908-NEXT: v_mov_b32_e32 v6, v3
17777 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v6
17778 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
17779 ; GFX908-NEXT: v_add_f32_e32 v3, v3, v4
17780 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
17781 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
17782 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
17783 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
17784 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
17785 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s8
17786 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
17787 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
17788 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
17789 ; GFX908-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
17790 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
17791 ; GFX908-NEXT: v_perm_b32 v5, v5, v3, s9
17792 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
17793 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17794 ; GFX908-NEXT: buffer_wbinvl1
17795 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
17796 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17797 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
17798 ; GFX908-NEXT: s_cbranch_execnz .LBB76_1
17799 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
17800 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
17801 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
17802 ; GFX908-NEXT: s_setpc_b64 s[30:31]
17804 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_remote_memory:
17806 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17807 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
17808 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
17809 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17810 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
17811 ; GFX8-NEXT: .LBB76_1: ; %atomicrmw.start
17812 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
17813 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17814 ; GFX8-NEXT: v_mov_b32_e32 v6, v3
17815 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 16, v6
17816 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
17817 ; GFX8-NEXT: v_add_f32_e32 v3, v3, v4
17818 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
17819 ; GFX8-NEXT: v_bfe_u32 v7, v3, 16, 1
17820 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
17821 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v3
17822 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
17823 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
17824 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
17825 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
17826 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
17827 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v3
17828 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
17829 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
17830 ; GFX8-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
17831 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
17832 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v3, 16
17833 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
17834 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17835 ; GFX8-NEXT: buffer_wbinvl1
17836 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
17837 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
17838 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
17839 ; GFX8-NEXT: s_cbranch_execnz .LBB76_1
17840 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
17841 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
17842 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
17843 ; GFX8-NEXT: s_setpc_b64 s[30:31]
17845 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_remote_memory:
17847 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17848 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
17849 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
17850 ; GFX7-NEXT: v_mul_f32_e32 v6, 1.0, v3
17851 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
17852 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v2
17853 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17854 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v5
17855 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
17856 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
17857 ; GFX7-NEXT: .LBB76_1: ; %atomicrmw.start
17858 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
17859 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
17860 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
17861 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v2
17862 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
17863 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
17864 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v5
17865 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v4
17866 ; GFX7-NEXT: v_alignbit_b32 v3, v2, v3, 16
17867 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v7
17868 ; GFX7-NEXT: v_alignbit_b32 v2, v2, v6, 16
17869 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[2:3] glc
17870 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17871 ; GFX7-NEXT: buffer_wbinvl1
17872 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v3
17873 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
17874 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
17875 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v6
17876 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
17877 ; GFX7-NEXT: s_cbranch_execnz .LBB76_1
17878 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
17879 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
17880 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
17881 ; GFX7-NEXT: v_mov_b32_e32 v1, v2
17882 ; GFX7-NEXT: s_setpc_b64 s[30:31]
17883 %result = atomicrmw fadd ptr %ptr, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.remote.memory !0
17884 ret <2 x bfloat> %result
17887 define void @flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_remote_memory(ptr %ptr, <2 x bfloat> %val) #0 {
17888 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_remote_memory:
17890 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
17891 ; GFX12-NEXT: s_wait_expcnt 0x0
17892 ; GFX12-NEXT: s_wait_samplecnt 0x0
17893 ; GFX12-NEXT: s_wait_bvhcnt 0x0
17894 ; GFX12-NEXT: s_wait_kmcnt 0x0
17895 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
17896 ; GFX12-NEXT: s_wait_storecnt 0x0
17897 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2 scope:SCOPE_DEV
17898 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
17899 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
17900 ; GFX12-NEXT: s_setpc_b64 s[30:31]
17902 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_remote_memory:
17904 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17905 ; GFX940-NEXT: buffer_wbl2 sc1
17906 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2
17907 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17908 ; GFX940-NEXT: buffer_inv sc1
17909 ; GFX940-NEXT: s_setpc_b64 s[30:31]
17911 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_remote_memory:
17913 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17914 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
17915 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17916 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
17917 ; GFX11-NEXT: s_mov_b32 s1, 0
17918 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
17919 ; GFX11-NEXT: .p2align 6
17920 ; GFX11-NEXT: .LBB77_1: ; %atomicrmw.start
17921 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
17922 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17923 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
17924 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
17925 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
17926 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v4
17927 ; GFX11-NEXT: v_add_f32_e32 v6, v6, v5
17928 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
17929 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
17930 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
17931 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
17932 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
17933 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
17934 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
17935 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
17936 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
17937 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
17938 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
17939 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
17940 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
17941 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
17942 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
17943 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] glc
17944 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17945 ; GFX11-NEXT: buffer_gl1_inv
17946 ; GFX11-NEXT: buffer_gl0_inv
17947 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
17948 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
17949 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
17950 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
17951 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
17952 ; GFX11-NEXT: s_cbranch_execnz .LBB77_1
17953 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
17954 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
17955 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
17956 ; GFX11-NEXT: s_setpc_b64 s[30:31]
17958 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_remote_memory:
17960 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
17961 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
17962 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
17963 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
17964 ; GFX10-NEXT: s_mov_b32 s5, 0
17965 ; GFX10-NEXT: .LBB77_1: ; %atomicrmw.start
17966 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
17967 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17968 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
17969 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
17970 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v4
17971 ; GFX10-NEXT: v_add_f32_e32 v6, v6, v5
17972 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
17973 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
17974 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
17975 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
17976 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
17977 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
17978 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
17979 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
17980 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
17981 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
17982 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
17983 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
17984 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
17985 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
17986 ; GFX10-NEXT: buffer_gl1_inv
17987 ; GFX10-NEXT: buffer_gl0_inv
17988 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
17989 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
17990 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
17991 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
17992 ; GFX10-NEXT: s_cbranch_execnz .LBB77_1
17993 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
17994 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
17995 ; GFX10-NEXT: s_setpc_b64 s[30:31]
17997 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_remote_memory:
17999 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18000 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
18001 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
18002 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18003 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
18004 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
18005 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
18006 ; GFX90A-NEXT: .LBB77_1: ; %atomicrmw.start
18007 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
18008 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18009 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
18010 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
18011 ; GFX90A-NEXT: v_add_f32_e32 v2, v2, v4
18012 ; GFX90A-NEXT: v_add_f32_e32 v6, v6, v5
18013 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
18014 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
18015 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
18016 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
18017 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s8
18018 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
18019 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
18020 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
18021 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
18022 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
18023 ; GFX90A-NEXT: v_perm_b32 v2, v6, v2, s9
18024 ; GFX90A-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18025 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18026 ; GFX90A-NEXT: buffer_wbinvl1
18027 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
18028 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
18029 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
18030 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
18031 ; GFX90A-NEXT: s_cbranch_execnz .LBB77_1
18032 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
18033 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
18034 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
18036 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_remote_memory:
18038 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18039 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
18040 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
18041 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18042 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
18043 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
18044 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
18045 ; GFX908-NEXT: .LBB77_1: ; %atomicrmw.start
18046 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
18047 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18048 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
18049 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
18050 ; GFX908-NEXT: v_add_f32_e32 v2, v2, v4
18051 ; GFX908-NEXT: v_add_f32_e32 v6, v6, v5
18052 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
18053 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
18054 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
18055 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
18056 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s8
18057 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
18058 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
18059 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
18060 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
18061 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
18062 ; GFX908-NEXT: v_perm_b32 v2, v6, v2, s9
18063 ; GFX908-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18064 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18065 ; GFX908-NEXT: buffer_wbinvl1
18066 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
18067 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
18068 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
18069 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
18070 ; GFX908-NEXT: s_cbranch_execnz .LBB77_1
18071 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
18072 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
18073 ; GFX908-NEXT: s_setpc_b64 s[30:31]
18075 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_remote_memory:
18077 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18078 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
18079 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
18080 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18081 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
18082 ; GFX8-NEXT: .LBB77_1: ; %atomicrmw.start
18083 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
18084 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18085 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
18086 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
18087 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v4
18088 ; GFX8-NEXT: v_add_f32_e32 v6, v6, v5
18089 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
18090 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
18091 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
18092 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
18093 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
18094 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
18095 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
18096 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
18097 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
18098 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
18099 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
18100 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
18101 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
18102 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
18103 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18104 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18105 ; GFX8-NEXT: buffer_wbinvl1
18106 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
18107 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
18108 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
18109 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
18110 ; GFX8-NEXT: s_cbranch_execnz .LBB77_1
18111 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
18112 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
18113 ; GFX8-NEXT: s_setpc_b64 s[30:31]
18115 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_remote_memory:
18117 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18118 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
18119 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
18120 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
18121 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
18122 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
18123 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
18124 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18125 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
18126 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
18127 ; GFX7-NEXT: .LBB77_1: ; %atomicrmw.start
18128 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
18129 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
18130 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
18131 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
18132 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
18133 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
18134 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
18135 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
18136 ; GFX7-NEXT: v_alignbit_b32 v5, v4, v5, 16
18137 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v7
18138 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v6, 16
18139 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[4:5] glc
18140 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18141 ; GFX7-NEXT: buffer_wbinvl1
18142 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
18143 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v6
18144 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
18145 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v6
18146 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
18147 ; GFX7-NEXT: s_cbranch_execnz .LBB77_1
18148 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
18149 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
18150 ; GFX7-NEXT: s_setpc_b64 s[30:31]
18151 %unused = atomicrmw fadd ptr %ptr, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.remote.memory !0
18155 define <2 x bfloat> @flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory(ptr %ptr, <2 x bfloat> %val) #0 {
18156 ; GFX12-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18158 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
18159 ; GFX12-NEXT: s_wait_expcnt 0x0
18160 ; GFX12-NEXT: s_wait_samplecnt 0x0
18161 ; GFX12-NEXT: s_wait_bvhcnt 0x0
18162 ; GFX12-NEXT: s_wait_kmcnt 0x0
18163 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
18164 ; GFX12-NEXT: s_wait_storecnt 0x0
18165 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 th:TH_ATOMIC_RETURN scope:SCOPE_DEV
18166 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
18167 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
18168 ; GFX12-NEXT: s_setpc_b64 s[30:31]
18170 ; GFX940-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18172 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18173 ; GFX940-NEXT: buffer_wbl2 sc1
18174 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v0, v[0:1], v2 sc0
18175 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18176 ; GFX940-NEXT: buffer_inv sc1
18177 ; GFX940-NEXT: s_setpc_b64 s[30:31]
18179 ; GFX11-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18181 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18182 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
18183 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18184 ; GFX11-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
18185 ; GFX11-NEXT: s_mov_b32 s1, 0
18186 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
18187 ; GFX11-NEXT: .p2align 6
18188 ; GFX11-NEXT: .LBB78_1: ; %atomicrmw.start
18189 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
18190 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18191 ; GFX11-NEXT: v_mov_b32_e32 v6, v3
18192 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
18193 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
18194 ; GFX11-NEXT: v_add_f32_e32 v5, v5, v2
18195 ; GFX11-NEXT: v_lshlrev_b32_e32 v3, 16, v6
18196 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
18197 ; GFX11-NEXT: v_bfe_u32 v8, v5, 16, 1
18198 ; GFX11-NEXT: v_add_f32_e32 v3, v3, v4
18199 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v5
18200 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
18201 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
18202 ; GFX11-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
18203 ; GFX11-NEXT: v_bfe_u32 v7, v3, 16, 1
18204 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v3
18205 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v3, v3
18206 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_4) | instskip(NEXT) | instid1(VALU_DEP_4)
18207 ; GFX11-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
18208 ; GFX11-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
18209 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
18210 ; GFX11-NEXT: v_cndmask_b32_e64 v3, v7, v9, s0
18211 ; GFX11-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
18212 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
18213 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v3, v[0:1], v[5:6] glc
18214 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18215 ; GFX11-NEXT: buffer_gl1_inv
18216 ; GFX11-NEXT: buffer_gl0_inv
18217 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
18218 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
18219 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
18220 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
18221 ; GFX11-NEXT: s_cbranch_execnz .LBB78_1
18222 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
18223 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
18224 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
18225 ; GFX11-NEXT: v_mov_b32_e32 v0, v3
18226 ; GFX11-NEXT: s_setpc_b64 s[30:31]
18228 ; GFX10-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18230 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18231 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
18232 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18233 ; GFX10-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
18234 ; GFX10-NEXT: s_mov_b32 s5, 0
18235 ; GFX10-NEXT: .LBB78_1: ; %atomicrmw.start
18236 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
18237 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18238 ; GFX10-NEXT: v_mov_b32_e32 v6, v3
18239 ; GFX10-NEXT: v_lshlrev_b32_e32 v3, 16, v6
18240 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
18241 ; GFX10-NEXT: v_add_f32_e32 v3, v3, v4
18242 ; GFX10-NEXT: v_add_f32_e32 v5, v5, v2
18243 ; GFX10-NEXT: v_bfe_u32 v7, v3, 16, 1
18244 ; GFX10-NEXT: v_bfe_u32 v8, v5, 16, 1
18245 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v3
18246 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v5
18247 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v5, v5
18248 ; GFX10-NEXT: v_add3_u32 v7, v7, v3, 0x7fff
18249 ; GFX10-NEXT: v_add3_u32 v8, v8, v5, 0x7fff
18250 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v3, v3
18251 ; GFX10-NEXT: v_cndmask_b32_e32 v5, v8, v10, vcc_lo
18252 ; GFX10-NEXT: v_cndmask_b32_e64 v3, v7, v9, s4
18253 ; GFX10-NEXT: v_perm_b32 v5, v5, v3, 0x7060302
18254 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
18255 ; GFX10-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
18256 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18257 ; GFX10-NEXT: buffer_gl1_inv
18258 ; GFX10-NEXT: buffer_gl0_inv
18259 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v3, v6
18260 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
18261 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
18262 ; GFX10-NEXT: s_cbranch_execnz .LBB78_1
18263 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
18264 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
18265 ; GFX10-NEXT: v_mov_b32_e32 v0, v3
18266 ; GFX10-NEXT: s_setpc_b64 s[30:31]
18268 ; GFX90A-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18270 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18271 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
18272 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
18273 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18274 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
18275 ; GFX90A-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
18276 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
18277 ; GFX90A-NEXT: .LBB78_1: ; %atomicrmw.start
18278 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
18279 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18280 ; GFX90A-NEXT: v_mov_b32_e32 v7, v3
18281 ; GFX90A-NEXT: v_lshlrev_b32_e32 v3, 16, v7
18282 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v7
18283 ; GFX90A-NEXT: v_add_f32_e32 v3, v3, v4
18284 ; GFX90A-NEXT: v_add_f32_e32 v5, v5, v2
18285 ; GFX90A-NEXT: v_bfe_u32 v6, v3, 16, 1
18286 ; GFX90A-NEXT: v_bfe_u32 v9, v5, 16, 1
18287 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v3
18288 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v5
18289 ; GFX90A-NEXT: v_add3_u32 v6, v6, v3, s8
18290 ; GFX90A-NEXT: v_add3_u32 v9, v9, v5, s8
18291 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
18292 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
18293 ; GFX90A-NEXT: v_cndmask_b32_e64 v3, v6, v8, s[4:5]
18294 ; GFX90A-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
18295 ; GFX90A-NEXT: v_perm_b32 v6, v5, v3, s9
18296 ; GFX90A-NEXT: flat_atomic_cmpswap v3, v[0:1], v[6:7] glc
18297 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18298 ; GFX90A-NEXT: buffer_wbinvl1
18299 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v3, v7
18300 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
18301 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
18302 ; GFX90A-NEXT: s_cbranch_execnz .LBB78_1
18303 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
18304 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
18305 ; GFX90A-NEXT: v_mov_b32_e32 v0, v3
18306 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
18308 ; GFX908-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18310 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18311 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
18312 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
18313 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18314 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
18315 ; GFX908-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
18316 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
18317 ; GFX908-NEXT: .LBB78_1: ; %atomicrmw.start
18318 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
18319 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18320 ; GFX908-NEXT: v_mov_b32_e32 v6, v3
18321 ; GFX908-NEXT: v_lshlrev_b32_e32 v3, 16, v6
18322 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
18323 ; GFX908-NEXT: v_add_f32_e32 v3, v3, v4
18324 ; GFX908-NEXT: v_add_f32_e32 v5, v5, v2
18325 ; GFX908-NEXT: v_bfe_u32 v7, v3, 16, 1
18326 ; GFX908-NEXT: v_bfe_u32 v9, v5, 16, 1
18327 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v3
18328 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v5
18329 ; GFX908-NEXT: v_add3_u32 v7, v7, v3, s8
18330 ; GFX908-NEXT: v_add3_u32 v9, v9, v5, s8
18331 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
18332 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
18333 ; GFX908-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
18334 ; GFX908-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
18335 ; GFX908-NEXT: v_perm_b32 v5, v5, v3, s9
18336 ; GFX908-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
18337 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18338 ; GFX908-NEXT: buffer_wbinvl1
18339 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
18340 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
18341 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
18342 ; GFX908-NEXT: s_cbranch_execnz .LBB78_1
18343 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
18344 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
18345 ; GFX908-NEXT: v_mov_b32_e32 v0, v3
18346 ; GFX908-NEXT: s_setpc_b64 s[30:31]
18348 ; GFX8-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18350 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18351 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
18352 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
18353 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18354 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
18355 ; GFX8-NEXT: .LBB78_1: ; %atomicrmw.start
18356 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
18357 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18358 ; GFX8-NEXT: v_mov_b32_e32 v6, v3
18359 ; GFX8-NEXT: v_lshlrev_b32_e32 v3, 16, v6
18360 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
18361 ; GFX8-NEXT: v_add_f32_e32 v3, v3, v4
18362 ; GFX8-NEXT: v_add_f32_e32 v5, v5, v2
18363 ; GFX8-NEXT: v_bfe_u32 v7, v3, 16, 1
18364 ; GFX8-NEXT: v_bfe_u32 v9, v5, 16, 1
18365 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v3
18366 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v5
18367 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
18368 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
18369 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v5
18370 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v5, v5
18371 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v3
18372 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v3, v3
18373 ; GFX8-NEXT: v_cndmask_b32_e32 v5, v9, v10, vcc
18374 ; GFX8-NEXT: v_cndmask_b32_e64 v3, v7, v8, s[4:5]
18375 ; GFX8-NEXT: v_lshrrev_b32_e32 v5, 16, v5
18376 ; GFX8-NEXT: v_alignbit_b32 v5, v5, v3, 16
18377 ; GFX8-NEXT: flat_atomic_cmpswap v3, v[0:1], v[5:6] glc
18378 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18379 ; GFX8-NEXT: buffer_wbinvl1
18380 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v3, v6
18381 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
18382 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
18383 ; GFX8-NEXT: s_cbranch_execnz .LBB78_1
18384 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
18385 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
18386 ; GFX8-NEXT: v_mov_b32_e32 v0, v3
18387 ; GFX8-NEXT: s_setpc_b64 s[30:31]
18389 ; GFX7-LABEL: flat_agent_atomic_fadd_ret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18391 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18392 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
18393 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
18394 ; GFX7-NEXT: v_mul_f32_e32 v6, 1.0, v3
18395 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
18396 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v2
18397 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18398 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v5
18399 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v5
18400 ; GFX7-NEXT: v_and_b32_e32 v5, 0xffff0000, v6
18401 ; GFX7-NEXT: .LBB78_1: ; %atomicrmw.start
18402 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
18403 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
18404 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
18405 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v2
18406 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
18407 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v2
18408 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v5
18409 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v4
18410 ; GFX7-NEXT: v_alignbit_b32 v3, v2, v3, 16
18411 ; GFX7-NEXT: v_lshrrev_b32_e32 v2, 16, v7
18412 ; GFX7-NEXT: v_alignbit_b32 v2, v2, v6, 16
18413 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[2:3] glc
18414 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18415 ; GFX7-NEXT: buffer_wbinvl1
18416 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v3
18417 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v6
18418 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
18419 ; GFX7-NEXT: v_lshlrev_b32_e32 v3, 16, v6
18420 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
18421 ; GFX7-NEXT: s_cbranch_execnz .LBB78_1
18422 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
18423 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
18424 ; GFX7-NEXT: v_mov_b32_e32 v0, v3
18425 ; GFX7-NEXT: v_mov_b32_e32 v1, v2
18426 ; GFX7-NEXT: s_setpc_b64 s[30:31]
18427 %result = atomicrmw fadd ptr %ptr, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory !0
18428 ret <2 x bfloat> %result
18431 define void @flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory(ptr %ptr, <2 x bfloat> %val) #0 {
18432 ; GFX12-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18434 ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
18435 ; GFX12-NEXT: s_wait_expcnt 0x0
18436 ; GFX12-NEXT: s_wait_samplecnt 0x0
18437 ; GFX12-NEXT: s_wait_bvhcnt 0x0
18438 ; GFX12-NEXT: s_wait_kmcnt 0x0
18439 ; GFX12-NEXT: global_wb scope:SCOPE_DEV
18440 ; GFX12-NEXT: s_wait_storecnt 0x0
18441 ; GFX12-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2 scope:SCOPE_DEV
18442 ; GFX12-NEXT: s_wait_storecnt_dscnt 0x0
18443 ; GFX12-NEXT: global_inv scope:SCOPE_DEV
18444 ; GFX12-NEXT: s_setpc_b64 s[30:31]
18446 ; GFX940-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18448 ; GFX940-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18449 ; GFX940-NEXT: buffer_wbl2 sc1
18450 ; GFX940-NEXT: flat_atomic_pk_add_bf16 v[0:1], v2
18451 ; GFX940-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18452 ; GFX940-NEXT: buffer_inv sc1
18453 ; GFX940-NEXT: s_setpc_b64 s[30:31]
18455 ; GFX11-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18457 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18458 ; GFX11-NEXT: flat_load_b32 v3, v[0:1]
18459 ; GFX11-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18460 ; GFX11-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
18461 ; GFX11-NEXT: s_mov_b32 s1, 0
18462 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x1
18463 ; GFX11-NEXT: .p2align 6
18464 ; GFX11-NEXT: .LBB79_1: ; %atomicrmw.start
18465 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
18466 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18467 ; GFX11-NEXT: v_lshlrev_b32_e32 v2, 16, v3
18468 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
18469 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
18470 ; GFX11-NEXT: v_add_f32_e32 v2, v2, v4
18471 ; GFX11-NEXT: v_add_f32_e32 v6, v6, v5
18472 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
18473 ; GFX11-NEXT: v_bfe_u32 v7, v2, 16, 1
18474 ; GFX11-NEXT: v_bfe_u32 v8, v6, 16, 1
18475 ; GFX11-NEXT: v_or_b32_e32 v9, 0x400000, v2
18476 ; GFX11-NEXT: v_or_b32_e32 v10, 0x400000, v6
18477 ; GFX11-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
18478 ; GFX11-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
18479 ; GFX11-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
18480 ; GFX11-NEXT: v_cmp_u_f32_e64 s0, v2, v2
18481 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
18482 ; GFX11-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
18483 ; GFX11-NEXT: v_cndmask_b32_e64 v2, v7, v9, s0
18484 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
18485 ; GFX11-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
18486 ; GFX11-NEXT: s_waitcnt_vscnt null, 0x0
18487 ; GFX11-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] glc
18488 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18489 ; GFX11-NEXT: buffer_gl1_inv
18490 ; GFX11-NEXT: buffer_gl0_inv
18491 ; GFX11-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
18492 ; GFX11-NEXT: v_mov_b32_e32 v3, v2
18493 ; GFX11-NEXT: s_or_b32 s1, vcc_lo, s1
18494 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
18495 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s1
18496 ; GFX11-NEXT: s_cbranch_execnz .LBB79_1
18497 ; GFX11-NEXT: ; %bb.2: ; %atomicrmw.end
18498 ; GFX11-NEXT: s_set_inst_prefetch_distance 0x2
18499 ; GFX11-NEXT: s_or_b32 exec_lo, exec_lo, s1
18500 ; GFX11-NEXT: s_setpc_b64 s[30:31]
18502 ; GFX10-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18504 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18505 ; GFX10-NEXT: flat_load_dword v3, v[0:1]
18506 ; GFX10-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18507 ; GFX10-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
18508 ; GFX10-NEXT: s_mov_b32 s5, 0
18509 ; GFX10-NEXT: .LBB79_1: ; %atomicrmw.start
18510 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
18511 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18512 ; GFX10-NEXT: v_lshlrev_b32_e32 v2, 16, v3
18513 ; GFX10-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
18514 ; GFX10-NEXT: v_add_f32_e32 v2, v2, v4
18515 ; GFX10-NEXT: v_add_f32_e32 v6, v6, v5
18516 ; GFX10-NEXT: v_bfe_u32 v7, v2, 16, 1
18517 ; GFX10-NEXT: v_bfe_u32 v8, v6, 16, 1
18518 ; GFX10-NEXT: v_or_b32_e32 v9, 0x400000, v2
18519 ; GFX10-NEXT: v_or_b32_e32 v10, 0x400000, v6
18520 ; GFX10-NEXT: v_cmp_u_f32_e32 vcc_lo, v6, v6
18521 ; GFX10-NEXT: v_add3_u32 v7, v7, v2, 0x7fff
18522 ; GFX10-NEXT: v_add3_u32 v8, v8, v6, 0x7fff
18523 ; GFX10-NEXT: v_cmp_u_f32_e64 s4, v2, v2
18524 ; GFX10-NEXT: v_cndmask_b32_e32 v6, v8, v10, vcc_lo
18525 ; GFX10-NEXT: v_cndmask_b32_e64 v2, v7, v9, s4
18526 ; GFX10-NEXT: v_perm_b32 v2, v6, v2, 0x7060302
18527 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
18528 ; GFX10-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18529 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18530 ; GFX10-NEXT: buffer_gl1_inv
18531 ; GFX10-NEXT: buffer_gl0_inv
18532 ; GFX10-NEXT: v_cmp_eq_u32_e32 vcc_lo, v2, v3
18533 ; GFX10-NEXT: v_mov_b32_e32 v3, v2
18534 ; GFX10-NEXT: s_or_b32 s5, vcc_lo, s5
18535 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s5
18536 ; GFX10-NEXT: s_cbranch_execnz .LBB79_1
18537 ; GFX10-NEXT: ; %bb.2: ; %atomicrmw.end
18538 ; GFX10-NEXT: s_or_b32 exec_lo, exec_lo, s5
18539 ; GFX10-NEXT: s_setpc_b64 s[30:31]
18541 ; GFX90A-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18543 ; GFX90A-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18544 ; GFX90A-NEXT: flat_load_dword v3, v[0:1]
18545 ; GFX90A-NEXT: s_mov_b64 s[6:7], 0
18546 ; GFX90A-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18547 ; GFX90A-NEXT: s_movk_i32 s8, 0x7fff
18548 ; GFX90A-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
18549 ; GFX90A-NEXT: s_mov_b32 s9, 0x7060302
18550 ; GFX90A-NEXT: .LBB79_1: ; %atomicrmw.start
18551 ; GFX90A-NEXT: ; =>This Inner Loop Header: Depth=1
18552 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18553 ; GFX90A-NEXT: v_lshlrev_b32_e32 v2, 16, v3
18554 ; GFX90A-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
18555 ; GFX90A-NEXT: v_add_f32_e32 v2, v2, v4
18556 ; GFX90A-NEXT: v_add_f32_e32 v6, v6, v5
18557 ; GFX90A-NEXT: v_bfe_u32 v7, v2, 16, 1
18558 ; GFX90A-NEXT: v_bfe_u32 v9, v6, 16, 1
18559 ; GFX90A-NEXT: v_or_b32_e32 v8, 0x400000, v2
18560 ; GFX90A-NEXT: v_or_b32_e32 v10, 0x400000, v6
18561 ; GFX90A-NEXT: v_add3_u32 v7, v7, v2, s8
18562 ; GFX90A-NEXT: v_add3_u32 v9, v9, v6, s8
18563 ; GFX90A-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
18564 ; GFX90A-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
18565 ; GFX90A-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
18566 ; GFX90A-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
18567 ; GFX90A-NEXT: v_perm_b32 v2, v6, v2, s9
18568 ; GFX90A-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18569 ; GFX90A-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18570 ; GFX90A-NEXT: buffer_wbinvl1
18571 ; GFX90A-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
18572 ; GFX90A-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
18573 ; GFX90A-NEXT: v_mov_b32_e32 v3, v2
18574 ; GFX90A-NEXT: s_andn2_b64 exec, exec, s[6:7]
18575 ; GFX90A-NEXT: s_cbranch_execnz .LBB79_1
18576 ; GFX90A-NEXT: ; %bb.2: ; %atomicrmw.end
18577 ; GFX90A-NEXT: s_or_b64 exec, exec, s[6:7]
18578 ; GFX90A-NEXT: s_setpc_b64 s[30:31]
18580 ; GFX908-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18582 ; GFX908-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18583 ; GFX908-NEXT: flat_load_dword v3, v[0:1]
18584 ; GFX908-NEXT: s_mov_b64 s[6:7], 0
18585 ; GFX908-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18586 ; GFX908-NEXT: s_movk_i32 s8, 0x7fff
18587 ; GFX908-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
18588 ; GFX908-NEXT: s_mov_b32 s9, 0x7060302
18589 ; GFX908-NEXT: .LBB79_1: ; %atomicrmw.start
18590 ; GFX908-NEXT: ; =>This Inner Loop Header: Depth=1
18591 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18592 ; GFX908-NEXT: v_lshlrev_b32_e32 v2, 16, v3
18593 ; GFX908-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
18594 ; GFX908-NEXT: v_add_f32_e32 v2, v2, v4
18595 ; GFX908-NEXT: v_add_f32_e32 v6, v6, v5
18596 ; GFX908-NEXT: v_bfe_u32 v7, v2, 16, 1
18597 ; GFX908-NEXT: v_bfe_u32 v9, v6, 16, 1
18598 ; GFX908-NEXT: v_or_b32_e32 v8, 0x400000, v2
18599 ; GFX908-NEXT: v_or_b32_e32 v10, 0x400000, v6
18600 ; GFX908-NEXT: v_add3_u32 v7, v7, v2, s8
18601 ; GFX908-NEXT: v_add3_u32 v9, v9, v6, s8
18602 ; GFX908-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
18603 ; GFX908-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
18604 ; GFX908-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
18605 ; GFX908-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
18606 ; GFX908-NEXT: v_perm_b32 v2, v6, v2, s9
18607 ; GFX908-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18608 ; GFX908-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18609 ; GFX908-NEXT: buffer_wbinvl1
18610 ; GFX908-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
18611 ; GFX908-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
18612 ; GFX908-NEXT: v_mov_b32_e32 v3, v2
18613 ; GFX908-NEXT: s_andn2_b64 exec, exec, s[6:7]
18614 ; GFX908-NEXT: s_cbranch_execnz .LBB79_1
18615 ; GFX908-NEXT: ; %bb.2: ; %atomicrmw.end
18616 ; GFX908-NEXT: s_or_b64 exec, exec, s[6:7]
18617 ; GFX908-NEXT: s_setpc_b64 s[30:31]
18619 ; GFX8-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18621 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18622 ; GFX8-NEXT: flat_load_dword v3, v[0:1]
18623 ; GFX8-NEXT: s_mov_b64 s[6:7], 0
18624 ; GFX8-NEXT: v_lshlrev_b32_e32 v4, 16, v2
18625 ; GFX8-NEXT: v_and_b32_e32 v5, 0xffff0000, v2
18626 ; GFX8-NEXT: .LBB79_1: ; %atomicrmw.start
18627 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
18628 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18629 ; GFX8-NEXT: v_lshlrev_b32_e32 v2, 16, v3
18630 ; GFX8-NEXT: v_and_b32_e32 v6, 0xffff0000, v3
18631 ; GFX8-NEXT: v_add_f32_e32 v2, v2, v4
18632 ; GFX8-NEXT: v_add_f32_e32 v6, v6, v5
18633 ; GFX8-NEXT: v_bfe_u32 v7, v2, 16, 1
18634 ; GFX8-NEXT: v_bfe_u32 v9, v6, 16, 1
18635 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, v7, v2
18636 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, v9, v6
18637 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0x7fff, v7
18638 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0x7fff, v9
18639 ; GFX8-NEXT: v_or_b32_e32 v10, 0x400000, v6
18640 ; GFX8-NEXT: v_cmp_u_f32_e32 vcc, v6, v6
18641 ; GFX8-NEXT: v_or_b32_e32 v8, 0x400000, v2
18642 ; GFX8-NEXT: v_cmp_u_f32_e64 s[4:5], v2, v2
18643 ; GFX8-NEXT: v_cndmask_b32_e32 v6, v9, v10, vcc
18644 ; GFX8-NEXT: v_cndmask_b32_e64 v2, v7, v8, s[4:5]
18645 ; GFX8-NEXT: v_lshrrev_b32_e32 v6, 16, v6
18646 ; GFX8-NEXT: v_alignbit_b32 v2, v6, v2, 16
18647 ; GFX8-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
18648 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18649 ; GFX8-NEXT: buffer_wbinvl1
18650 ; GFX8-NEXT: v_cmp_eq_u32_e32 vcc, v2, v3
18651 ; GFX8-NEXT: s_or_b64 s[6:7], vcc, s[6:7]
18652 ; GFX8-NEXT: v_mov_b32_e32 v3, v2
18653 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[6:7]
18654 ; GFX8-NEXT: s_cbranch_execnz .LBB79_1
18655 ; GFX8-NEXT: ; %bb.2: ; %atomicrmw.end
18656 ; GFX8-NEXT: s_or_b64 exec, exec, s[6:7]
18657 ; GFX8-NEXT: s_setpc_b64 s[30:31]
18659 ; GFX7-LABEL: flat_agent_atomic_fadd_noret_v2bf16__amdgpu_no_fine_grained_memory__amdgpu_no_remote_memory:
18661 ; GFX7-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18662 ; GFX7-NEXT: flat_load_dword v5, v[0:1]
18663 ; GFX7-NEXT: v_mul_f32_e32 v2, 1.0, v2
18664 ; GFX7-NEXT: v_mul_f32_e32 v3, 1.0, v3
18665 ; GFX7-NEXT: s_mov_b64 s[4:5], 0
18666 ; GFX7-NEXT: v_and_b32_e32 v2, 0xffff0000, v2
18667 ; GFX7-NEXT: v_and_b32_e32 v3, 0xffff0000, v3
18668 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18669 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v5
18670 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v5
18671 ; GFX7-NEXT: .LBB79_1: ; %atomicrmw.start
18672 ; GFX7-NEXT: ; =>This Inner Loop Header: Depth=1
18673 ; GFX7-NEXT: v_mul_f32_e32 v4, 1.0, v4
18674 ; GFX7-NEXT: v_mul_f32_e32 v5, 1.0, v5
18675 ; GFX7-NEXT: v_and_b32_e32 v7, 0xffff0000, v4
18676 ; GFX7-NEXT: v_and_b32_e32 v6, 0xffff0000, v5
18677 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v4
18678 ; GFX7-NEXT: v_add_f32_e32 v7, v7, v3
18679 ; GFX7-NEXT: v_add_f32_e32 v6, v6, v2
18680 ; GFX7-NEXT: v_alignbit_b32 v5, v4, v5, 16
18681 ; GFX7-NEXT: v_lshrrev_b32_e32 v4, 16, v7
18682 ; GFX7-NEXT: v_alignbit_b32 v4, v4, v6, 16
18683 ; GFX7-NEXT: flat_atomic_cmpswap v6, v[0:1], v[4:5] glc
18684 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
18685 ; GFX7-NEXT: buffer_wbinvl1
18686 ; GFX7-NEXT: v_cmp_eq_u32_e32 vcc, v6, v5
18687 ; GFX7-NEXT: v_and_b32_e32 v4, 0xffff0000, v6
18688 ; GFX7-NEXT: s_or_b64 s[4:5], vcc, s[4:5]
18689 ; GFX7-NEXT: v_lshlrev_b32_e32 v5, 16, v6
18690 ; GFX7-NEXT: s_andn2_b64 exec, exec, s[4:5]
18691 ; GFX7-NEXT: s_cbranch_execnz .LBB79_1
18692 ; GFX7-NEXT: ; %bb.2: ; %atomicrmw.end
18693 ; GFX7-NEXT: s_or_b64 exec, exec, s[4:5]
18694 ; GFX7-NEXT: s_setpc_b64 s[30:31]
18695 %unused = atomicrmw fadd ptr %ptr, <2 x bfloat> %val syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.no.remote.memory !0
18699 attributes #0 = { nounwind "amdgpu-unsafe-fp-atomics"="true" }
18700 attributes #1 = { nounwind "denormal-fp-math-f32"="preserve-sign,preserve-sign" "amdgpu-unsafe-fp-atomics"="true" }