1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx600 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX6 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX7 %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-WGP %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=+cumode -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-CU %s
6 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx700 -amdgcn-skip-cache-invalidations -verify-machineinstrs < %s | FileCheck --check-prefixes=SKIP-CACHE-INV %s
7 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX90A-NOTTGSPLIT %s
8 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -mattr=+tgsplit -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX90A-TGSPLIT %s
9 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX940-NOTTGSPLIT %s
10 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 -mattr=+tgsplit -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX940-TGSPLIT %s
11 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11-WGP %s
12 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=+cumode -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11-CU %s
14 define amdgpu_kernel void @local_wavefront_unordered_load(
15 ; GFX6-LABEL: local_wavefront_unordered_load:
16 ; GFX6: ; %bb.0: ; %entry
17 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18 ; GFX6-NEXT: s_mov_b32 m0, -1
19 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
20 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
21 ; GFX6-NEXT: ds_read_b32 v0, v0
22 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
23 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
24 ; GFX6-NEXT: ds_write_b32 v1, v0
27 ; GFX7-LABEL: local_wavefront_unordered_load:
28 ; GFX7: ; %bb.0: ; %entry
29 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
30 ; GFX7-NEXT: s_mov_b32 m0, -1
31 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
32 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
33 ; GFX7-NEXT: ds_read_b32 v0, v0
34 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
35 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
36 ; GFX7-NEXT: ds_write_b32 v1, v0
39 ; GFX10-WGP-LABEL: local_wavefront_unordered_load:
40 ; GFX10-WGP: ; %bb.0: ; %entry
41 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
42 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
43 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
44 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
45 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
46 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
47 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
48 ; GFX10-WGP-NEXT: s_endpgm
50 ; GFX10-CU-LABEL: local_wavefront_unordered_load:
51 ; GFX10-CU: ; %bb.0: ; %entry
52 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
53 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
54 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
55 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
56 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
57 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
58 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
59 ; GFX10-CU-NEXT: s_endpgm
61 ; SKIP-CACHE-INV-LABEL: local_wavefront_unordered_load:
62 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
63 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
64 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
65 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
66 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
67 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
68 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
69 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
70 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
71 ; SKIP-CACHE-INV-NEXT: s_endpgm
73 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_unordered_load:
74 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
75 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
76 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
77 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
78 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
79 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
80 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
81 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
82 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
84 ; GFX90A-TGSPLIT-LABEL: local_wavefront_unordered_load:
85 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
86 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
87 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
88 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
89 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
90 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
91 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
92 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
93 ; GFX90A-TGSPLIT-NEXT: s_endpgm
95 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_unordered_load:
96 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
97 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
98 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
99 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
100 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
101 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
102 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
103 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
104 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
106 ; GFX940-TGSPLIT-LABEL: local_wavefront_unordered_load:
107 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
108 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
109 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
110 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
111 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v0, v0
112 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
113 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
114 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v1, v0
115 ; GFX940-TGSPLIT-NEXT: s_endpgm
117 ; GFX11-WGP-LABEL: local_wavefront_unordered_load:
118 ; GFX11-WGP: ; %bb.0: ; %entry
119 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
120 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
121 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
122 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
123 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
124 ; GFX11-WGP-NEXT: ds_store_b32 v1, v0
125 ; GFX11-WGP-NEXT: s_endpgm
127 ; GFX11-CU-LABEL: local_wavefront_unordered_load:
128 ; GFX11-CU: ; %bb.0: ; %entry
129 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
130 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
131 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
132 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
133 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
134 ; GFX11-CU-NEXT: ds_store_b32 v1, v0
135 ; GFX11-CU-NEXT: s_endpgm
136 ptr addrspace(3) %in, ptr addrspace(3) %out) {
138 %val = load atomic i32, ptr addrspace(3) %in syncscope("wavefront") unordered, align 4
139 store i32 %val, ptr addrspace(3) %out
143 define amdgpu_kernel void @local_wavefront_monotonic_load(
144 ; GFX6-LABEL: local_wavefront_monotonic_load:
145 ; GFX6: ; %bb.0: ; %entry
146 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
147 ; GFX6-NEXT: s_mov_b32 m0, -1
148 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
149 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
150 ; GFX6-NEXT: ds_read_b32 v0, v0
151 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
152 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
153 ; GFX6-NEXT: ds_write_b32 v1, v0
154 ; GFX6-NEXT: s_endpgm
156 ; GFX7-LABEL: local_wavefront_monotonic_load:
157 ; GFX7: ; %bb.0: ; %entry
158 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
159 ; GFX7-NEXT: s_mov_b32 m0, -1
160 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
161 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
162 ; GFX7-NEXT: ds_read_b32 v0, v0
163 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
164 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
165 ; GFX7-NEXT: ds_write_b32 v1, v0
166 ; GFX7-NEXT: s_endpgm
168 ; GFX10-WGP-LABEL: local_wavefront_monotonic_load:
169 ; GFX10-WGP: ; %bb.0: ; %entry
170 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
171 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
172 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
173 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
174 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
175 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
176 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
177 ; GFX10-WGP-NEXT: s_endpgm
179 ; GFX10-CU-LABEL: local_wavefront_monotonic_load:
180 ; GFX10-CU: ; %bb.0: ; %entry
181 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
182 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
183 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
184 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
185 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
186 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
187 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
188 ; GFX10-CU-NEXT: s_endpgm
190 ; SKIP-CACHE-INV-LABEL: local_wavefront_monotonic_load:
191 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
192 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
193 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
194 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
195 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
196 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
197 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
198 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
199 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
200 ; SKIP-CACHE-INV-NEXT: s_endpgm
202 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_monotonic_load:
203 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
204 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
205 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
206 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
207 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
208 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
209 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
210 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
211 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
213 ; GFX90A-TGSPLIT-LABEL: local_wavefront_monotonic_load:
214 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
215 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
216 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
217 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
218 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
219 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
220 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
221 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
222 ; GFX90A-TGSPLIT-NEXT: s_endpgm
224 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_monotonic_load:
225 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
226 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
227 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
228 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
229 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
230 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
231 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
232 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
233 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
235 ; GFX940-TGSPLIT-LABEL: local_wavefront_monotonic_load:
236 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
237 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
238 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
239 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
240 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v0, v0
241 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
242 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
243 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v1, v0
244 ; GFX940-TGSPLIT-NEXT: s_endpgm
246 ; GFX11-WGP-LABEL: local_wavefront_monotonic_load:
247 ; GFX11-WGP: ; %bb.0: ; %entry
248 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
249 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
250 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
251 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
252 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
253 ; GFX11-WGP-NEXT: ds_store_b32 v1, v0
254 ; GFX11-WGP-NEXT: s_endpgm
256 ; GFX11-CU-LABEL: local_wavefront_monotonic_load:
257 ; GFX11-CU: ; %bb.0: ; %entry
258 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
259 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
260 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
261 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
262 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
263 ; GFX11-CU-NEXT: ds_store_b32 v1, v0
264 ; GFX11-CU-NEXT: s_endpgm
265 ptr addrspace(3) %in, ptr addrspace(3) %out) {
267 %val = load atomic i32, ptr addrspace(3) %in syncscope("wavefront") monotonic, align 4
268 store i32 %val, ptr addrspace(3) %out
272 define amdgpu_kernel void @local_wavefront_acquire_load(
273 ; GFX6-LABEL: local_wavefront_acquire_load:
274 ; GFX6: ; %bb.0: ; %entry
275 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
276 ; GFX6-NEXT: s_mov_b32 m0, -1
277 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
278 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
279 ; GFX6-NEXT: ds_read_b32 v0, v0
280 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
281 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
282 ; GFX6-NEXT: ds_write_b32 v1, v0
283 ; GFX6-NEXT: s_endpgm
285 ; GFX7-LABEL: local_wavefront_acquire_load:
286 ; GFX7: ; %bb.0: ; %entry
287 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
288 ; GFX7-NEXT: s_mov_b32 m0, -1
289 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
290 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
291 ; GFX7-NEXT: ds_read_b32 v0, v0
292 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
293 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
294 ; GFX7-NEXT: ds_write_b32 v1, v0
295 ; GFX7-NEXT: s_endpgm
297 ; GFX10-WGP-LABEL: local_wavefront_acquire_load:
298 ; GFX10-WGP: ; %bb.0: ; %entry
299 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
300 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
301 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
302 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
303 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
304 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
305 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
306 ; GFX10-WGP-NEXT: s_endpgm
308 ; GFX10-CU-LABEL: local_wavefront_acquire_load:
309 ; GFX10-CU: ; %bb.0: ; %entry
310 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
311 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
312 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
313 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
314 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
315 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
316 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
317 ; GFX10-CU-NEXT: s_endpgm
319 ; SKIP-CACHE-INV-LABEL: local_wavefront_acquire_load:
320 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
321 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
322 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
323 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
324 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
325 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
326 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
327 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
328 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
329 ; SKIP-CACHE-INV-NEXT: s_endpgm
331 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acquire_load:
332 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
333 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
334 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
335 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
336 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
337 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
338 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
339 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
340 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
342 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acquire_load:
343 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
344 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
345 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
346 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
347 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
348 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
349 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
350 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
351 ; GFX90A-TGSPLIT-NEXT: s_endpgm
353 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acquire_load:
354 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
355 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
356 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
357 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
358 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
359 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
360 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
361 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
362 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
364 ; GFX940-TGSPLIT-LABEL: local_wavefront_acquire_load:
365 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
366 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
367 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
368 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
369 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v0, v0
370 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
371 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
372 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v1, v0
373 ; GFX940-TGSPLIT-NEXT: s_endpgm
375 ; GFX11-WGP-LABEL: local_wavefront_acquire_load:
376 ; GFX11-WGP: ; %bb.0: ; %entry
377 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
378 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
379 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
380 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
381 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
382 ; GFX11-WGP-NEXT: ds_store_b32 v1, v0
383 ; GFX11-WGP-NEXT: s_endpgm
385 ; GFX11-CU-LABEL: local_wavefront_acquire_load:
386 ; GFX11-CU: ; %bb.0: ; %entry
387 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
388 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
389 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
390 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
391 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
392 ; GFX11-CU-NEXT: ds_store_b32 v1, v0
393 ; GFX11-CU-NEXT: s_endpgm
394 ptr addrspace(3) %in, ptr addrspace(3) %out) {
396 %val = load atomic i32, ptr addrspace(3) %in syncscope("wavefront") acquire, align 4
397 store i32 %val, ptr addrspace(3) %out
401 define amdgpu_kernel void @local_wavefront_seq_cst_load(
402 ; GFX6-LABEL: local_wavefront_seq_cst_load:
403 ; GFX6: ; %bb.0: ; %entry
404 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
405 ; GFX6-NEXT: s_mov_b32 m0, -1
406 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
407 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
408 ; GFX6-NEXT: ds_read_b32 v0, v0
409 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
410 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
411 ; GFX6-NEXT: ds_write_b32 v1, v0
412 ; GFX6-NEXT: s_endpgm
414 ; GFX7-LABEL: local_wavefront_seq_cst_load:
415 ; GFX7: ; %bb.0: ; %entry
416 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
417 ; GFX7-NEXT: s_mov_b32 m0, -1
418 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
419 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
420 ; GFX7-NEXT: ds_read_b32 v0, v0
421 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
422 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
423 ; GFX7-NEXT: ds_write_b32 v1, v0
424 ; GFX7-NEXT: s_endpgm
426 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_load:
427 ; GFX10-WGP: ; %bb.0: ; %entry
428 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
429 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
430 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
431 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
432 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
433 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
434 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
435 ; GFX10-WGP-NEXT: s_endpgm
437 ; GFX10-CU-LABEL: local_wavefront_seq_cst_load:
438 ; GFX10-CU: ; %bb.0: ; %entry
439 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
440 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
441 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
442 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
443 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
444 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
445 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
446 ; GFX10-CU-NEXT: s_endpgm
448 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_load:
449 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
450 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
451 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
452 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
453 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
454 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
455 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
456 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
457 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
458 ; SKIP-CACHE-INV-NEXT: s_endpgm
460 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_load:
461 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
462 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
463 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
464 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
465 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
466 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
467 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
468 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
469 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
471 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_load:
472 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
473 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
474 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
475 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
476 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
477 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
478 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
479 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
480 ; GFX90A-TGSPLIT-NEXT: s_endpgm
482 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_load:
483 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
484 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
485 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
486 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
487 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
488 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
489 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
490 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
491 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
493 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_load:
494 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
495 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
496 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
497 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
498 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v0, v0
499 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
500 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
501 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v1, v0
502 ; GFX940-TGSPLIT-NEXT: s_endpgm
504 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_load:
505 ; GFX11-WGP: ; %bb.0: ; %entry
506 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
507 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
508 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
509 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
510 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
511 ; GFX11-WGP-NEXT: ds_store_b32 v1, v0
512 ; GFX11-WGP-NEXT: s_endpgm
514 ; GFX11-CU-LABEL: local_wavefront_seq_cst_load:
515 ; GFX11-CU: ; %bb.0: ; %entry
516 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
517 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
518 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
519 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
520 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
521 ; GFX11-CU-NEXT: ds_store_b32 v1, v0
522 ; GFX11-CU-NEXT: s_endpgm
523 ptr addrspace(3) %in, ptr addrspace(3) %out) {
525 %val = load atomic i32, ptr addrspace(3) %in syncscope("wavefront") seq_cst, align 4
526 store i32 %val, ptr addrspace(3) %out
530 define amdgpu_kernel void @local_wavefront_unordered_store(
531 ; GFX6-LABEL: local_wavefront_unordered_store:
532 ; GFX6: ; %bb.0: ; %entry
533 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
534 ; GFX6-NEXT: s_mov_b32 m0, -1
535 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
536 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
537 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
538 ; GFX6-NEXT: ds_write_b32 v0, v1
539 ; GFX6-NEXT: s_endpgm
541 ; GFX7-LABEL: local_wavefront_unordered_store:
542 ; GFX7: ; %bb.0: ; %entry
543 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
544 ; GFX7-NEXT: s_mov_b32 m0, -1
545 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
546 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
547 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
548 ; GFX7-NEXT: ds_write_b32 v0, v1
549 ; GFX7-NEXT: s_endpgm
551 ; GFX10-WGP-LABEL: local_wavefront_unordered_store:
552 ; GFX10-WGP: ; %bb.0: ; %entry
553 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
554 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
555 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
556 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
557 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
558 ; GFX10-WGP-NEXT: s_endpgm
560 ; GFX10-CU-LABEL: local_wavefront_unordered_store:
561 ; GFX10-CU: ; %bb.0: ; %entry
562 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
563 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
564 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
565 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
566 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
567 ; GFX10-CU-NEXT: s_endpgm
569 ; SKIP-CACHE-INV-LABEL: local_wavefront_unordered_store:
570 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
571 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
572 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
573 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
574 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
575 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
576 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
577 ; SKIP-CACHE-INV-NEXT: s_endpgm
579 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_unordered_store:
580 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
581 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
582 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
583 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
584 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
585 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
586 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
588 ; GFX90A-TGSPLIT-LABEL: local_wavefront_unordered_store:
589 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
590 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
591 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
592 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
593 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
594 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
595 ; GFX90A-TGSPLIT-NEXT: s_endpgm
597 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_unordered_store:
598 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
599 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
600 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
601 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
602 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
603 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
604 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
606 ; GFX940-TGSPLIT-LABEL: local_wavefront_unordered_store:
607 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
608 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
609 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
610 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
611 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
612 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
613 ; GFX940-TGSPLIT-NEXT: s_endpgm
615 ; GFX11-WGP-LABEL: local_wavefront_unordered_store:
616 ; GFX11-WGP: ; %bb.0: ; %entry
617 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
618 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
619 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
620 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
621 ; GFX11-WGP-NEXT: s_endpgm
623 ; GFX11-CU-LABEL: local_wavefront_unordered_store:
624 ; GFX11-CU: ; %bb.0: ; %entry
625 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
626 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
627 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
628 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
629 ; GFX11-CU-NEXT: s_endpgm
630 i32 %in, ptr addrspace(3) %out) {
632 store atomic i32 %in, ptr addrspace(3) %out syncscope("wavefront") unordered, align 4
636 define amdgpu_kernel void @local_wavefront_monotonic_store(
637 ; GFX6-LABEL: local_wavefront_monotonic_store:
638 ; GFX6: ; %bb.0: ; %entry
639 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
640 ; GFX6-NEXT: s_mov_b32 m0, -1
641 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
642 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
643 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
644 ; GFX6-NEXT: ds_write_b32 v0, v1
645 ; GFX6-NEXT: s_endpgm
647 ; GFX7-LABEL: local_wavefront_monotonic_store:
648 ; GFX7: ; %bb.0: ; %entry
649 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
650 ; GFX7-NEXT: s_mov_b32 m0, -1
651 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
652 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
653 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
654 ; GFX7-NEXT: ds_write_b32 v0, v1
655 ; GFX7-NEXT: s_endpgm
657 ; GFX10-WGP-LABEL: local_wavefront_monotonic_store:
658 ; GFX10-WGP: ; %bb.0: ; %entry
659 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
660 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
661 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
662 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
663 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
664 ; GFX10-WGP-NEXT: s_endpgm
666 ; GFX10-CU-LABEL: local_wavefront_monotonic_store:
667 ; GFX10-CU: ; %bb.0: ; %entry
668 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
669 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
670 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
671 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
672 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
673 ; GFX10-CU-NEXT: s_endpgm
675 ; SKIP-CACHE-INV-LABEL: local_wavefront_monotonic_store:
676 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
677 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
678 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
679 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
680 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
681 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
682 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
683 ; SKIP-CACHE-INV-NEXT: s_endpgm
685 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_monotonic_store:
686 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
687 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
688 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
689 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
690 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
691 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
692 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
694 ; GFX90A-TGSPLIT-LABEL: local_wavefront_monotonic_store:
695 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
696 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
697 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
698 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
699 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
700 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
701 ; GFX90A-TGSPLIT-NEXT: s_endpgm
703 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_monotonic_store:
704 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
705 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
706 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
707 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
708 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
709 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
710 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
712 ; GFX940-TGSPLIT-LABEL: local_wavefront_monotonic_store:
713 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
714 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
715 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
716 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
717 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
718 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
719 ; GFX940-TGSPLIT-NEXT: s_endpgm
721 ; GFX11-WGP-LABEL: local_wavefront_monotonic_store:
722 ; GFX11-WGP: ; %bb.0: ; %entry
723 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
724 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
725 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
726 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
727 ; GFX11-WGP-NEXT: s_endpgm
729 ; GFX11-CU-LABEL: local_wavefront_monotonic_store:
730 ; GFX11-CU: ; %bb.0: ; %entry
731 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
732 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
733 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
734 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
735 ; GFX11-CU-NEXT: s_endpgm
736 i32 %in, ptr addrspace(3) %out) {
738 store atomic i32 %in, ptr addrspace(3) %out syncscope("wavefront") monotonic, align 4
742 define amdgpu_kernel void @local_wavefront_release_store(
743 ; GFX6-LABEL: local_wavefront_release_store:
744 ; GFX6: ; %bb.0: ; %entry
745 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
746 ; GFX6-NEXT: s_mov_b32 m0, -1
747 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
748 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
749 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
750 ; GFX6-NEXT: ds_write_b32 v0, v1
751 ; GFX6-NEXT: s_endpgm
753 ; GFX7-LABEL: local_wavefront_release_store:
754 ; GFX7: ; %bb.0: ; %entry
755 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
756 ; GFX7-NEXT: s_mov_b32 m0, -1
757 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
758 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
759 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
760 ; GFX7-NEXT: ds_write_b32 v0, v1
761 ; GFX7-NEXT: s_endpgm
763 ; GFX10-WGP-LABEL: local_wavefront_release_store:
764 ; GFX10-WGP: ; %bb.0: ; %entry
765 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
766 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
767 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
768 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
769 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
770 ; GFX10-WGP-NEXT: s_endpgm
772 ; GFX10-CU-LABEL: local_wavefront_release_store:
773 ; GFX10-CU: ; %bb.0: ; %entry
774 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
775 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
776 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
777 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
778 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
779 ; GFX10-CU-NEXT: s_endpgm
781 ; SKIP-CACHE-INV-LABEL: local_wavefront_release_store:
782 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
783 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
784 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
785 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
786 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
787 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
788 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
789 ; SKIP-CACHE-INV-NEXT: s_endpgm
791 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_release_store:
792 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
793 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
794 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
795 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
796 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
797 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
798 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
800 ; GFX90A-TGSPLIT-LABEL: local_wavefront_release_store:
801 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
802 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
803 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
804 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
805 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
806 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
807 ; GFX90A-TGSPLIT-NEXT: s_endpgm
809 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_release_store:
810 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
811 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
812 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
813 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
814 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
815 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
816 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
818 ; GFX940-TGSPLIT-LABEL: local_wavefront_release_store:
819 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
820 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
821 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
822 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
823 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
824 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
825 ; GFX940-TGSPLIT-NEXT: s_endpgm
827 ; GFX11-WGP-LABEL: local_wavefront_release_store:
828 ; GFX11-WGP: ; %bb.0: ; %entry
829 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
830 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
831 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
832 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
833 ; GFX11-WGP-NEXT: s_endpgm
835 ; GFX11-CU-LABEL: local_wavefront_release_store:
836 ; GFX11-CU: ; %bb.0: ; %entry
837 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
838 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
839 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
840 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
841 ; GFX11-CU-NEXT: s_endpgm
842 i32 %in, ptr addrspace(3) %out) {
844 store atomic i32 %in, ptr addrspace(3) %out syncscope("wavefront") release, align 4
848 define amdgpu_kernel void @local_wavefront_seq_cst_store(
849 ; GFX6-LABEL: local_wavefront_seq_cst_store:
850 ; GFX6: ; %bb.0: ; %entry
851 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
852 ; GFX6-NEXT: s_mov_b32 m0, -1
853 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
854 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
855 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
856 ; GFX6-NEXT: ds_write_b32 v0, v1
857 ; GFX6-NEXT: s_endpgm
859 ; GFX7-LABEL: local_wavefront_seq_cst_store:
860 ; GFX7: ; %bb.0: ; %entry
861 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
862 ; GFX7-NEXT: s_mov_b32 m0, -1
863 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
864 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
865 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
866 ; GFX7-NEXT: ds_write_b32 v0, v1
867 ; GFX7-NEXT: s_endpgm
869 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_store:
870 ; GFX10-WGP: ; %bb.0: ; %entry
871 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
872 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
873 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
874 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
875 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
876 ; GFX10-WGP-NEXT: s_endpgm
878 ; GFX10-CU-LABEL: local_wavefront_seq_cst_store:
879 ; GFX10-CU: ; %bb.0: ; %entry
880 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
881 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
882 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
883 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
884 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
885 ; GFX10-CU-NEXT: s_endpgm
887 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_store:
888 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
889 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
890 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
891 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
892 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
893 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
894 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
895 ; SKIP-CACHE-INV-NEXT: s_endpgm
897 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_store:
898 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
899 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
900 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
901 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
902 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
903 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
904 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
906 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_store:
907 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
908 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
909 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
910 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
911 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
912 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
913 ; GFX90A-TGSPLIT-NEXT: s_endpgm
915 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_store:
916 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
917 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
918 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
919 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
920 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
921 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
922 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
924 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_store:
925 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
926 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
927 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
928 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
929 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
930 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
931 ; GFX940-TGSPLIT-NEXT: s_endpgm
933 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_store:
934 ; GFX11-WGP: ; %bb.0: ; %entry
935 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
936 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
937 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
938 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
939 ; GFX11-WGP-NEXT: s_endpgm
941 ; GFX11-CU-LABEL: local_wavefront_seq_cst_store:
942 ; GFX11-CU: ; %bb.0: ; %entry
943 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
944 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
945 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
946 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
947 ; GFX11-CU-NEXT: s_endpgm
948 i32 %in, ptr addrspace(3) %out) {
950 store atomic i32 %in, ptr addrspace(3) %out syncscope("wavefront") seq_cst, align 4
954 define amdgpu_kernel void @local_wavefront_monotonic_atomicrmw(
955 ; GFX6-LABEL: local_wavefront_monotonic_atomicrmw:
956 ; GFX6: ; %bb.0: ; %entry
957 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
958 ; GFX6-NEXT: s_mov_b32 m0, -1
959 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
960 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
961 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
962 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
963 ; GFX6-NEXT: s_endpgm
965 ; GFX7-LABEL: local_wavefront_monotonic_atomicrmw:
966 ; GFX7: ; %bb.0: ; %entry
967 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
968 ; GFX7-NEXT: s_mov_b32 m0, -1
969 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
970 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
971 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
972 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
973 ; GFX7-NEXT: s_endpgm
975 ; GFX10-WGP-LABEL: local_wavefront_monotonic_atomicrmw:
976 ; GFX10-WGP: ; %bb.0: ; %entry
977 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
978 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
979 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
980 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
981 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
982 ; GFX10-WGP-NEXT: s_endpgm
984 ; GFX10-CU-LABEL: local_wavefront_monotonic_atomicrmw:
985 ; GFX10-CU: ; %bb.0: ; %entry
986 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
987 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
988 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
989 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
990 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
991 ; GFX10-CU-NEXT: s_endpgm
993 ; SKIP-CACHE-INV-LABEL: local_wavefront_monotonic_atomicrmw:
994 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
995 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
996 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
997 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
998 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
999 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1000 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1001 ; SKIP-CACHE-INV-NEXT: s_endpgm
1003 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_monotonic_atomicrmw:
1004 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1005 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1006 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1007 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1008 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1009 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1010 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1012 ; GFX90A-TGSPLIT-LABEL: local_wavefront_monotonic_atomicrmw:
1013 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1014 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1015 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1016 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1017 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1018 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1019 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1021 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_monotonic_atomicrmw:
1022 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1023 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1024 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1025 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1026 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1027 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1028 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1030 ; GFX940-TGSPLIT-LABEL: local_wavefront_monotonic_atomicrmw:
1031 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1032 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1033 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1034 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1035 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1036 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1037 ; GFX940-TGSPLIT-NEXT: s_endpgm
1039 ; GFX11-WGP-LABEL: local_wavefront_monotonic_atomicrmw:
1040 ; GFX11-WGP: ; %bb.0: ; %entry
1041 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1042 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1043 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1044 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1045 ; GFX11-WGP-NEXT: s_endpgm
1047 ; GFX11-CU-LABEL: local_wavefront_monotonic_atomicrmw:
1048 ; GFX11-CU: ; %bb.0: ; %entry
1049 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1050 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1051 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1052 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1053 ; GFX11-CU-NEXT: s_endpgm
1054 ptr addrspace(3) %out, i32 %in) {
1056 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront") monotonic
1060 define amdgpu_kernel void @local_wavefront_acquire_atomicrmw(
1061 ; GFX6-LABEL: local_wavefront_acquire_atomicrmw:
1062 ; GFX6: ; %bb.0: ; %entry
1063 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1064 ; GFX6-NEXT: s_mov_b32 m0, -1
1065 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1066 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1067 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1068 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1069 ; GFX6-NEXT: s_endpgm
1071 ; GFX7-LABEL: local_wavefront_acquire_atomicrmw:
1072 ; GFX7: ; %bb.0: ; %entry
1073 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1074 ; GFX7-NEXT: s_mov_b32 m0, -1
1075 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1076 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1077 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1078 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1079 ; GFX7-NEXT: s_endpgm
1081 ; GFX10-WGP-LABEL: local_wavefront_acquire_atomicrmw:
1082 ; GFX10-WGP: ; %bb.0: ; %entry
1083 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1084 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1085 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1086 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1087 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1088 ; GFX10-WGP-NEXT: s_endpgm
1090 ; GFX10-CU-LABEL: local_wavefront_acquire_atomicrmw:
1091 ; GFX10-CU: ; %bb.0: ; %entry
1092 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1093 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1094 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1095 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1096 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1097 ; GFX10-CU-NEXT: s_endpgm
1099 ; SKIP-CACHE-INV-LABEL: local_wavefront_acquire_atomicrmw:
1100 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1101 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1102 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1103 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1104 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1105 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1106 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1107 ; SKIP-CACHE-INV-NEXT: s_endpgm
1109 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acquire_atomicrmw:
1110 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1111 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1112 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1113 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1114 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1115 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1116 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1118 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acquire_atomicrmw:
1119 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1120 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1121 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1122 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1123 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1124 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1125 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1127 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acquire_atomicrmw:
1128 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1129 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1130 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1131 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1132 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1133 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1134 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1136 ; GFX940-TGSPLIT-LABEL: local_wavefront_acquire_atomicrmw:
1137 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1138 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1139 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1140 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1141 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1142 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1143 ; GFX940-TGSPLIT-NEXT: s_endpgm
1145 ; GFX11-WGP-LABEL: local_wavefront_acquire_atomicrmw:
1146 ; GFX11-WGP: ; %bb.0: ; %entry
1147 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1148 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1149 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1150 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1151 ; GFX11-WGP-NEXT: s_endpgm
1153 ; GFX11-CU-LABEL: local_wavefront_acquire_atomicrmw:
1154 ; GFX11-CU: ; %bb.0: ; %entry
1155 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1156 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1157 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1158 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1159 ; GFX11-CU-NEXT: s_endpgm
1160 ptr addrspace(3) %out, i32 %in) {
1162 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront") acquire
1166 define amdgpu_kernel void @local_wavefront_release_atomicrmw(
1167 ; GFX6-LABEL: local_wavefront_release_atomicrmw:
1168 ; GFX6: ; %bb.0: ; %entry
1169 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1170 ; GFX6-NEXT: s_mov_b32 m0, -1
1171 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1172 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1173 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1174 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1175 ; GFX6-NEXT: s_endpgm
1177 ; GFX7-LABEL: local_wavefront_release_atomicrmw:
1178 ; GFX7: ; %bb.0: ; %entry
1179 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1180 ; GFX7-NEXT: s_mov_b32 m0, -1
1181 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1182 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1183 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1184 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1185 ; GFX7-NEXT: s_endpgm
1187 ; GFX10-WGP-LABEL: local_wavefront_release_atomicrmw:
1188 ; GFX10-WGP: ; %bb.0: ; %entry
1189 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1190 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1191 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1192 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1193 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1194 ; GFX10-WGP-NEXT: s_endpgm
1196 ; GFX10-CU-LABEL: local_wavefront_release_atomicrmw:
1197 ; GFX10-CU: ; %bb.0: ; %entry
1198 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1199 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1200 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1201 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1202 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1203 ; GFX10-CU-NEXT: s_endpgm
1205 ; SKIP-CACHE-INV-LABEL: local_wavefront_release_atomicrmw:
1206 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1207 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1208 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1209 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1210 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1211 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1212 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1213 ; SKIP-CACHE-INV-NEXT: s_endpgm
1215 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_release_atomicrmw:
1216 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1217 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1218 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1219 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1220 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1221 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1222 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1224 ; GFX90A-TGSPLIT-LABEL: local_wavefront_release_atomicrmw:
1225 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1226 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1227 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1228 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1229 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1230 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1231 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1233 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_release_atomicrmw:
1234 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1235 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1236 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1237 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1238 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1239 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1240 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1242 ; GFX940-TGSPLIT-LABEL: local_wavefront_release_atomicrmw:
1243 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1244 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1245 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1246 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1247 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1248 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1249 ; GFX940-TGSPLIT-NEXT: s_endpgm
1251 ; GFX11-WGP-LABEL: local_wavefront_release_atomicrmw:
1252 ; GFX11-WGP: ; %bb.0: ; %entry
1253 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1254 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1255 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1256 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1257 ; GFX11-WGP-NEXT: s_endpgm
1259 ; GFX11-CU-LABEL: local_wavefront_release_atomicrmw:
1260 ; GFX11-CU: ; %bb.0: ; %entry
1261 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1262 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1263 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1264 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1265 ; GFX11-CU-NEXT: s_endpgm
1266 ptr addrspace(3) %out, i32 %in) {
1268 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront") release
1272 define amdgpu_kernel void @local_wavefront_acq_rel_atomicrmw(
1273 ; GFX6-LABEL: local_wavefront_acq_rel_atomicrmw:
1274 ; GFX6: ; %bb.0: ; %entry
1275 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1276 ; GFX6-NEXT: s_mov_b32 m0, -1
1277 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1278 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1279 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1280 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1281 ; GFX6-NEXT: s_endpgm
1283 ; GFX7-LABEL: local_wavefront_acq_rel_atomicrmw:
1284 ; GFX7: ; %bb.0: ; %entry
1285 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1286 ; GFX7-NEXT: s_mov_b32 m0, -1
1287 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1288 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1289 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1290 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1291 ; GFX7-NEXT: s_endpgm
1293 ; GFX10-WGP-LABEL: local_wavefront_acq_rel_atomicrmw:
1294 ; GFX10-WGP: ; %bb.0: ; %entry
1295 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1296 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1297 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1298 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1299 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1300 ; GFX10-WGP-NEXT: s_endpgm
1302 ; GFX10-CU-LABEL: local_wavefront_acq_rel_atomicrmw:
1303 ; GFX10-CU: ; %bb.0: ; %entry
1304 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1305 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1306 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1307 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1308 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1309 ; GFX10-CU-NEXT: s_endpgm
1311 ; SKIP-CACHE-INV-LABEL: local_wavefront_acq_rel_atomicrmw:
1312 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1313 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1314 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1315 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1316 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1317 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1318 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1319 ; SKIP-CACHE-INV-NEXT: s_endpgm
1321 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_atomicrmw:
1322 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1323 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1324 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1325 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1326 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1327 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1328 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1330 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acq_rel_atomicrmw:
1331 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1332 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1333 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1334 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1335 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1336 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1337 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1339 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_atomicrmw:
1340 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1341 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1342 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1343 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1344 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1345 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1346 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1348 ; GFX940-TGSPLIT-LABEL: local_wavefront_acq_rel_atomicrmw:
1349 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1350 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1351 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1352 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1353 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1354 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1355 ; GFX940-TGSPLIT-NEXT: s_endpgm
1357 ; GFX11-WGP-LABEL: local_wavefront_acq_rel_atomicrmw:
1358 ; GFX11-WGP: ; %bb.0: ; %entry
1359 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1360 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1361 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1362 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1363 ; GFX11-WGP-NEXT: s_endpgm
1365 ; GFX11-CU-LABEL: local_wavefront_acq_rel_atomicrmw:
1366 ; GFX11-CU: ; %bb.0: ; %entry
1367 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1368 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1369 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1370 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1371 ; GFX11-CU-NEXT: s_endpgm
1372 ptr addrspace(3) %out, i32 %in) {
1374 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront") acq_rel
1378 define amdgpu_kernel void @local_wavefront_seq_cst_atomicrmw(
1379 ; GFX6-LABEL: local_wavefront_seq_cst_atomicrmw:
1380 ; GFX6: ; %bb.0: ; %entry
1381 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1382 ; GFX6-NEXT: s_mov_b32 m0, -1
1383 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1384 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1385 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1386 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1387 ; GFX6-NEXT: s_endpgm
1389 ; GFX7-LABEL: local_wavefront_seq_cst_atomicrmw:
1390 ; GFX7: ; %bb.0: ; %entry
1391 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1392 ; GFX7-NEXT: s_mov_b32 m0, -1
1393 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1394 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1395 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1396 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1397 ; GFX7-NEXT: s_endpgm
1399 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_atomicrmw:
1400 ; GFX10-WGP: ; %bb.0: ; %entry
1401 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1402 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1403 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1404 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1405 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1406 ; GFX10-WGP-NEXT: s_endpgm
1408 ; GFX10-CU-LABEL: local_wavefront_seq_cst_atomicrmw:
1409 ; GFX10-CU: ; %bb.0: ; %entry
1410 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1411 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1412 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1413 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1414 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1415 ; GFX10-CU-NEXT: s_endpgm
1417 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_atomicrmw:
1418 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1419 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1420 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1421 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1422 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1423 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1424 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1425 ; SKIP-CACHE-INV-NEXT: s_endpgm
1427 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_atomicrmw:
1428 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1429 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1430 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1431 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1432 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1433 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1434 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1436 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_atomicrmw:
1437 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1438 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1439 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1440 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1441 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1442 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1443 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1445 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_atomicrmw:
1446 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1447 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1448 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1449 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1450 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1451 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1452 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1454 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_atomicrmw:
1455 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1456 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1457 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1458 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1459 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1460 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1461 ; GFX940-TGSPLIT-NEXT: s_endpgm
1463 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_atomicrmw:
1464 ; GFX11-WGP: ; %bb.0: ; %entry
1465 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1466 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1467 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1468 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1469 ; GFX11-WGP-NEXT: s_endpgm
1471 ; GFX11-CU-LABEL: local_wavefront_seq_cst_atomicrmw:
1472 ; GFX11-CU: ; %bb.0: ; %entry
1473 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1474 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1475 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1476 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1477 ; GFX11-CU-NEXT: s_endpgm
1478 ptr addrspace(3) %out, i32 %in) {
1480 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront") seq_cst
1484 define amdgpu_kernel void @local_wavefront_acquire_ret_atomicrmw(
1485 ; GFX6-LABEL: local_wavefront_acquire_ret_atomicrmw:
1486 ; GFX6: ; %bb.0: ; %entry
1487 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1488 ; GFX6-NEXT: s_mov_b32 m0, -1
1489 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1490 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1491 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1492 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1493 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1494 ; GFX6-NEXT: ds_write_b32 v0, v1
1495 ; GFX6-NEXT: s_endpgm
1497 ; GFX7-LABEL: local_wavefront_acquire_ret_atomicrmw:
1498 ; GFX7: ; %bb.0: ; %entry
1499 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1500 ; GFX7-NEXT: s_mov_b32 m0, -1
1501 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1502 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1503 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1504 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1505 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1506 ; GFX7-NEXT: ds_write_b32 v0, v1
1507 ; GFX7-NEXT: s_endpgm
1509 ; GFX10-WGP-LABEL: local_wavefront_acquire_ret_atomicrmw:
1510 ; GFX10-WGP: ; %bb.0: ; %entry
1511 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1512 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1513 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1514 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1515 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1516 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1517 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
1518 ; GFX10-WGP-NEXT: s_endpgm
1520 ; GFX10-CU-LABEL: local_wavefront_acquire_ret_atomicrmw:
1521 ; GFX10-CU: ; %bb.0: ; %entry
1522 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1523 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1524 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1525 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1526 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1527 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1528 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
1529 ; GFX10-CU-NEXT: s_endpgm
1531 ; SKIP-CACHE-INV-LABEL: local_wavefront_acquire_ret_atomicrmw:
1532 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1533 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1534 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1535 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1536 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1537 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1538 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1539 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1540 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
1541 ; SKIP-CACHE-INV-NEXT: s_endpgm
1543 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acquire_ret_atomicrmw:
1544 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1545 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1546 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1547 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1548 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1549 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1550 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1551 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1552 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1554 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acquire_ret_atomicrmw:
1555 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1556 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1557 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1558 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1559 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1560 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1561 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1562 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
1563 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1565 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acquire_ret_atomicrmw:
1566 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1567 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1568 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1569 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1570 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1571 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1572 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1573 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1574 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1576 ; GFX940-TGSPLIT-LABEL: local_wavefront_acquire_ret_atomicrmw:
1577 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1578 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1579 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1580 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1581 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1582 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1583 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1584 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
1585 ; GFX940-TGSPLIT-NEXT: s_endpgm
1587 ; GFX11-WGP-LABEL: local_wavefront_acquire_ret_atomicrmw:
1588 ; GFX11-WGP: ; %bb.0: ; %entry
1589 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1590 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1591 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1592 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
1593 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1594 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
1595 ; GFX11-WGP-NEXT: s_endpgm
1597 ; GFX11-CU-LABEL: local_wavefront_acquire_ret_atomicrmw:
1598 ; GFX11-CU: ; %bb.0: ; %entry
1599 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1600 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1601 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1602 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
1603 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1604 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
1605 ; GFX11-CU-NEXT: s_endpgm
1606 ptr addrspace(3) %out, i32 %in) {
1608 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront") acquire
1609 store i32 %val, ptr addrspace(3) %out, align 4
1613 define amdgpu_kernel void @local_wavefront_acq_rel_ret_atomicrmw(
1614 ; GFX6-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1615 ; GFX6: ; %bb.0: ; %entry
1616 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1617 ; GFX6-NEXT: s_mov_b32 m0, -1
1618 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1619 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1620 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1621 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1622 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1623 ; GFX6-NEXT: ds_write_b32 v0, v1
1624 ; GFX6-NEXT: s_endpgm
1626 ; GFX7-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1627 ; GFX7: ; %bb.0: ; %entry
1628 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1629 ; GFX7-NEXT: s_mov_b32 m0, -1
1630 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1631 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1632 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1633 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1634 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1635 ; GFX7-NEXT: ds_write_b32 v0, v1
1636 ; GFX7-NEXT: s_endpgm
1638 ; GFX10-WGP-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1639 ; GFX10-WGP: ; %bb.0: ; %entry
1640 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1641 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1642 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1643 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1644 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1645 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1646 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
1647 ; GFX10-WGP-NEXT: s_endpgm
1649 ; GFX10-CU-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1650 ; GFX10-CU: ; %bb.0: ; %entry
1651 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1652 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1653 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1654 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1655 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1656 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1657 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
1658 ; GFX10-CU-NEXT: s_endpgm
1660 ; SKIP-CACHE-INV-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1661 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1662 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1663 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1664 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1665 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1666 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1667 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1668 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1669 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
1670 ; SKIP-CACHE-INV-NEXT: s_endpgm
1672 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1673 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1674 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1675 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1676 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1677 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1678 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1679 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1680 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1681 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1683 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1684 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1685 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1686 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1687 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1688 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1689 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1690 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1691 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
1692 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1694 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1695 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1696 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1697 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1698 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1699 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1700 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1701 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1702 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1703 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1705 ; GFX940-TGSPLIT-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1706 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1707 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1708 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1709 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1710 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1711 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1712 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1713 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
1714 ; GFX940-TGSPLIT-NEXT: s_endpgm
1716 ; GFX11-WGP-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1717 ; GFX11-WGP: ; %bb.0: ; %entry
1718 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1719 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1720 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1721 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
1722 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1723 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
1724 ; GFX11-WGP-NEXT: s_endpgm
1726 ; GFX11-CU-LABEL: local_wavefront_acq_rel_ret_atomicrmw:
1727 ; GFX11-CU: ; %bb.0: ; %entry
1728 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1729 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1730 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1731 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
1732 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1733 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
1734 ; GFX11-CU-NEXT: s_endpgm
1735 ptr addrspace(3) %out, i32 %in) {
1737 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront") acq_rel
1738 store i32 %val, ptr addrspace(3) %out, align 4
1742 define amdgpu_kernel void @local_wavefront_seq_cst_ret_atomicrmw(
1743 ; GFX6-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1744 ; GFX6: ; %bb.0: ; %entry
1745 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1746 ; GFX6-NEXT: s_mov_b32 m0, -1
1747 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1748 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1749 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1750 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1751 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1752 ; GFX6-NEXT: ds_write_b32 v0, v1
1753 ; GFX6-NEXT: s_endpgm
1755 ; GFX7-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1756 ; GFX7: ; %bb.0: ; %entry
1757 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1758 ; GFX7-NEXT: s_mov_b32 m0, -1
1759 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1760 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1761 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1762 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1763 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1764 ; GFX7-NEXT: ds_write_b32 v0, v1
1765 ; GFX7-NEXT: s_endpgm
1767 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1768 ; GFX10-WGP: ; %bb.0: ; %entry
1769 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1770 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1771 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1772 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1773 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1774 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1775 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
1776 ; GFX10-WGP-NEXT: s_endpgm
1778 ; GFX10-CU-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1779 ; GFX10-CU: ; %bb.0: ; %entry
1780 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1781 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1782 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1783 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1784 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1785 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1786 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
1787 ; GFX10-CU-NEXT: s_endpgm
1789 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1790 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1791 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1792 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1793 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1794 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1795 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1796 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1797 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1798 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
1799 ; SKIP-CACHE-INV-NEXT: s_endpgm
1801 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1802 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1803 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1804 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1805 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1806 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1807 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1808 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1809 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1810 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1812 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1813 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1814 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1815 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1816 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1817 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1818 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1819 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1820 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
1821 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1823 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1824 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1825 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1826 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1827 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1828 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1829 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1830 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1831 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1832 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1834 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1835 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1836 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1837 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1838 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1839 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1840 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1841 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1842 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
1843 ; GFX940-TGSPLIT-NEXT: s_endpgm
1845 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1846 ; GFX11-WGP: ; %bb.0: ; %entry
1847 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1848 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1849 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1850 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
1851 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1852 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
1853 ; GFX11-WGP-NEXT: s_endpgm
1855 ; GFX11-CU-LABEL: local_wavefront_seq_cst_ret_atomicrmw:
1856 ; GFX11-CU: ; %bb.0: ; %entry
1857 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1858 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1859 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1860 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
1861 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1862 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
1863 ; GFX11-CU-NEXT: s_endpgm
1864 ptr addrspace(3) %out, i32 %in) {
1866 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront") seq_cst
1867 store i32 %val, ptr addrspace(3) %out, align 4
1871 define amdgpu_kernel void @local_wavefront_monotonic_monotonic_cmpxchg(
1872 ; GFX6-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1873 ; GFX6: ; %bb.0: ; %entry
1874 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1875 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1876 ; GFX6-NEXT: s_mov_b32 m0, -1
1877 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1878 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1879 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1880 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1881 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1882 ; GFX6-NEXT: s_endpgm
1884 ; GFX7-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1885 ; GFX7: ; %bb.0: ; %entry
1886 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1887 ; GFX7-NEXT: s_mov_b32 m0, -1
1888 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1889 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1890 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1891 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1892 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1893 ; GFX7-NEXT: s_endpgm
1895 ; GFX10-WGP-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1896 ; GFX10-WGP: ; %bb.0: ; %entry
1897 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1898 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1899 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1900 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1901 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1902 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1903 ; GFX10-WGP-NEXT: s_endpgm
1905 ; GFX10-CU-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1906 ; GFX10-CU: ; %bb.0: ; %entry
1907 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1908 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1909 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1910 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1911 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1912 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1913 ; GFX10-CU-NEXT: s_endpgm
1915 ; SKIP-CACHE-INV-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1916 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1917 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
1918 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1919 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1920 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1921 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
1922 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
1923 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1924 ; SKIP-CACHE-INV-NEXT: s_endpgm
1926 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1927 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1928 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1929 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1930 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1931 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1932 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1933 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1934 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1936 ; GFX90A-TGSPLIT-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1937 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1938 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1939 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1940 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1941 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1942 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1943 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1944 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1946 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1947 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1948 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
1949 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1950 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1951 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1952 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1953 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1954 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1956 ; GFX940-TGSPLIT-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1957 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1958 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
1959 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1960 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1961 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1962 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1963 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1964 ; GFX940-TGSPLIT-NEXT: s_endpgm
1966 ; GFX11-WGP-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1967 ; GFX11-WGP: ; %bb.0: ; %entry
1968 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
1969 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1970 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1971 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
1972 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
1973 ; GFX11-WGP-NEXT: s_endpgm
1975 ; GFX11-CU-LABEL: local_wavefront_monotonic_monotonic_cmpxchg:
1976 ; GFX11-CU: ; %bb.0: ; %entry
1977 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
1978 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1979 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
1980 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
1981 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
1982 ; GFX11-CU-NEXT: s_endpgm
1983 ptr addrspace(3) %out, i32 %in, i32 %old) {
1985 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
1986 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") monotonic monotonic
1990 define amdgpu_kernel void @local_wavefront_acquire_monotonic_cmpxchg(
1991 ; GFX6-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
1992 ; GFX6: ; %bb.0: ; %entry
1993 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1994 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1995 ; GFX6-NEXT: s_mov_b32 m0, -1
1996 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1997 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1998 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1999 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2000 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2001 ; GFX6-NEXT: s_endpgm
2003 ; GFX7-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2004 ; GFX7: ; %bb.0: ; %entry
2005 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2006 ; GFX7-NEXT: s_mov_b32 m0, -1
2007 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2008 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2009 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2010 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2011 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2012 ; GFX7-NEXT: s_endpgm
2014 ; GFX10-WGP-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2015 ; GFX10-WGP: ; %bb.0: ; %entry
2016 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2017 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2018 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2019 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2020 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2021 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2022 ; GFX10-WGP-NEXT: s_endpgm
2024 ; GFX10-CU-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2025 ; GFX10-CU: ; %bb.0: ; %entry
2026 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2027 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2028 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2029 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2030 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2031 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2032 ; GFX10-CU-NEXT: s_endpgm
2034 ; SKIP-CACHE-INV-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2035 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2036 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2037 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2038 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2039 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2040 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
2041 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
2042 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2043 ; SKIP-CACHE-INV-NEXT: s_endpgm
2045 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2046 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2047 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2048 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2049 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2050 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2051 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2052 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2053 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2055 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2056 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2057 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2058 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2059 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2060 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2061 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2062 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2063 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2065 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2066 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2067 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2068 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2069 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2070 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2071 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2072 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2073 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2075 ; GFX940-TGSPLIT-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2076 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2077 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2078 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2079 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2080 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2081 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2082 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2083 ; GFX940-TGSPLIT-NEXT: s_endpgm
2085 ; GFX11-WGP-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2086 ; GFX11-WGP: ; %bb.0: ; %entry
2087 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2088 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2089 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2090 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
2091 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2092 ; GFX11-WGP-NEXT: s_endpgm
2094 ; GFX11-CU-LABEL: local_wavefront_acquire_monotonic_cmpxchg:
2095 ; GFX11-CU: ; %bb.0: ; %entry
2096 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2097 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2098 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2099 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
2100 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2101 ; GFX11-CU-NEXT: s_endpgm
2102 ptr addrspace(3) %out, i32 %in, i32 %old) {
2104 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2105 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acquire monotonic
2109 define amdgpu_kernel void @local_wavefront_release_monotonic_cmpxchg(
2110 ; GFX6-LABEL: local_wavefront_release_monotonic_cmpxchg:
2111 ; GFX6: ; %bb.0: ; %entry
2112 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2113 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2114 ; GFX6-NEXT: s_mov_b32 m0, -1
2115 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2116 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2117 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2118 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2119 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2120 ; GFX6-NEXT: s_endpgm
2122 ; GFX7-LABEL: local_wavefront_release_monotonic_cmpxchg:
2123 ; GFX7: ; %bb.0: ; %entry
2124 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2125 ; GFX7-NEXT: s_mov_b32 m0, -1
2126 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2127 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2128 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2129 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2130 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2131 ; GFX7-NEXT: s_endpgm
2133 ; GFX10-WGP-LABEL: local_wavefront_release_monotonic_cmpxchg:
2134 ; GFX10-WGP: ; %bb.0: ; %entry
2135 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2136 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2137 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2138 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2139 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2140 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2141 ; GFX10-WGP-NEXT: s_endpgm
2143 ; GFX10-CU-LABEL: local_wavefront_release_monotonic_cmpxchg:
2144 ; GFX10-CU: ; %bb.0: ; %entry
2145 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2146 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2147 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2148 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2149 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2150 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2151 ; GFX10-CU-NEXT: s_endpgm
2153 ; SKIP-CACHE-INV-LABEL: local_wavefront_release_monotonic_cmpxchg:
2154 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2155 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2156 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2157 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2158 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2159 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
2160 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
2161 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2162 ; SKIP-CACHE-INV-NEXT: s_endpgm
2164 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_release_monotonic_cmpxchg:
2165 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2166 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2167 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2168 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2169 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2170 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2171 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2172 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2174 ; GFX90A-TGSPLIT-LABEL: local_wavefront_release_monotonic_cmpxchg:
2175 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2176 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2177 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2178 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2179 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2180 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2181 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2182 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2184 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_release_monotonic_cmpxchg:
2185 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2186 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2187 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2188 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2189 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2190 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2191 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2192 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2194 ; GFX940-TGSPLIT-LABEL: local_wavefront_release_monotonic_cmpxchg:
2195 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2196 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2197 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2198 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2199 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2200 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2201 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2202 ; GFX940-TGSPLIT-NEXT: s_endpgm
2204 ; GFX11-WGP-LABEL: local_wavefront_release_monotonic_cmpxchg:
2205 ; GFX11-WGP: ; %bb.0: ; %entry
2206 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2207 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2208 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2209 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
2210 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2211 ; GFX11-WGP-NEXT: s_endpgm
2213 ; GFX11-CU-LABEL: local_wavefront_release_monotonic_cmpxchg:
2214 ; GFX11-CU: ; %bb.0: ; %entry
2215 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2216 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2217 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2218 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
2219 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2220 ; GFX11-CU-NEXT: s_endpgm
2221 ptr addrspace(3) %out, i32 %in, i32 %old) {
2223 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2224 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") release monotonic
2228 define amdgpu_kernel void @local_wavefront_acq_rel_monotonic_cmpxchg(
2229 ; GFX6-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2230 ; GFX6: ; %bb.0: ; %entry
2231 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2232 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2233 ; GFX6-NEXT: s_mov_b32 m0, -1
2234 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2235 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2236 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2237 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2238 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2239 ; GFX6-NEXT: s_endpgm
2241 ; GFX7-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2242 ; GFX7: ; %bb.0: ; %entry
2243 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2244 ; GFX7-NEXT: s_mov_b32 m0, -1
2245 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2246 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2247 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2248 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2249 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2250 ; GFX7-NEXT: s_endpgm
2252 ; GFX10-WGP-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2253 ; GFX10-WGP: ; %bb.0: ; %entry
2254 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2255 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2256 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2257 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2258 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2259 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2260 ; GFX10-WGP-NEXT: s_endpgm
2262 ; GFX10-CU-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2263 ; GFX10-CU: ; %bb.0: ; %entry
2264 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2265 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2266 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2267 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2268 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2269 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2270 ; GFX10-CU-NEXT: s_endpgm
2272 ; SKIP-CACHE-INV-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2273 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2274 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2275 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2276 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2277 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2278 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
2279 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
2280 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2281 ; SKIP-CACHE-INV-NEXT: s_endpgm
2283 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2284 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2285 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2286 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2287 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2288 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2289 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2290 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2291 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2293 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2294 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2295 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2296 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2297 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2298 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2299 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2300 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2301 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2303 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2304 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2305 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2306 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2307 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2308 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2309 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2310 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2311 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2313 ; GFX940-TGSPLIT-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2314 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2315 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2316 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2317 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2318 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2319 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2320 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2321 ; GFX940-TGSPLIT-NEXT: s_endpgm
2323 ; GFX11-WGP-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2324 ; GFX11-WGP: ; %bb.0: ; %entry
2325 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2326 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2327 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2328 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
2329 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2330 ; GFX11-WGP-NEXT: s_endpgm
2332 ; GFX11-CU-LABEL: local_wavefront_acq_rel_monotonic_cmpxchg:
2333 ; GFX11-CU: ; %bb.0: ; %entry
2334 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2335 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2336 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2337 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
2338 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2339 ; GFX11-CU-NEXT: s_endpgm
2340 ptr addrspace(3) %out, i32 %in, i32 %old) {
2342 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2343 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acq_rel monotonic
2347 define amdgpu_kernel void @local_wavefront_seq_cst_monotonic_cmpxchg(
2348 ; GFX6-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2349 ; GFX6: ; %bb.0: ; %entry
2350 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2351 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2352 ; GFX6-NEXT: s_mov_b32 m0, -1
2353 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2354 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2355 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2356 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2357 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2358 ; GFX6-NEXT: s_endpgm
2360 ; GFX7-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2361 ; GFX7: ; %bb.0: ; %entry
2362 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2363 ; GFX7-NEXT: s_mov_b32 m0, -1
2364 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2365 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2366 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2367 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2368 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2369 ; GFX7-NEXT: s_endpgm
2371 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2372 ; GFX10-WGP: ; %bb.0: ; %entry
2373 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2374 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2375 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2376 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2377 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2378 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2379 ; GFX10-WGP-NEXT: s_endpgm
2381 ; GFX10-CU-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2382 ; GFX10-CU: ; %bb.0: ; %entry
2383 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2384 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2385 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2386 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2387 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2388 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2389 ; GFX10-CU-NEXT: s_endpgm
2391 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2392 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2393 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2394 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2395 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2396 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2397 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
2398 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
2399 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2400 ; SKIP-CACHE-INV-NEXT: s_endpgm
2402 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2403 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2404 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2405 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2406 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2407 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2408 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2409 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2410 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2412 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2413 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2414 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2415 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2416 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2417 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2418 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2419 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2420 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2422 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2423 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2424 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2425 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2426 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2427 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2428 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2429 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2430 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2432 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2433 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2434 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2435 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2436 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2437 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2438 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2439 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2440 ; GFX940-TGSPLIT-NEXT: s_endpgm
2442 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2443 ; GFX11-WGP: ; %bb.0: ; %entry
2444 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2445 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2446 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2447 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
2448 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2449 ; GFX11-WGP-NEXT: s_endpgm
2451 ; GFX11-CU-LABEL: local_wavefront_seq_cst_monotonic_cmpxchg:
2452 ; GFX11-CU: ; %bb.0: ; %entry
2453 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2454 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2455 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2456 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
2457 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2458 ; GFX11-CU-NEXT: s_endpgm
2459 ptr addrspace(3) %out, i32 %in, i32 %old) {
2461 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2462 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") seq_cst monotonic
2466 define amdgpu_kernel void @local_wavefront_monotonic_acquire_cmpxchg(
2467 ; GFX6-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2468 ; GFX6: ; %bb.0: ; %entry
2469 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2470 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2471 ; GFX6-NEXT: s_mov_b32 m0, -1
2472 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2473 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2474 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2475 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2476 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2477 ; GFX6-NEXT: s_endpgm
2479 ; GFX7-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2480 ; GFX7: ; %bb.0: ; %entry
2481 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2482 ; GFX7-NEXT: s_mov_b32 m0, -1
2483 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2484 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2485 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2486 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2487 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2488 ; GFX7-NEXT: s_endpgm
2490 ; GFX10-WGP-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2491 ; GFX10-WGP: ; %bb.0: ; %entry
2492 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2493 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2494 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2495 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2496 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2497 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2498 ; GFX10-WGP-NEXT: s_endpgm
2500 ; GFX10-CU-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2501 ; GFX10-CU: ; %bb.0: ; %entry
2502 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2503 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2504 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2505 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2506 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2507 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2508 ; GFX10-CU-NEXT: s_endpgm
2510 ; SKIP-CACHE-INV-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2511 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2512 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2513 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2514 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2515 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2516 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
2517 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
2518 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2519 ; SKIP-CACHE-INV-NEXT: s_endpgm
2521 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2522 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2523 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2524 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2525 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2526 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2527 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2528 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2529 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2531 ; GFX90A-TGSPLIT-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2532 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2533 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2534 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2535 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2536 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2537 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2538 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2539 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2541 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2542 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2543 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2544 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2545 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2546 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2547 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2548 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2549 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2551 ; GFX940-TGSPLIT-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2552 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2553 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2554 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2555 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2556 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2557 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2558 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2559 ; GFX940-TGSPLIT-NEXT: s_endpgm
2561 ; GFX11-WGP-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2562 ; GFX11-WGP: ; %bb.0: ; %entry
2563 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2564 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2565 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2566 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
2567 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2568 ; GFX11-WGP-NEXT: s_endpgm
2570 ; GFX11-CU-LABEL: local_wavefront_monotonic_acquire_cmpxchg:
2571 ; GFX11-CU: ; %bb.0: ; %entry
2572 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2573 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2574 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2575 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
2576 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2577 ; GFX11-CU-NEXT: s_endpgm
2578 ptr addrspace(3) %out, i32 %in, i32 %old) {
2580 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2581 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") monotonic acquire
2585 define amdgpu_kernel void @local_wavefront_acquire_acquire_cmpxchg(
2586 ; GFX6-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2587 ; GFX6: ; %bb.0: ; %entry
2588 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2589 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2590 ; GFX6-NEXT: s_mov_b32 m0, -1
2591 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2592 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2593 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2594 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2595 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2596 ; GFX6-NEXT: s_endpgm
2598 ; GFX7-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2599 ; GFX7: ; %bb.0: ; %entry
2600 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2601 ; GFX7-NEXT: s_mov_b32 m0, -1
2602 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2603 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2604 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2605 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2606 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2607 ; GFX7-NEXT: s_endpgm
2609 ; GFX10-WGP-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2610 ; GFX10-WGP: ; %bb.0: ; %entry
2611 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2612 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2613 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2614 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2615 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2616 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2617 ; GFX10-WGP-NEXT: s_endpgm
2619 ; GFX10-CU-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2620 ; GFX10-CU: ; %bb.0: ; %entry
2621 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2622 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2623 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2624 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2625 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2626 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2627 ; GFX10-CU-NEXT: s_endpgm
2629 ; SKIP-CACHE-INV-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2630 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2631 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2632 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2633 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2634 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2635 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
2636 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
2637 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2638 ; SKIP-CACHE-INV-NEXT: s_endpgm
2640 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2641 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2642 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2643 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2644 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2645 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2646 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2647 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2648 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2650 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2651 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2652 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2653 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2654 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2655 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2656 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2657 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2658 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2660 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2661 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2662 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2663 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2664 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2665 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2666 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2667 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2668 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2670 ; GFX940-TGSPLIT-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2671 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2672 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2673 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2674 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2675 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2676 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2677 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2678 ; GFX940-TGSPLIT-NEXT: s_endpgm
2680 ; GFX11-WGP-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2681 ; GFX11-WGP: ; %bb.0: ; %entry
2682 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2683 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2684 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2685 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
2686 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2687 ; GFX11-WGP-NEXT: s_endpgm
2689 ; GFX11-CU-LABEL: local_wavefront_acquire_acquire_cmpxchg:
2690 ; GFX11-CU: ; %bb.0: ; %entry
2691 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2692 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2693 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2694 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
2695 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2696 ; GFX11-CU-NEXT: s_endpgm
2697 ptr addrspace(3) %out, i32 %in, i32 %old) {
2699 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2700 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acquire acquire
2704 define amdgpu_kernel void @local_wavefront_release_acquire_cmpxchg(
2705 ; GFX6-LABEL: local_wavefront_release_acquire_cmpxchg:
2706 ; GFX6: ; %bb.0: ; %entry
2707 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2708 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2709 ; GFX6-NEXT: s_mov_b32 m0, -1
2710 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2711 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2712 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2713 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2714 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2715 ; GFX6-NEXT: s_endpgm
2717 ; GFX7-LABEL: local_wavefront_release_acquire_cmpxchg:
2718 ; GFX7: ; %bb.0: ; %entry
2719 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2720 ; GFX7-NEXT: s_mov_b32 m0, -1
2721 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2722 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2723 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2724 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2725 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2726 ; GFX7-NEXT: s_endpgm
2728 ; GFX10-WGP-LABEL: local_wavefront_release_acquire_cmpxchg:
2729 ; GFX10-WGP: ; %bb.0: ; %entry
2730 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2731 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2732 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2733 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2734 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2735 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2736 ; GFX10-WGP-NEXT: s_endpgm
2738 ; GFX10-CU-LABEL: local_wavefront_release_acquire_cmpxchg:
2739 ; GFX10-CU: ; %bb.0: ; %entry
2740 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2741 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2742 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2743 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2744 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2745 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2746 ; GFX10-CU-NEXT: s_endpgm
2748 ; SKIP-CACHE-INV-LABEL: local_wavefront_release_acquire_cmpxchg:
2749 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2750 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2751 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2752 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2753 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2754 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
2755 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
2756 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2757 ; SKIP-CACHE-INV-NEXT: s_endpgm
2759 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_release_acquire_cmpxchg:
2760 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2761 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2762 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2763 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2764 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2765 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2766 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2767 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2769 ; GFX90A-TGSPLIT-LABEL: local_wavefront_release_acquire_cmpxchg:
2770 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2771 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2772 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2773 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2774 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2775 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2776 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2777 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2779 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_release_acquire_cmpxchg:
2780 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2781 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2782 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2783 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2784 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2785 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2786 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2787 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2789 ; GFX940-TGSPLIT-LABEL: local_wavefront_release_acquire_cmpxchg:
2790 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2791 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2792 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2793 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2794 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2795 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2796 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2797 ; GFX940-TGSPLIT-NEXT: s_endpgm
2799 ; GFX11-WGP-LABEL: local_wavefront_release_acquire_cmpxchg:
2800 ; GFX11-WGP: ; %bb.0: ; %entry
2801 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2802 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2803 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2804 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
2805 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2806 ; GFX11-WGP-NEXT: s_endpgm
2808 ; GFX11-CU-LABEL: local_wavefront_release_acquire_cmpxchg:
2809 ; GFX11-CU: ; %bb.0: ; %entry
2810 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2811 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2812 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2813 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
2814 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2815 ; GFX11-CU-NEXT: s_endpgm
2816 ptr addrspace(3) %out, i32 %in, i32 %old) {
2818 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2819 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") release acquire
2823 define amdgpu_kernel void @local_wavefront_acq_rel_acquire_cmpxchg(
2824 ; GFX6-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2825 ; GFX6: ; %bb.0: ; %entry
2826 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2827 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2828 ; GFX6-NEXT: s_mov_b32 m0, -1
2829 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2830 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2831 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2832 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2833 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2834 ; GFX6-NEXT: s_endpgm
2836 ; GFX7-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2837 ; GFX7: ; %bb.0: ; %entry
2838 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2839 ; GFX7-NEXT: s_mov_b32 m0, -1
2840 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2841 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2842 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2843 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2844 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2845 ; GFX7-NEXT: s_endpgm
2847 ; GFX10-WGP-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2848 ; GFX10-WGP: ; %bb.0: ; %entry
2849 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2850 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2851 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2852 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2853 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2854 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2855 ; GFX10-WGP-NEXT: s_endpgm
2857 ; GFX10-CU-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2858 ; GFX10-CU: ; %bb.0: ; %entry
2859 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2860 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2861 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2862 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2863 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2864 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2865 ; GFX10-CU-NEXT: s_endpgm
2867 ; SKIP-CACHE-INV-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2868 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2869 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2870 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2871 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2872 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2873 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
2874 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
2875 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2876 ; SKIP-CACHE-INV-NEXT: s_endpgm
2878 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2879 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2880 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2881 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2882 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2883 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2884 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2885 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2886 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2888 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2889 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2890 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2891 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2892 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2893 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2894 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2895 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2896 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2898 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2899 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2900 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2901 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2902 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2903 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2904 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2905 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2906 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2908 ; GFX940-TGSPLIT-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2909 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2910 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2911 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2912 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2913 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2914 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2915 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2916 ; GFX940-TGSPLIT-NEXT: s_endpgm
2918 ; GFX11-WGP-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2919 ; GFX11-WGP: ; %bb.0: ; %entry
2920 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2921 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2922 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2923 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
2924 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2925 ; GFX11-WGP-NEXT: s_endpgm
2927 ; GFX11-CU-LABEL: local_wavefront_acq_rel_acquire_cmpxchg:
2928 ; GFX11-CU: ; %bb.0: ; %entry
2929 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2930 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2931 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2932 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
2933 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2934 ; GFX11-CU-NEXT: s_endpgm
2935 ptr addrspace(3) %out, i32 %in, i32 %old) {
2937 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2938 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acq_rel acquire
2942 define amdgpu_kernel void @local_wavefront_seq_cst_acquire_cmpxchg(
2943 ; GFX6-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
2944 ; GFX6: ; %bb.0: ; %entry
2945 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2946 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2947 ; GFX6-NEXT: s_mov_b32 m0, -1
2948 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2949 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2950 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2951 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2952 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2953 ; GFX6-NEXT: s_endpgm
2955 ; GFX7-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
2956 ; GFX7: ; %bb.0: ; %entry
2957 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2958 ; GFX7-NEXT: s_mov_b32 m0, -1
2959 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2960 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2961 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2962 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2963 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2964 ; GFX7-NEXT: s_endpgm
2966 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
2967 ; GFX10-WGP: ; %bb.0: ; %entry
2968 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2969 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2970 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2971 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2972 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2973 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2974 ; GFX10-WGP-NEXT: s_endpgm
2976 ; GFX10-CU-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
2977 ; GFX10-CU: ; %bb.0: ; %entry
2978 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2979 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2980 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2981 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2982 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2983 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2984 ; GFX10-CU-NEXT: s_endpgm
2986 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
2987 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2988 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2989 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2990 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2991 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2992 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
2993 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
2994 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2995 ; SKIP-CACHE-INV-NEXT: s_endpgm
2997 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
2998 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2999 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3000 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3001 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3002 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3003 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3004 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3005 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3007 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
3008 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3009 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3010 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3011 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3012 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3013 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3014 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3015 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3017 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
3018 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3019 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3020 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3021 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3022 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3023 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3024 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3025 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3027 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
3028 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3029 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3030 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3031 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3032 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3033 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3034 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3035 ; GFX940-TGSPLIT-NEXT: s_endpgm
3037 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
3038 ; GFX11-WGP: ; %bb.0: ; %entry
3039 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3040 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3041 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3042 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
3043 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3044 ; GFX11-WGP-NEXT: s_endpgm
3046 ; GFX11-CU-LABEL: local_wavefront_seq_cst_acquire_cmpxchg:
3047 ; GFX11-CU: ; %bb.0: ; %entry
3048 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3049 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3050 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3051 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
3052 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3053 ; GFX11-CU-NEXT: s_endpgm
3054 ptr addrspace(3) %out, i32 %in, i32 %old) {
3056 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3057 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") seq_cst acquire
3061 define amdgpu_kernel void @local_wavefront_monotonic_seq_cst_cmpxchg(
3062 ; GFX6-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3063 ; GFX6: ; %bb.0: ; %entry
3064 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3065 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3066 ; GFX6-NEXT: s_mov_b32 m0, -1
3067 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3068 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3069 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3070 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3071 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3072 ; GFX6-NEXT: s_endpgm
3074 ; GFX7-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3075 ; GFX7: ; %bb.0: ; %entry
3076 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3077 ; GFX7-NEXT: s_mov_b32 m0, -1
3078 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3079 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3080 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3081 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3082 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3083 ; GFX7-NEXT: s_endpgm
3085 ; GFX10-WGP-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3086 ; GFX10-WGP: ; %bb.0: ; %entry
3087 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3088 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3089 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3090 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3091 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3092 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3093 ; GFX10-WGP-NEXT: s_endpgm
3095 ; GFX10-CU-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3096 ; GFX10-CU: ; %bb.0: ; %entry
3097 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3098 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3099 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3100 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3101 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3102 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3103 ; GFX10-CU-NEXT: s_endpgm
3105 ; SKIP-CACHE-INV-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3106 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3107 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3108 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3109 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3110 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3111 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
3112 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
3113 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3114 ; SKIP-CACHE-INV-NEXT: s_endpgm
3116 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3117 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3118 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3119 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3120 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3121 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3122 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3123 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3124 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3126 ; GFX90A-TGSPLIT-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3127 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3128 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3129 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3130 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3131 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3132 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3133 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3134 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3136 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3137 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3138 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3139 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3140 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3141 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3142 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3143 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3144 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3146 ; GFX940-TGSPLIT-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3147 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3148 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3149 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3150 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3151 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3152 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3153 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3154 ; GFX940-TGSPLIT-NEXT: s_endpgm
3156 ; GFX11-WGP-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3157 ; GFX11-WGP: ; %bb.0: ; %entry
3158 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3159 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3160 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3161 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
3162 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3163 ; GFX11-WGP-NEXT: s_endpgm
3165 ; GFX11-CU-LABEL: local_wavefront_monotonic_seq_cst_cmpxchg:
3166 ; GFX11-CU: ; %bb.0: ; %entry
3167 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3168 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3169 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3170 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
3171 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3172 ; GFX11-CU-NEXT: s_endpgm
3173 ptr addrspace(3) %out, i32 %in, i32 %old) {
3175 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3176 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") monotonic seq_cst
3180 define amdgpu_kernel void @local_wavefront_acquire_seq_cst_cmpxchg(
3181 ; GFX6-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3182 ; GFX6: ; %bb.0: ; %entry
3183 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3184 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3185 ; GFX6-NEXT: s_mov_b32 m0, -1
3186 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3187 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3188 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3189 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3190 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3191 ; GFX6-NEXT: s_endpgm
3193 ; GFX7-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3194 ; GFX7: ; %bb.0: ; %entry
3195 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3196 ; GFX7-NEXT: s_mov_b32 m0, -1
3197 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3198 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3199 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3200 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3201 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3202 ; GFX7-NEXT: s_endpgm
3204 ; GFX10-WGP-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3205 ; GFX10-WGP: ; %bb.0: ; %entry
3206 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3207 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3208 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3209 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3210 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3211 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3212 ; GFX10-WGP-NEXT: s_endpgm
3214 ; GFX10-CU-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3215 ; GFX10-CU: ; %bb.0: ; %entry
3216 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3217 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3218 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3219 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3220 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3221 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3222 ; GFX10-CU-NEXT: s_endpgm
3224 ; SKIP-CACHE-INV-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3225 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3226 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3227 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3228 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3229 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3230 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
3231 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
3232 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3233 ; SKIP-CACHE-INV-NEXT: s_endpgm
3235 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3236 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3237 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3238 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3239 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3240 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3241 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3242 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3243 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3245 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3246 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3247 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3248 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3249 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3250 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3251 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3252 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3253 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3255 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3256 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3257 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3258 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3259 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3260 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3261 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3262 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3263 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3265 ; GFX940-TGSPLIT-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3266 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3267 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3268 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3269 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3270 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3271 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3272 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3273 ; GFX940-TGSPLIT-NEXT: s_endpgm
3275 ; GFX11-WGP-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3276 ; GFX11-WGP: ; %bb.0: ; %entry
3277 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3278 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3279 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3280 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
3281 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3282 ; GFX11-WGP-NEXT: s_endpgm
3284 ; GFX11-CU-LABEL: local_wavefront_acquire_seq_cst_cmpxchg:
3285 ; GFX11-CU: ; %bb.0: ; %entry
3286 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3287 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3288 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3289 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
3290 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3291 ; GFX11-CU-NEXT: s_endpgm
3292 ptr addrspace(3) %out, i32 %in, i32 %old) {
3294 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3295 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acquire seq_cst
3299 define amdgpu_kernel void @local_wavefront_release_seq_cst_cmpxchg(
3300 ; GFX6-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3301 ; GFX6: ; %bb.0: ; %entry
3302 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3303 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3304 ; GFX6-NEXT: s_mov_b32 m0, -1
3305 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3306 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3307 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3308 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3309 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3310 ; GFX6-NEXT: s_endpgm
3312 ; GFX7-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3313 ; GFX7: ; %bb.0: ; %entry
3314 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3315 ; GFX7-NEXT: s_mov_b32 m0, -1
3316 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3317 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3318 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3319 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3320 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3321 ; GFX7-NEXT: s_endpgm
3323 ; GFX10-WGP-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3324 ; GFX10-WGP: ; %bb.0: ; %entry
3325 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3326 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3327 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3328 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3329 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3330 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3331 ; GFX10-WGP-NEXT: s_endpgm
3333 ; GFX10-CU-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3334 ; GFX10-CU: ; %bb.0: ; %entry
3335 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3336 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3337 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3338 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3339 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3340 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3341 ; GFX10-CU-NEXT: s_endpgm
3343 ; SKIP-CACHE-INV-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3344 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3345 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3346 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3347 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3348 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3349 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
3350 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
3351 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3352 ; SKIP-CACHE-INV-NEXT: s_endpgm
3354 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3355 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3356 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3357 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3358 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3359 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3360 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3361 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3362 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3364 ; GFX90A-TGSPLIT-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3365 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3366 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3367 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3368 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3369 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3370 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3371 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3372 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3374 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3375 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3376 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3377 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3378 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3379 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3380 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3381 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3382 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3384 ; GFX940-TGSPLIT-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3385 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3386 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3387 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3388 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3389 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3390 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3391 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3392 ; GFX940-TGSPLIT-NEXT: s_endpgm
3394 ; GFX11-WGP-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3395 ; GFX11-WGP: ; %bb.0: ; %entry
3396 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3397 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3398 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3399 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
3400 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3401 ; GFX11-WGP-NEXT: s_endpgm
3403 ; GFX11-CU-LABEL: local_wavefront_release_seq_cst_cmpxchg:
3404 ; GFX11-CU: ; %bb.0: ; %entry
3405 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3406 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3407 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3408 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
3409 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3410 ; GFX11-CU-NEXT: s_endpgm
3411 ptr addrspace(3) %out, i32 %in, i32 %old) {
3413 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3414 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") release seq_cst
3418 define amdgpu_kernel void @local_wavefront_acq_rel_seq_cst_cmpxchg(
3419 ; GFX6-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3420 ; GFX6: ; %bb.0: ; %entry
3421 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3422 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3423 ; GFX6-NEXT: s_mov_b32 m0, -1
3424 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3425 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3426 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3427 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3428 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3429 ; GFX6-NEXT: s_endpgm
3431 ; GFX7-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3432 ; GFX7: ; %bb.0: ; %entry
3433 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3434 ; GFX7-NEXT: s_mov_b32 m0, -1
3435 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3436 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3437 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3438 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3439 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3440 ; GFX7-NEXT: s_endpgm
3442 ; GFX10-WGP-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3443 ; GFX10-WGP: ; %bb.0: ; %entry
3444 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3445 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3446 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3447 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3448 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3449 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3450 ; GFX10-WGP-NEXT: s_endpgm
3452 ; GFX10-CU-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3453 ; GFX10-CU: ; %bb.0: ; %entry
3454 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3455 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3456 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3457 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3458 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3459 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3460 ; GFX10-CU-NEXT: s_endpgm
3462 ; SKIP-CACHE-INV-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3463 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3464 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3465 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3466 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3467 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3468 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
3469 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
3470 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3471 ; SKIP-CACHE-INV-NEXT: s_endpgm
3473 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3474 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3475 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3476 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3477 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3478 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3479 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3480 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3481 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3483 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3484 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3485 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3486 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3487 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3488 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3489 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3490 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3491 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3493 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3494 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3495 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3496 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3497 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3498 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3499 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3500 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3501 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3503 ; GFX940-TGSPLIT-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3504 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3505 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3506 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3507 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3508 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3509 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3510 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3511 ; GFX940-TGSPLIT-NEXT: s_endpgm
3513 ; GFX11-WGP-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3514 ; GFX11-WGP: ; %bb.0: ; %entry
3515 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3516 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3517 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3518 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
3519 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3520 ; GFX11-WGP-NEXT: s_endpgm
3522 ; GFX11-CU-LABEL: local_wavefront_acq_rel_seq_cst_cmpxchg:
3523 ; GFX11-CU: ; %bb.0: ; %entry
3524 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3525 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3526 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3527 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
3528 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3529 ; GFX11-CU-NEXT: s_endpgm
3530 ptr addrspace(3) %out, i32 %in, i32 %old) {
3532 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3533 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acq_rel seq_cst
3537 define amdgpu_kernel void @local_wavefront_seq_cst_seq_cst_cmpxchg(
3538 ; GFX6-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3539 ; GFX6: ; %bb.0: ; %entry
3540 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3541 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3542 ; GFX6-NEXT: s_mov_b32 m0, -1
3543 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3544 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3545 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3546 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3547 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3548 ; GFX6-NEXT: s_endpgm
3550 ; GFX7-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3551 ; GFX7: ; %bb.0: ; %entry
3552 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3553 ; GFX7-NEXT: s_mov_b32 m0, -1
3554 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3555 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3556 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3557 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3558 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3559 ; GFX7-NEXT: s_endpgm
3561 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3562 ; GFX10-WGP: ; %bb.0: ; %entry
3563 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3564 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3565 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3566 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3567 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3568 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3569 ; GFX10-WGP-NEXT: s_endpgm
3571 ; GFX10-CU-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3572 ; GFX10-CU: ; %bb.0: ; %entry
3573 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3574 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3575 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3576 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3577 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3578 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3579 ; GFX10-CU-NEXT: s_endpgm
3581 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3582 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3583 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3584 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3585 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3586 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3587 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
3588 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
3589 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3590 ; SKIP-CACHE-INV-NEXT: s_endpgm
3592 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3593 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3594 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3595 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3596 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3597 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3598 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3599 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3600 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3602 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3603 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3604 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3605 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3606 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3607 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3608 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3609 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3610 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3612 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3613 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3614 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3615 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3616 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3617 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3618 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3619 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3620 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3622 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3623 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3624 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3625 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3626 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3627 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3628 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3629 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3630 ; GFX940-TGSPLIT-NEXT: s_endpgm
3632 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3633 ; GFX11-WGP: ; %bb.0: ; %entry
3634 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3635 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3636 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3637 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
3638 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3639 ; GFX11-WGP-NEXT: s_endpgm
3641 ; GFX11-CU-LABEL: local_wavefront_seq_cst_seq_cst_cmpxchg:
3642 ; GFX11-CU: ; %bb.0: ; %entry
3643 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3644 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3645 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3646 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
3647 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3648 ; GFX11-CU-NEXT: s_endpgm
3649 ptr addrspace(3) %out, i32 %in, i32 %old) {
3651 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3652 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") seq_cst seq_cst
3656 define amdgpu_kernel void @local_wavefront_monotonic_monotonic_ret_cmpxchg(
3657 ; GFX6-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3658 ; GFX6: ; %bb.0: ; %entry
3659 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3660 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3661 ; GFX6-NEXT: s_mov_b32 m0, -1
3662 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3663 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3664 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3665 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3666 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3667 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3668 ; GFX6-NEXT: ds_write_b32 v0, v1
3669 ; GFX6-NEXT: s_endpgm
3671 ; GFX7-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3672 ; GFX7: ; %bb.0: ; %entry
3673 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3674 ; GFX7-NEXT: s_mov_b32 m0, -1
3675 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3676 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3677 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3678 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3679 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3680 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3681 ; GFX7-NEXT: ds_write_b32 v0, v1
3682 ; GFX7-NEXT: s_endpgm
3684 ; GFX10-WGP-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3685 ; GFX10-WGP: ; %bb.0: ; %entry
3686 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3687 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3688 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3689 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3690 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3691 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3692 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3693 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3694 ; GFX10-WGP-NEXT: s_endpgm
3696 ; GFX10-CU-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3697 ; GFX10-CU: ; %bb.0: ; %entry
3698 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3699 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3700 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3701 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3702 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3703 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3704 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3705 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3706 ; GFX10-CU-NEXT: s_endpgm
3708 ; SKIP-CACHE-INV-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3709 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3710 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3711 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3712 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3713 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3714 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
3715 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
3716 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3717 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3718 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3719 ; SKIP-CACHE-INV-NEXT: s_endpgm
3721 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3722 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3723 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3724 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3725 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3726 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3727 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3728 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3729 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3730 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3731 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3733 ; GFX90A-TGSPLIT-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3734 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3735 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3736 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3737 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3738 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3739 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3740 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3741 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3742 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3743 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3745 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3746 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3747 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3748 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3749 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3750 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3751 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3752 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3753 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3754 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3755 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3757 ; GFX940-TGSPLIT-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3758 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3759 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3760 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3761 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3762 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3763 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3764 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3765 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3766 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
3767 ; GFX940-TGSPLIT-NEXT: s_endpgm
3769 ; GFX11-WGP-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3770 ; GFX11-WGP: ; %bb.0: ; %entry
3771 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3772 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3773 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3774 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
3775 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
3776 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3777 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
3778 ; GFX11-WGP-NEXT: s_endpgm
3780 ; GFX11-CU-LABEL: local_wavefront_monotonic_monotonic_ret_cmpxchg:
3781 ; GFX11-CU: ; %bb.0: ; %entry
3782 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3783 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3784 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3785 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
3786 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
3787 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3788 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
3789 ; GFX11-CU-NEXT: s_endpgm
3790 ptr addrspace(3) %out, i32 %in, i32 %old) {
3792 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3793 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") monotonic monotonic
3794 %val0 = extractvalue { i32, i1 } %val, 0
3795 store i32 %val0, ptr addrspace(3) %out, align 4
3799 define amdgpu_kernel void @local_wavefront_acquire_monotonic_ret_cmpxchg(
3800 ; GFX6-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3801 ; GFX6: ; %bb.0: ; %entry
3802 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3803 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3804 ; GFX6-NEXT: s_mov_b32 m0, -1
3805 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3806 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3807 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3808 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3809 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3810 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3811 ; GFX6-NEXT: ds_write_b32 v0, v1
3812 ; GFX6-NEXT: s_endpgm
3814 ; GFX7-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3815 ; GFX7: ; %bb.0: ; %entry
3816 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3817 ; GFX7-NEXT: s_mov_b32 m0, -1
3818 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3819 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3820 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3821 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3822 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3823 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3824 ; GFX7-NEXT: ds_write_b32 v0, v1
3825 ; GFX7-NEXT: s_endpgm
3827 ; GFX10-WGP-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3828 ; GFX10-WGP: ; %bb.0: ; %entry
3829 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3830 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3831 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3832 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3833 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3834 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3835 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3836 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3837 ; GFX10-WGP-NEXT: s_endpgm
3839 ; GFX10-CU-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3840 ; GFX10-CU: ; %bb.0: ; %entry
3841 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3842 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3843 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3844 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3845 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3846 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3847 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3848 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3849 ; GFX10-CU-NEXT: s_endpgm
3851 ; SKIP-CACHE-INV-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3852 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3853 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3854 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3855 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3856 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3857 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
3858 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
3859 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3860 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3861 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3862 ; SKIP-CACHE-INV-NEXT: s_endpgm
3864 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3865 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3866 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3867 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3868 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3869 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3870 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3871 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3872 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3873 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3874 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3876 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3877 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3878 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3879 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3880 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3881 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3882 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3883 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3884 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3885 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3886 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3888 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3889 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3890 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3891 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3892 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3893 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3894 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3895 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3896 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3897 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3898 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3900 ; GFX940-TGSPLIT-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3901 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3902 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3903 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3904 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3905 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3906 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3907 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3908 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3909 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
3910 ; GFX940-TGSPLIT-NEXT: s_endpgm
3912 ; GFX11-WGP-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3913 ; GFX11-WGP: ; %bb.0: ; %entry
3914 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3915 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3916 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3917 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
3918 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
3919 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3920 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
3921 ; GFX11-WGP-NEXT: s_endpgm
3923 ; GFX11-CU-LABEL: local_wavefront_acquire_monotonic_ret_cmpxchg:
3924 ; GFX11-CU: ; %bb.0: ; %entry
3925 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3926 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3927 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3928 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
3929 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
3930 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3931 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
3932 ; GFX11-CU-NEXT: s_endpgm
3933 ptr addrspace(3) %out, i32 %in, i32 %old) {
3935 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3936 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acquire monotonic
3937 %val0 = extractvalue { i32, i1 } %val, 0
3938 store i32 %val0, ptr addrspace(3) %out, align 4
3942 define amdgpu_kernel void @local_wavefront_release_monotonic_ret_cmpxchg(
3943 ; GFX6-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
3944 ; GFX6: ; %bb.0: ; %entry
3945 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3946 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3947 ; GFX6-NEXT: s_mov_b32 m0, -1
3948 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3949 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3950 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3951 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3952 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3953 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3954 ; GFX6-NEXT: ds_write_b32 v0, v1
3955 ; GFX6-NEXT: s_endpgm
3957 ; GFX7-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
3958 ; GFX7: ; %bb.0: ; %entry
3959 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3960 ; GFX7-NEXT: s_mov_b32 m0, -1
3961 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3962 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3963 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3964 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3965 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3966 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3967 ; GFX7-NEXT: ds_write_b32 v0, v1
3968 ; GFX7-NEXT: s_endpgm
3970 ; GFX10-WGP-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
3971 ; GFX10-WGP: ; %bb.0: ; %entry
3972 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3973 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3974 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3975 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3976 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3977 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3978 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3979 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3980 ; GFX10-WGP-NEXT: s_endpgm
3982 ; GFX10-CU-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
3983 ; GFX10-CU: ; %bb.0: ; %entry
3984 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3985 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3986 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3987 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3988 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3989 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3990 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3991 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3992 ; GFX10-CU-NEXT: s_endpgm
3994 ; SKIP-CACHE-INV-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
3995 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3996 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3997 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3998 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3999 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4000 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
4001 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
4002 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4003 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4004 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4005 ; SKIP-CACHE-INV-NEXT: s_endpgm
4007 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
4008 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4009 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4010 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4011 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4012 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4013 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4014 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4015 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4016 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4017 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4019 ; GFX90A-TGSPLIT-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
4020 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4021 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4022 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4023 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4024 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4025 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4026 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4027 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4028 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4029 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4031 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
4032 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4033 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4034 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4035 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4036 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4037 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4038 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4039 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4040 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4041 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4043 ; GFX940-TGSPLIT-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
4044 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4045 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4046 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4047 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4048 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4049 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4050 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4051 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4052 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
4053 ; GFX940-TGSPLIT-NEXT: s_endpgm
4055 ; GFX11-WGP-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
4056 ; GFX11-WGP: ; %bb.0: ; %entry
4057 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4058 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4059 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4060 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
4061 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4062 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4063 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
4064 ; GFX11-WGP-NEXT: s_endpgm
4066 ; GFX11-CU-LABEL: local_wavefront_release_monotonic_ret_cmpxchg:
4067 ; GFX11-CU: ; %bb.0: ; %entry
4068 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4069 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4070 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4071 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
4072 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4073 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4074 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
4075 ; GFX11-CU-NEXT: s_endpgm
4076 ptr addrspace(3) %out, i32 %in, i32 %old) {
4078 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4079 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") release monotonic
4080 %val0 = extractvalue { i32, i1 } %val, 0
4081 store i32 %val0, ptr addrspace(3) %out, align 4
4085 define amdgpu_kernel void @local_wavefront_acq_rel_monotonic_ret_cmpxchg(
4086 ; GFX6-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4087 ; GFX6: ; %bb.0: ; %entry
4088 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
4089 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
4090 ; GFX6-NEXT: s_mov_b32 m0, -1
4091 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4092 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4093 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4094 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
4095 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4096 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4097 ; GFX6-NEXT: ds_write_b32 v0, v1
4098 ; GFX6-NEXT: s_endpgm
4100 ; GFX7-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4101 ; GFX7: ; %bb.0: ; %entry
4102 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4103 ; GFX7-NEXT: s_mov_b32 m0, -1
4104 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4105 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4106 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
4107 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
4108 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4109 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4110 ; GFX7-NEXT: ds_write_b32 v0, v1
4111 ; GFX7-NEXT: s_endpgm
4113 ; GFX10-WGP-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4114 ; GFX10-WGP: ; %bb.0: ; %entry
4115 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4116 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4117 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4118 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
4119 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
4120 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4121 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4122 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4123 ; GFX10-WGP-NEXT: s_endpgm
4125 ; GFX10-CU-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4126 ; GFX10-CU: ; %bb.0: ; %entry
4127 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4128 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4129 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4130 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
4131 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
4132 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4133 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4134 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4135 ; GFX10-CU-NEXT: s_endpgm
4137 ; SKIP-CACHE-INV-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4138 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4139 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4140 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4141 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4142 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4143 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
4144 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
4145 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4146 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4147 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4148 ; SKIP-CACHE-INV-NEXT: s_endpgm
4150 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4151 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4152 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4153 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4154 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4155 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4156 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4157 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4158 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4159 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4160 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4162 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4163 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4164 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4165 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4166 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4167 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4168 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4169 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4170 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4171 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4172 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4174 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4175 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4176 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4177 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4178 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4179 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4180 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4181 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4182 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4183 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4184 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4186 ; GFX940-TGSPLIT-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4187 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4188 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4189 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4190 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4191 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4192 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4193 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4194 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4195 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
4196 ; GFX940-TGSPLIT-NEXT: s_endpgm
4198 ; GFX11-WGP-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4199 ; GFX11-WGP: ; %bb.0: ; %entry
4200 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4201 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4202 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4203 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
4204 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4205 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4206 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
4207 ; GFX11-WGP-NEXT: s_endpgm
4209 ; GFX11-CU-LABEL: local_wavefront_acq_rel_monotonic_ret_cmpxchg:
4210 ; GFX11-CU: ; %bb.0: ; %entry
4211 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4212 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4213 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4214 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
4215 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4216 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4217 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
4218 ; GFX11-CU-NEXT: s_endpgm
4219 ptr addrspace(3) %out, i32 %in, i32 %old) {
4221 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4222 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acq_rel monotonic
4223 %val0 = extractvalue { i32, i1 } %val, 0
4224 store i32 %val0, ptr addrspace(3) %out, align 4
4228 define amdgpu_kernel void @local_wavefront_seq_cst_monotonic_ret_cmpxchg(
4229 ; GFX6-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4230 ; GFX6: ; %bb.0: ; %entry
4231 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
4232 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
4233 ; GFX6-NEXT: s_mov_b32 m0, -1
4234 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4235 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4236 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4237 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
4238 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4239 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4240 ; GFX6-NEXT: ds_write_b32 v0, v1
4241 ; GFX6-NEXT: s_endpgm
4243 ; GFX7-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4244 ; GFX7: ; %bb.0: ; %entry
4245 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4246 ; GFX7-NEXT: s_mov_b32 m0, -1
4247 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4248 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4249 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
4250 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
4251 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4252 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4253 ; GFX7-NEXT: ds_write_b32 v0, v1
4254 ; GFX7-NEXT: s_endpgm
4256 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4257 ; GFX10-WGP: ; %bb.0: ; %entry
4258 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4259 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4260 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4261 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
4262 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
4263 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4264 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4265 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4266 ; GFX10-WGP-NEXT: s_endpgm
4268 ; GFX10-CU-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4269 ; GFX10-CU: ; %bb.0: ; %entry
4270 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4271 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4272 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4273 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
4274 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
4275 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4276 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4277 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4278 ; GFX10-CU-NEXT: s_endpgm
4280 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4281 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4282 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4283 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4284 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4285 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4286 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
4287 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
4288 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4289 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4290 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4291 ; SKIP-CACHE-INV-NEXT: s_endpgm
4293 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4294 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4295 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4296 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4297 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4298 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4299 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4300 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4301 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4302 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4303 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4305 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4306 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4307 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4308 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4309 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4310 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4311 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4312 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4313 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4314 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4315 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4317 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4318 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4319 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4320 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4321 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4322 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4323 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4324 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4325 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4326 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4327 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4329 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4330 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4331 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4332 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4333 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4334 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4335 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4336 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4337 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4338 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
4339 ; GFX940-TGSPLIT-NEXT: s_endpgm
4341 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4342 ; GFX11-WGP: ; %bb.0: ; %entry
4343 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4344 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4345 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4346 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
4347 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4348 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4349 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
4350 ; GFX11-WGP-NEXT: s_endpgm
4352 ; GFX11-CU-LABEL: local_wavefront_seq_cst_monotonic_ret_cmpxchg:
4353 ; GFX11-CU: ; %bb.0: ; %entry
4354 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4355 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4356 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4357 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
4358 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4359 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4360 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
4361 ; GFX11-CU-NEXT: s_endpgm
4362 ptr addrspace(3) %out, i32 %in, i32 %old) {
4364 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4365 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") seq_cst monotonic
4366 %val0 = extractvalue { i32, i1 } %val, 0
4367 store i32 %val0, ptr addrspace(3) %out, align 4
4371 define amdgpu_kernel void @local_wavefront_monotonic_acquire_ret_cmpxchg(
4372 ; GFX6-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4373 ; GFX6: ; %bb.0: ; %entry
4374 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
4375 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
4376 ; GFX6-NEXT: s_mov_b32 m0, -1
4377 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4378 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4379 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4380 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
4381 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4382 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4383 ; GFX6-NEXT: ds_write_b32 v0, v1
4384 ; GFX6-NEXT: s_endpgm
4386 ; GFX7-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4387 ; GFX7: ; %bb.0: ; %entry
4388 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4389 ; GFX7-NEXT: s_mov_b32 m0, -1
4390 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4391 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4392 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
4393 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
4394 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4395 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4396 ; GFX7-NEXT: ds_write_b32 v0, v1
4397 ; GFX7-NEXT: s_endpgm
4399 ; GFX10-WGP-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4400 ; GFX10-WGP: ; %bb.0: ; %entry
4401 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4402 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4403 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4404 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
4405 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
4406 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4407 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4408 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4409 ; GFX10-WGP-NEXT: s_endpgm
4411 ; GFX10-CU-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4412 ; GFX10-CU: ; %bb.0: ; %entry
4413 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4414 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4415 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4416 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
4417 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
4418 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4419 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4420 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4421 ; GFX10-CU-NEXT: s_endpgm
4423 ; SKIP-CACHE-INV-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4424 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4425 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4426 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4427 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4428 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4429 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
4430 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
4431 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4432 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4433 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4434 ; SKIP-CACHE-INV-NEXT: s_endpgm
4436 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4437 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4438 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4439 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4440 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4441 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4442 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4443 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4444 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4445 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4446 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4448 ; GFX90A-TGSPLIT-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4449 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4450 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4451 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4452 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4453 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4454 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4455 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4456 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4457 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4458 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4460 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4461 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4462 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4463 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4464 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4465 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4466 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4467 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4468 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4469 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4470 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4472 ; GFX940-TGSPLIT-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4473 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4474 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4475 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4476 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4477 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4478 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4479 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4480 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4481 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
4482 ; GFX940-TGSPLIT-NEXT: s_endpgm
4484 ; GFX11-WGP-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4485 ; GFX11-WGP: ; %bb.0: ; %entry
4486 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4487 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4488 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4489 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
4490 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4491 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4492 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
4493 ; GFX11-WGP-NEXT: s_endpgm
4495 ; GFX11-CU-LABEL: local_wavefront_monotonic_acquire_ret_cmpxchg:
4496 ; GFX11-CU: ; %bb.0: ; %entry
4497 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4498 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4499 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4500 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
4501 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4502 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4503 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
4504 ; GFX11-CU-NEXT: s_endpgm
4505 ptr addrspace(3) %out, i32 %in, i32 %old) {
4507 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4508 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") monotonic acquire
4509 %val0 = extractvalue { i32, i1 } %val, 0
4510 store i32 %val0, ptr addrspace(3) %out, align 4
4514 define amdgpu_kernel void @local_wavefront_acquire_acquire_ret_cmpxchg(
4515 ; GFX6-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4516 ; GFX6: ; %bb.0: ; %entry
4517 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
4518 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
4519 ; GFX6-NEXT: s_mov_b32 m0, -1
4520 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4521 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4522 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4523 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
4524 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4525 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4526 ; GFX6-NEXT: ds_write_b32 v0, v1
4527 ; GFX6-NEXT: s_endpgm
4529 ; GFX7-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4530 ; GFX7: ; %bb.0: ; %entry
4531 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4532 ; GFX7-NEXT: s_mov_b32 m0, -1
4533 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4534 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4535 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
4536 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
4537 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4538 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4539 ; GFX7-NEXT: ds_write_b32 v0, v1
4540 ; GFX7-NEXT: s_endpgm
4542 ; GFX10-WGP-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4543 ; GFX10-WGP: ; %bb.0: ; %entry
4544 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4545 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4546 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4547 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
4548 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
4549 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4550 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4551 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4552 ; GFX10-WGP-NEXT: s_endpgm
4554 ; GFX10-CU-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4555 ; GFX10-CU: ; %bb.0: ; %entry
4556 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4557 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4558 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4559 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
4560 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
4561 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4562 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4563 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4564 ; GFX10-CU-NEXT: s_endpgm
4566 ; SKIP-CACHE-INV-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4567 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4568 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4569 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4570 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4571 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4572 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
4573 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
4574 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4575 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4576 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4577 ; SKIP-CACHE-INV-NEXT: s_endpgm
4579 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4580 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4581 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4582 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4583 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4584 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4585 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4586 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4587 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4588 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4589 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4591 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4592 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4593 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4594 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4595 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4596 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4597 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4598 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4599 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4600 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4601 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4603 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4604 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4605 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4606 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4607 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4608 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4609 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4610 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4611 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4612 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4613 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4615 ; GFX940-TGSPLIT-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4616 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4617 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4618 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4619 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4620 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4621 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4622 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4623 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4624 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
4625 ; GFX940-TGSPLIT-NEXT: s_endpgm
4627 ; GFX11-WGP-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4628 ; GFX11-WGP: ; %bb.0: ; %entry
4629 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4630 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4631 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4632 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
4633 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4634 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4635 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
4636 ; GFX11-WGP-NEXT: s_endpgm
4638 ; GFX11-CU-LABEL: local_wavefront_acquire_acquire_ret_cmpxchg:
4639 ; GFX11-CU: ; %bb.0: ; %entry
4640 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4641 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4642 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4643 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
4644 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4645 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4646 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
4647 ; GFX11-CU-NEXT: s_endpgm
4648 ptr addrspace(3) %out, i32 %in, i32 %old) {
4650 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4651 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acquire acquire
4652 %val0 = extractvalue { i32, i1 } %val, 0
4653 store i32 %val0, ptr addrspace(3) %out, align 4
4657 define amdgpu_kernel void @local_wavefront_release_acquire_ret_cmpxchg(
4658 ; GFX6-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4659 ; GFX6: ; %bb.0: ; %entry
4660 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
4661 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
4662 ; GFX6-NEXT: s_mov_b32 m0, -1
4663 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4664 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4665 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4666 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
4667 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4668 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4669 ; GFX6-NEXT: ds_write_b32 v0, v1
4670 ; GFX6-NEXT: s_endpgm
4672 ; GFX7-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4673 ; GFX7: ; %bb.0: ; %entry
4674 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4675 ; GFX7-NEXT: s_mov_b32 m0, -1
4676 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4677 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4678 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
4679 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
4680 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4681 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4682 ; GFX7-NEXT: ds_write_b32 v0, v1
4683 ; GFX7-NEXT: s_endpgm
4685 ; GFX10-WGP-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4686 ; GFX10-WGP: ; %bb.0: ; %entry
4687 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4688 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4689 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4690 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
4691 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
4692 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4693 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4694 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4695 ; GFX10-WGP-NEXT: s_endpgm
4697 ; GFX10-CU-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4698 ; GFX10-CU: ; %bb.0: ; %entry
4699 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4700 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4701 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4702 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
4703 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
4704 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4705 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4706 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4707 ; GFX10-CU-NEXT: s_endpgm
4709 ; SKIP-CACHE-INV-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4710 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4711 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4712 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4713 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4714 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4715 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
4716 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
4717 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4718 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4719 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4720 ; SKIP-CACHE-INV-NEXT: s_endpgm
4722 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4723 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4724 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4725 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4726 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4727 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4728 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4729 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4730 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4731 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4732 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4734 ; GFX90A-TGSPLIT-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4735 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4736 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4737 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4738 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4739 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4740 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4741 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4742 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4743 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4744 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4746 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4747 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4748 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4749 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4750 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4751 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4752 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4753 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4754 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4755 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4756 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4758 ; GFX940-TGSPLIT-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4759 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4760 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4761 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4762 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4763 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4764 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4765 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4766 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4767 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
4768 ; GFX940-TGSPLIT-NEXT: s_endpgm
4770 ; GFX11-WGP-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4771 ; GFX11-WGP: ; %bb.0: ; %entry
4772 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4773 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4774 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4775 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
4776 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4777 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4778 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
4779 ; GFX11-WGP-NEXT: s_endpgm
4781 ; GFX11-CU-LABEL: local_wavefront_release_acquire_ret_cmpxchg:
4782 ; GFX11-CU: ; %bb.0: ; %entry
4783 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4784 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4785 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4786 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
4787 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4788 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4789 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
4790 ; GFX11-CU-NEXT: s_endpgm
4791 ptr addrspace(3) %out, i32 %in, i32 %old) {
4793 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4794 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") release acquire
4795 %val0 = extractvalue { i32, i1 } %val, 0
4796 store i32 %val0, ptr addrspace(3) %out, align 4
4800 define amdgpu_kernel void @local_wavefront_acq_rel_acquire_ret_cmpxchg(
4801 ; GFX6-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4802 ; GFX6: ; %bb.0: ; %entry
4803 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
4804 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
4805 ; GFX6-NEXT: s_mov_b32 m0, -1
4806 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4807 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4808 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4809 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
4810 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4811 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4812 ; GFX6-NEXT: ds_write_b32 v0, v1
4813 ; GFX6-NEXT: s_endpgm
4815 ; GFX7-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4816 ; GFX7: ; %bb.0: ; %entry
4817 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4818 ; GFX7-NEXT: s_mov_b32 m0, -1
4819 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4820 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4821 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
4822 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
4823 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4824 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4825 ; GFX7-NEXT: ds_write_b32 v0, v1
4826 ; GFX7-NEXT: s_endpgm
4828 ; GFX10-WGP-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4829 ; GFX10-WGP: ; %bb.0: ; %entry
4830 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4831 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4832 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4833 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
4834 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
4835 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4836 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4837 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4838 ; GFX10-WGP-NEXT: s_endpgm
4840 ; GFX10-CU-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4841 ; GFX10-CU: ; %bb.0: ; %entry
4842 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4843 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4844 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4845 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
4846 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
4847 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4848 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4849 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4850 ; GFX10-CU-NEXT: s_endpgm
4852 ; SKIP-CACHE-INV-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4853 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4854 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4855 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4856 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4857 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4858 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
4859 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
4860 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4861 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4862 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4863 ; SKIP-CACHE-INV-NEXT: s_endpgm
4865 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4866 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4867 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4868 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4869 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4870 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4871 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4872 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4873 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4874 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4875 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4877 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4878 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4879 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4880 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4881 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4882 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4883 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4884 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4885 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4886 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4887 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4889 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4890 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4891 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4892 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4893 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4894 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4895 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4896 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4897 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4898 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4899 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4901 ; GFX940-TGSPLIT-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4902 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4903 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4904 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4905 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4906 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
4907 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
4908 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4909 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4910 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
4911 ; GFX940-TGSPLIT-NEXT: s_endpgm
4913 ; GFX11-WGP-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4914 ; GFX11-WGP: ; %bb.0: ; %entry
4915 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4916 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4917 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4918 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
4919 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4920 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4921 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
4922 ; GFX11-WGP-NEXT: s_endpgm
4924 ; GFX11-CU-LABEL: local_wavefront_acq_rel_acquire_ret_cmpxchg:
4925 ; GFX11-CU: ; %bb.0: ; %entry
4926 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4927 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4928 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4929 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
4930 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
4931 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4932 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
4933 ; GFX11-CU-NEXT: s_endpgm
4934 ptr addrspace(3) %out, i32 %in, i32 %old) {
4936 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4937 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acq_rel acquire
4938 %val0 = extractvalue { i32, i1 } %val, 0
4939 store i32 %val0, ptr addrspace(3) %out, align 4
4943 define amdgpu_kernel void @local_wavefront_seq_cst_acquire_ret_cmpxchg(
4944 ; GFX6-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
4945 ; GFX6: ; %bb.0: ; %entry
4946 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
4947 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
4948 ; GFX6-NEXT: s_mov_b32 m0, -1
4949 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4950 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4951 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4952 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
4953 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4954 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4955 ; GFX6-NEXT: ds_write_b32 v0, v1
4956 ; GFX6-NEXT: s_endpgm
4958 ; GFX7-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
4959 ; GFX7: ; %bb.0: ; %entry
4960 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4961 ; GFX7-NEXT: s_mov_b32 m0, -1
4962 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4963 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4964 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
4965 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
4966 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4967 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4968 ; GFX7-NEXT: ds_write_b32 v0, v1
4969 ; GFX7-NEXT: s_endpgm
4971 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
4972 ; GFX10-WGP: ; %bb.0: ; %entry
4973 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4974 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4975 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4976 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
4977 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
4978 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4979 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4980 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4981 ; GFX10-WGP-NEXT: s_endpgm
4983 ; GFX10-CU-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
4984 ; GFX10-CU: ; %bb.0: ; %entry
4985 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4986 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4987 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4988 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
4989 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
4990 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
4991 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4992 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4993 ; GFX10-CU-NEXT: s_endpgm
4995 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
4996 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4997 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4998 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4999 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5000 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5001 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5002 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5003 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5004 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5005 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5006 ; SKIP-CACHE-INV-NEXT: s_endpgm
5008 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
5009 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5010 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5011 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5012 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5013 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5014 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5015 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5016 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5017 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5018 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5020 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
5021 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5022 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5023 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5024 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5025 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5026 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5027 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5028 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5029 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5030 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5032 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
5033 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5034 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5035 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5036 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5037 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5038 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5039 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5040 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5041 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5042 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5044 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
5045 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5046 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5047 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5048 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5049 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5050 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5051 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5052 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5053 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
5054 ; GFX940-TGSPLIT-NEXT: s_endpgm
5056 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
5057 ; GFX11-WGP: ; %bb.0: ; %entry
5058 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5059 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5060 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5061 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
5062 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5063 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5064 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
5065 ; GFX11-WGP-NEXT: s_endpgm
5067 ; GFX11-CU-LABEL: local_wavefront_seq_cst_acquire_ret_cmpxchg:
5068 ; GFX11-CU: ; %bb.0: ; %entry
5069 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5070 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5071 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5072 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
5073 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5074 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5075 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
5076 ; GFX11-CU-NEXT: s_endpgm
5077 ptr addrspace(3) %out, i32 %in, i32 %old) {
5079 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5080 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") seq_cst acquire
5081 %val0 = extractvalue { i32, i1 } %val, 0
5082 store i32 %val0, ptr addrspace(3) %out, align 4
5086 define amdgpu_kernel void @local_wavefront_monotonic_seq_cst_ret_cmpxchg(
5087 ; GFX6-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5088 ; GFX6: ; %bb.0: ; %entry
5089 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5090 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5091 ; GFX6-NEXT: s_mov_b32 m0, -1
5092 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5093 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5094 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5095 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5096 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5097 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5098 ; GFX6-NEXT: ds_write_b32 v0, v1
5099 ; GFX6-NEXT: s_endpgm
5101 ; GFX7-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5102 ; GFX7: ; %bb.0: ; %entry
5103 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5104 ; GFX7-NEXT: s_mov_b32 m0, -1
5105 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5106 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5107 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5108 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5109 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5110 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5111 ; GFX7-NEXT: ds_write_b32 v0, v1
5112 ; GFX7-NEXT: s_endpgm
5114 ; GFX10-WGP-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5115 ; GFX10-WGP: ; %bb.0: ; %entry
5116 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5117 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5118 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5119 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5120 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5121 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5122 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5123 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5124 ; GFX10-WGP-NEXT: s_endpgm
5126 ; GFX10-CU-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5127 ; GFX10-CU: ; %bb.0: ; %entry
5128 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5129 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5130 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5131 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5132 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5133 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5134 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5135 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5136 ; GFX10-CU-NEXT: s_endpgm
5138 ; SKIP-CACHE-INV-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5139 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5140 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5141 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5142 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5143 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5144 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5145 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5146 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5147 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5148 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5149 ; SKIP-CACHE-INV-NEXT: s_endpgm
5151 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5152 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5153 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5154 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5155 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5156 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5157 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5158 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5159 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5160 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5161 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5163 ; GFX90A-TGSPLIT-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5164 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5165 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5166 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5167 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5168 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5169 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5170 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5171 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5172 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5173 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5175 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5176 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5177 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5178 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5179 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5180 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5181 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5182 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5183 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5184 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5185 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5187 ; GFX940-TGSPLIT-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5188 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5189 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5190 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5191 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5192 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5193 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5194 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5195 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5196 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
5197 ; GFX940-TGSPLIT-NEXT: s_endpgm
5199 ; GFX11-WGP-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5200 ; GFX11-WGP: ; %bb.0: ; %entry
5201 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5202 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5203 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5204 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
5205 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5206 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5207 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
5208 ; GFX11-WGP-NEXT: s_endpgm
5210 ; GFX11-CU-LABEL: local_wavefront_monotonic_seq_cst_ret_cmpxchg:
5211 ; GFX11-CU: ; %bb.0: ; %entry
5212 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5213 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5214 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5215 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
5216 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5217 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5218 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
5219 ; GFX11-CU-NEXT: s_endpgm
5220 ptr addrspace(3) %out, i32 %in, i32 %old) {
5222 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5223 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") monotonic seq_cst
5224 %val0 = extractvalue { i32, i1 } %val, 0
5225 store i32 %val0, ptr addrspace(3) %out, align 4
5229 define amdgpu_kernel void @local_wavefront_acquire_seq_cst_ret_cmpxchg(
5230 ; GFX6-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5231 ; GFX6: ; %bb.0: ; %entry
5232 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5233 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5234 ; GFX6-NEXT: s_mov_b32 m0, -1
5235 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5236 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5237 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5238 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5239 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5240 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5241 ; GFX6-NEXT: ds_write_b32 v0, v1
5242 ; GFX6-NEXT: s_endpgm
5244 ; GFX7-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5245 ; GFX7: ; %bb.0: ; %entry
5246 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5247 ; GFX7-NEXT: s_mov_b32 m0, -1
5248 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5249 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5250 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5251 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5252 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5253 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5254 ; GFX7-NEXT: ds_write_b32 v0, v1
5255 ; GFX7-NEXT: s_endpgm
5257 ; GFX10-WGP-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5258 ; GFX10-WGP: ; %bb.0: ; %entry
5259 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5260 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5261 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5262 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5263 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5264 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5265 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5266 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5267 ; GFX10-WGP-NEXT: s_endpgm
5269 ; GFX10-CU-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5270 ; GFX10-CU: ; %bb.0: ; %entry
5271 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5272 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5273 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5274 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5275 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5276 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5277 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5278 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5279 ; GFX10-CU-NEXT: s_endpgm
5281 ; SKIP-CACHE-INV-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5282 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5283 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5284 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5285 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5286 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5287 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5288 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5289 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5290 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5291 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5292 ; SKIP-CACHE-INV-NEXT: s_endpgm
5294 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5295 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5296 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5297 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5298 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5299 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5300 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5301 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5302 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5303 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5304 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5306 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5307 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5308 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5309 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5310 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5311 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5312 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5313 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5314 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5315 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5316 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5318 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5319 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5320 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5321 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5322 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5323 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5324 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5325 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5326 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5327 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5328 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5330 ; GFX940-TGSPLIT-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5331 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5332 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5333 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5334 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5335 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5336 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5337 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5338 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5339 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
5340 ; GFX940-TGSPLIT-NEXT: s_endpgm
5342 ; GFX11-WGP-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5343 ; GFX11-WGP: ; %bb.0: ; %entry
5344 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5345 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5346 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5347 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
5348 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5349 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5350 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
5351 ; GFX11-WGP-NEXT: s_endpgm
5353 ; GFX11-CU-LABEL: local_wavefront_acquire_seq_cst_ret_cmpxchg:
5354 ; GFX11-CU: ; %bb.0: ; %entry
5355 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5356 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5357 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5358 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
5359 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5360 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5361 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
5362 ; GFX11-CU-NEXT: s_endpgm
5363 ptr addrspace(3) %out, i32 %in, i32 %old) {
5365 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5366 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acquire seq_cst
5367 %val0 = extractvalue { i32, i1 } %val, 0
5368 store i32 %val0, ptr addrspace(3) %out, align 4
5372 define amdgpu_kernel void @local_wavefront_release_seq_cst_ret_cmpxchg(
5373 ; GFX6-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5374 ; GFX6: ; %bb.0: ; %entry
5375 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5376 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5377 ; GFX6-NEXT: s_mov_b32 m0, -1
5378 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5379 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5380 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5381 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5382 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5383 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5384 ; GFX6-NEXT: ds_write_b32 v0, v1
5385 ; GFX6-NEXT: s_endpgm
5387 ; GFX7-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5388 ; GFX7: ; %bb.0: ; %entry
5389 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5390 ; GFX7-NEXT: s_mov_b32 m0, -1
5391 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5392 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5393 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5394 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5395 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5396 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5397 ; GFX7-NEXT: ds_write_b32 v0, v1
5398 ; GFX7-NEXT: s_endpgm
5400 ; GFX10-WGP-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5401 ; GFX10-WGP: ; %bb.0: ; %entry
5402 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5403 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5404 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5405 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5406 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5407 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5408 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5409 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5410 ; GFX10-WGP-NEXT: s_endpgm
5412 ; GFX10-CU-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5413 ; GFX10-CU: ; %bb.0: ; %entry
5414 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5415 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5416 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5417 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5418 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5419 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5420 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5421 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5422 ; GFX10-CU-NEXT: s_endpgm
5424 ; SKIP-CACHE-INV-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5425 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5426 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5427 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5428 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5429 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5430 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5431 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5432 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5433 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5434 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5435 ; SKIP-CACHE-INV-NEXT: s_endpgm
5437 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5438 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5439 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5440 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5441 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5442 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5443 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5444 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5445 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5446 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5447 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5449 ; GFX90A-TGSPLIT-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5450 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5451 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5452 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5453 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5454 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5455 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5456 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5457 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5458 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5459 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5461 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5462 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5463 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5464 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5465 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5466 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5467 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5468 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5469 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5470 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5471 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5473 ; GFX940-TGSPLIT-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5474 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5475 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5476 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5477 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5478 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5479 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5480 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5481 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5482 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
5483 ; GFX940-TGSPLIT-NEXT: s_endpgm
5485 ; GFX11-WGP-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5486 ; GFX11-WGP: ; %bb.0: ; %entry
5487 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5488 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5489 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5490 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
5491 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5492 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5493 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
5494 ; GFX11-WGP-NEXT: s_endpgm
5496 ; GFX11-CU-LABEL: local_wavefront_release_seq_cst_ret_cmpxchg:
5497 ; GFX11-CU: ; %bb.0: ; %entry
5498 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5499 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5500 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5501 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
5502 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5503 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5504 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
5505 ; GFX11-CU-NEXT: s_endpgm
5506 ptr addrspace(3) %out, i32 %in, i32 %old) {
5508 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5509 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") release seq_cst
5510 %val0 = extractvalue { i32, i1 } %val, 0
5511 store i32 %val0, ptr addrspace(3) %out, align 4
5515 define amdgpu_kernel void @local_wavefront_acq_rel_seq_cst_ret_cmpxchg(
5516 ; GFX6-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5517 ; GFX6: ; %bb.0: ; %entry
5518 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5519 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5520 ; GFX6-NEXT: s_mov_b32 m0, -1
5521 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5522 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5523 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5524 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5525 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5526 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5527 ; GFX6-NEXT: ds_write_b32 v0, v1
5528 ; GFX6-NEXT: s_endpgm
5530 ; GFX7-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5531 ; GFX7: ; %bb.0: ; %entry
5532 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5533 ; GFX7-NEXT: s_mov_b32 m0, -1
5534 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5535 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5536 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5537 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5538 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5539 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5540 ; GFX7-NEXT: ds_write_b32 v0, v1
5541 ; GFX7-NEXT: s_endpgm
5543 ; GFX10-WGP-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5544 ; GFX10-WGP: ; %bb.0: ; %entry
5545 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5546 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5547 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5548 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5549 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5550 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5551 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5552 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5553 ; GFX10-WGP-NEXT: s_endpgm
5555 ; GFX10-CU-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5556 ; GFX10-CU: ; %bb.0: ; %entry
5557 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5558 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5559 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5560 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5561 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5562 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5563 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5564 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5565 ; GFX10-CU-NEXT: s_endpgm
5567 ; SKIP-CACHE-INV-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5568 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5569 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5570 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5571 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5572 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5573 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5574 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5575 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5576 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5577 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5578 ; SKIP-CACHE-INV-NEXT: s_endpgm
5580 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5581 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5582 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5583 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5584 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5585 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5586 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5587 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5588 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5589 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5590 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5592 ; GFX90A-TGSPLIT-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5593 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5594 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5595 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5596 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5597 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5598 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5599 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5600 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5601 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5602 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5604 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5605 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5606 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5607 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5608 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5609 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5610 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5611 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5612 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5613 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5614 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5616 ; GFX940-TGSPLIT-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5617 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5618 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5619 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5620 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5621 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5622 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5623 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5624 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5625 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
5626 ; GFX940-TGSPLIT-NEXT: s_endpgm
5628 ; GFX11-WGP-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5629 ; GFX11-WGP: ; %bb.0: ; %entry
5630 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5631 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5632 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5633 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
5634 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5635 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5636 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
5637 ; GFX11-WGP-NEXT: s_endpgm
5639 ; GFX11-CU-LABEL: local_wavefront_acq_rel_seq_cst_ret_cmpxchg:
5640 ; GFX11-CU: ; %bb.0: ; %entry
5641 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5642 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5643 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5644 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
5645 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5646 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5647 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
5648 ; GFX11-CU-NEXT: s_endpgm
5649 ptr addrspace(3) %out, i32 %in, i32 %old) {
5651 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5652 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") acq_rel seq_cst
5653 %val0 = extractvalue { i32, i1 } %val, 0
5654 store i32 %val0, ptr addrspace(3) %out, align 4
5658 define amdgpu_kernel void @local_wavefront_seq_cst_seq_cst_ret_cmpxchg(
5659 ; GFX6-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5660 ; GFX6: ; %bb.0: ; %entry
5661 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5662 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5663 ; GFX6-NEXT: s_mov_b32 m0, -1
5664 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5665 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5666 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5667 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5668 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5669 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5670 ; GFX6-NEXT: ds_write_b32 v0, v1
5671 ; GFX6-NEXT: s_endpgm
5673 ; GFX7-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5674 ; GFX7: ; %bb.0: ; %entry
5675 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5676 ; GFX7-NEXT: s_mov_b32 m0, -1
5677 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5678 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5679 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5680 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5681 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5682 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5683 ; GFX7-NEXT: ds_write_b32 v0, v1
5684 ; GFX7-NEXT: s_endpgm
5686 ; GFX10-WGP-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5687 ; GFX10-WGP: ; %bb.0: ; %entry
5688 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5689 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5690 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5691 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5692 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5693 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5694 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5695 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5696 ; GFX10-WGP-NEXT: s_endpgm
5698 ; GFX10-CU-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5699 ; GFX10-CU: ; %bb.0: ; %entry
5700 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5701 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5702 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5703 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5704 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5705 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5706 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5707 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5708 ; GFX10-CU-NEXT: s_endpgm
5710 ; SKIP-CACHE-INV-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5711 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5712 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5713 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5714 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5715 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5716 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5717 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5718 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5719 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5720 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5721 ; SKIP-CACHE-INV-NEXT: s_endpgm
5723 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5724 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5725 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5726 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5727 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5728 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5729 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5730 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5731 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5732 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5733 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5735 ; GFX90A-TGSPLIT-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5736 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5737 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5738 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5739 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5740 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5741 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5742 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5743 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5744 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5745 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5747 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5748 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5749 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5750 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5751 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5752 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5753 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5754 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5755 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5756 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5757 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5759 ; GFX940-TGSPLIT-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5760 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5761 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5762 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5763 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5764 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5765 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5766 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5767 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5768 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
5769 ; GFX940-TGSPLIT-NEXT: s_endpgm
5771 ; GFX11-WGP-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5772 ; GFX11-WGP: ; %bb.0: ; %entry
5773 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5774 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5775 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5776 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
5777 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5778 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5779 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
5780 ; GFX11-WGP-NEXT: s_endpgm
5782 ; GFX11-CU-LABEL: local_wavefront_seq_cst_seq_cst_ret_cmpxchg:
5783 ; GFX11-CU: ; %bb.0: ; %entry
5784 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5785 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5786 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5787 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
5788 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5789 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5790 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
5791 ; GFX11-CU-NEXT: s_endpgm
5792 ptr addrspace(3) %out, i32 %in, i32 %old) {
5794 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5795 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront") seq_cst seq_cst
5796 %val0 = extractvalue { i32, i1 } %val, 0
5797 store i32 %val0, ptr addrspace(3) %out, align 4
5801 define amdgpu_kernel void @local_wavefront_one_as_unordered_load(
5802 ; GFX6-LABEL: local_wavefront_one_as_unordered_load:
5803 ; GFX6: ; %bb.0: ; %entry
5804 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5805 ; GFX6-NEXT: s_mov_b32 m0, -1
5806 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5807 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
5808 ; GFX6-NEXT: ds_read_b32 v0, v0
5809 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5810 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5811 ; GFX6-NEXT: ds_write_b32 v1, v0
5812 ; GFX6-NEXT: s_endpgm
5814 ; GFX7-LABEL: local_wavefront_one_as_unordered_load:
5815 ; GFX7: ; %bb.0: ; %entry
5816 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5817 ; GFX7-NEXT: s_mov_b32 m0, -1
5818 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5819 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5820 ; GFX7-NEXT: ds_read_b32 v0, v0
5821 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5822 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5823 ; GFX7-NEXT: ds_write_b32 v1, v0
5824 ; GFX7-NEXT: s_endpgm
5826 ; GFX10-WGP-LABEL: local_wavefront_one_as_unordered_load:
5827 ; GFX10-WGP: ; %bb.0: ; %entry
5828 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5829 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5830 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5831 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5832 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
5833 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5834 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
5835 ; GFX10-WGP-NEXT: s_endpgm
5837 ; GFX10-CU-LABEL: local_wavefront_one_as_unordered_load:
5838 ; GFX10-CU: ; %bb.0: ; %entry
5839 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5840 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5841 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5842 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5843 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
5844 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5845 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
5846 ; GFX10-CU-NEXT: s_endpgm
5848 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_unordered_load:
5849 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5850 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
5851 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5852 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5853 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5854 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
5855 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5856 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5857 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
5858 ; SKIP-CACHE-INV-NEXT: s_endpgm
5860 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_unordered_load:
5861 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5862 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5863 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5864 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5865 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
5866 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5867 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5868 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
5869 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5871 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_unordered_load:
5872 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5873 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5874 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5875 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5876 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
5877 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5878 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5879 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
5880 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5882 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_unordered_load:
5883 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5884 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
5885 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5886 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5887 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
5888 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5889 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5890 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
5891 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5893 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_unordered_load:
5894 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5895 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
5896 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5897 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5898 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v0, v0
5899 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5900 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5901 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v1, v0
5902 ; GFX940-TGSPLIT-NEXT: s_endpgm
5904 ; GFX11-WGP-LABEL: local_wavefront_one_as_unordered_load:
5905 ; GFX11-WGP: ; %bb.0: ; %entry
5906 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
5907 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5908 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5909 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
5910 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5911 ; GFX11-WGP-NEXT: ds_store_b32 v1, v0
5912 ; GFX11-WGP-NEXT: s_endpgm
5914 ; GFX11-CU-LABEL: local_wavefront_one_as_unordered_load:
5915 ; GFX11-CU: ; %bb.0: ; %entry
5916 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
5917 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5918 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5919 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
5920 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5921 ; GFX11-CU-NEXT: ds_store_b32 v1, v0
5922 ; GFX11-CU-NEXT: s_endpgm
5923 ptr addrspace(3) %in, ptr addrspace(3) %out) {
5925 %val = load atomic i32, ptr addrspace(3) %in syncscope("wavefront-one-as") unordered, align 4
5926 store i32 %val, ptr addrspace(3) %out
5930 define amdgpu_kernel void @local_wavefront_one_as_monotonic_load(
5931 ; GFX6-LABEL: local_wavefront_one_as_monotonic_load:
5932 ; GFX6: ; %bb.0: ; %entry
5933 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5934 ; GFX6-NEXT: s_mov_b32 m0, -1
5935 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5936 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
5937 ; GFX6-NEXT: ds_read_b32 v0, v0
5938 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5939 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5940 ; GFX6-NEXT: ds_write_b32 v1, v0
5941 ; GFX6-NEXT: s_endpgm
5943 ; GFX7-LABEL: local_wavefront_one_as_monotonic_load:
5944 ; GFX7: ; %bb.0: ; %entry
5945 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5946 ; GFX7-NEXT: s_mov_b32 m0, -1
5947 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5948 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5949 ; GFX7-NEXT: ds_read_b32 v0, v0
5950 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5951 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5952 ; GFX7-NEXT: ds_write_b32 v1, v0
5953 ; GFX7-NEXT: s_endpgm
5955 ; GFX10-WGP-LABEL: local_wavefront_one_as_monotonic_load:
5956 ; GFX10-WGP: ; %bb.0: ; %entry
5957 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5958 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5959 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5960 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5961 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
5962 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5963 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
5964 ; GFX10-WGP-NEXT: s_endpgm
5966 ; GFX10-CU-LABEL: local_wavefront_one_as_monotonic_load:
5967 ; GFX10-CU: ; %bb.0: ; %entry
5968 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5969 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5970 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5971 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5972 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
5973 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5974 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
5975 ; GFX10-CU-NEXT: s_endpgm
5977 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_monotonic_load:
5978 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5979 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
5980 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5981 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5982 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5983 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
5984 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5985 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5986 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
5987 ; SKIP-CACHE-INV-NEXT: s_endpgm
5989 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_load:
5990 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5991 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5992 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5993 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5994 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
5995 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5996 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5997 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
5998 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6000 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_load:
6001 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6002 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6003 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6004 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6005 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
6006 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6007 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6008 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
6009 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6011 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_load:
6012 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6013 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6014 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6015 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6016 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
6017 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6018 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6019 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
6020 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6022 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_load:
6023 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6024 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6025 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6026 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6027 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v0, v0
6028 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6029 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6030 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v1, v0
6031 ; GFX940-TGSPLIT-NEXT: s_endpgm
6033 ; GFX11-WGP-LABEL: local_wavefront_one_as_monotonic_load:
6034 ; GFX11-WGP: ; %bb.0: ; %entry
6035 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6036 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6037 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6038 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
6039 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6040 ; GFX11-WGP-NEXT: ds_store_b32 v1, v0
6041 ; GFX11-WGP-NEXT: s_endpgm
6043 ; GFX11-CU-LABEL: local_wavefront_one_as_monotonic_load:
6044 ; GFX11-CU: ; %bb.0: ; %entry
6045 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6046 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6047 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6048 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
6049 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6050 ; GFX11-CU-NEXT: ds_store_b32 v1, v0
6051 ; GFX11-CU-NEXT: s_endpgm
6052 ptr addrspace(3) %in, ptr addrspace(3) %out) {
6054 %val = load atomic i32, ptr addrspace(3) %in syncscope("wavefront-one-as") monotonic, align 4
6055 store i32 %val, ptr addrspace(3) %out
6059 define amdgpu_kernel void @local_wavefront_one_as_acquire_load(
6060 ; GFX6-LABEL: local_wavefront_one_as_acquire_load:
6061 ; GFX6: ; %bb.0: ; %entry
6062 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6063 ; GFX6-NEXT: s_mov_b32 m0, -1
6064 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6065 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
6066 ; GFX6-NEXT: ds_read_b32 v0, v0
6067 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6068 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6069 ; GFX6-NEXT: ds_write_b32 v1, v0
6070 ; GFX6-NEXT: s_endpgm
6072 ; GFX7-LABEL: local_wavefront_one_as_acquire_load:
6073 ; GFX7: ; %bb.0: ; %entry
6074 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6075 ; GFX7-NEXT: s_mov_b32 m0, -1
6076 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6077 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6078 ; GFX7-NEXT: ds_read_b32 v0, v0
6079 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6080 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6081 ; GFX7-NEXT: ds_write_b32 v1, v0
6082 ; GFX7-NEXT: s_endpgm
6084 ; GFX10-WGP-LABEL: local_wavefront_one_as_acquire_load:
6085 ; GFX10-WGP: ; %bb.0: ; %entry
6086 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6087 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6088 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6089 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6090 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
6091 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6092 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
6093 ; GFX10-WGP-NEXT: s_endpgm
6095 ; GFX10-CU-LABEL: local_wavefront_one_as_acquire_load:
6096 ; GFX10-CU: ; %bb.0: ; %entry
6097 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6098 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6099 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6100 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6101 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
6102 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6103 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
6104 ; GFX10-CU-NEXT: s_endpgm
6106 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acquire_load:
6107 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6108 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6109 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6110 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6111 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6112 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
6113 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6114 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6115 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
6116 ; SKIP-CACHE-INV-NEXT: s_endpgm
6118 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_load:
6119 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6120 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6121 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6122 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6123 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
6124 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6125 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6126 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
6127 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6129 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acquire_load:
6130 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6131 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6132 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6133 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6134 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
6135 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6136 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6137 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
6138 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6140 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_load:
6141 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6142 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6143 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6144 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6145 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
6146 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6147 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6148 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
6149 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6151 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acquire_load:
6152 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6153 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6154 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6155 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6156 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v0, v0
6157 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6158 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6159 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v1, v0
6160 ; GFX940-TGSPLIT-NEXT: s_endpgm
6162 ; GFX11-WGP-LABEL: local_wavefront_one_as_acquire_load:
6163 ; GFX11-WGP: ; %bb.0: ; %entry
6164 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6165 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6166 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6167 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
6168 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6169 ; GFX11-WGP-NEXT: ds_store_b32 v1, v0
6170 ; GFX11-WGP-NEXT: s_endpgm
6172 ; GFX11-CU-LABEL: local_wavefront_one_as_acquire_load:
6173 ; GFX11-CU: ; %bb.0: ; %entry
6174 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6175 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6176 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6177 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
6178 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6179 ; GFX11-CU-NEXT: ds_store_b32 v1, v0
6180 ; GFX11-CU-NEXT: s_endpgm
6181 ptr addrspace(3) %in, ptr addrspace(3) %out) {
6183 %val = load atomic i32, ptr addrspace(3) %in syncscope("wavefront-one-as") acquire, align 4
6184 store i32 %val, ptr addrspace(3) %out
6188 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_load(
6189 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_load:
6190 ; GFX6: ; %bb.0: ; %entry
6191 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6192 ; GFX6-NEXT: s_mov_b32 m0, -1
6193 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6194 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
6195 ; GFX6-NEXT: ds_read_b32 v0, v0
6196 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6197 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6198 ; GFX6-NEXT: ds_write_b32 v1, v0
6199 ; GFX6-NEXT: s_endpgm
6201 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_load:
6202 ; GFX7: ; %bb.0: ; %entry
6203 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6204 ; GFX7-NEXT: s_mov_b32 m0, -1
6205 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6206 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6207 ; GFX7-NEXT: ds_read_b32 v0, v0
6208 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6209 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6210 ; GFX7-NEXT: ds_write_b32 v1, v0
6211 ; GFX7-NEXT: s_endpgm
6213 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_load:
6214 ; GFX10-WGP: ; %bb.0: ; %entry
6215 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6216 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6217 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6218 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6219 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
6220 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6221 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
6222 ; GFX10-WGP-NEXT: s_endpgm
6224 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_load:
6225 ; GFX10-CU: ; %bb.0: ; %entry
6226 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6227 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6228 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6229 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6230 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
6231 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6232 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
6233 ; GFX10-CU-NEXT: s_endpgm
6235 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_load:
6236 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6237 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6238 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6239 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6240 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6241 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
6242 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6243 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6244 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
6245 ; SKIP-CACHE-INV-NEXT: s_endpgm
6247 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_load:
6248 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6249 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6250 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6251 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6252 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
6253 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6254 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6255 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
6256 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6258 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_load:
6259 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6260 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6261 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6262 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6263 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
6264 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6265 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6266 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
6267 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6269 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_load:
6270 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6271 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6272 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6273 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6274 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
6275 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6276 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6277 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
6278 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6280 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_load:
6281 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6282 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6283 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6284 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6285 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v0, v0
6286 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6287 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6288 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v1, v0
6289 ; GFX940-TGSPLIT-NEXT: s_endpgm
6291 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_load:
6292 ; GFX11-WGP: ; %bb.0: ; %entry
6293 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6294 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6295 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6296 ; GFX11-WGP-NEXT: ds_load_b32 v0, v0
6297 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6298 ; GFX11-WGP-NEXT: ds_store_b32 v1, v0
6299 ; GFX11-WGP-NEXT: s_endpgm
6301 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_load:
6302 ; GFX11-CU: ; %bb.0: ; %entry
6303 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6304 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6305 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6306 ; GFX11-CU-NEXT: ds_load_b32 v0, v0
6307 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6308 ; GFX11-CU-NEXT: ds_store_b32 v1, v0
6309 ; GFX11-CU-NEXT: s_endpgm
6310 ptr addrspace(3) %in, ptr addrspace(3) %out) {
6312 %val = load atomic i32, ptr addrspace(3) %in syncscope("wavefront-one-as") seq_cst, align 4
6313 store i32 %val, ptr addrspace(3) %out
6317 define amdgpu_kernel void @local_wavefront_one_as_unordered_store(
6318 ; GFX6-LABEL: local_wavefront_one_as_unordered_store:
6319 ; GFX6: ; %bb.0: ; %entry
6320 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6321 ; GFX6-NEXT: s_mov_b32 m0, -1
6322 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6323 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
6324 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
6325 ; GFX6-NEXT: ds_write_b32 v0, v1
6326 ; GFX6-NEXT: s_endpgm
6328 ; GFX7-LABEL: local_wavefront_one_as_unordered_store:
6329 ; GFX7: ; %bb.0: ; %entry
6330 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6331 ; GFX7-NEXT: s_mov_b32 m0, -1
6332 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6333 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
6334 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
6335 ; GFX7-NEXT: ds_write_b32 v0, v1
6336 ; GFX7-NEXT: s_endpgm
6338 ; GFX10-WGP-LABEL: local_wavefront_one_as_unordered_store:
6339 ; GFX10-WGP: ; %bb.0: ; %entry
6340 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6341 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6342 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
6343 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
6344 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6345 ; GFX10-WGP-NEXT: s_endpgm
6347 ; GFX10-CU-LABEL: local_wavefront_one_as_unordered_store:
6348 ; GFX10-CU: ; %bb.0: ; %entry
6349 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6350 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6351 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
6352 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
6353 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6354 ; GFX10-CU-NEXT: s_endpgm
6356 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_unordered_store:
6357 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6358 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6359 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6360 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6361 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
6362 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6363 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6364 ; SKIP-CACHE-INV-NEXT: s_endpgm
6366 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_unordered_store:
6367 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6368 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6369 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6370 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6371 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6372 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6373 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6375 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_unordered_store:
6376 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6377 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6378 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6379 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6380 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6381 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6382 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6384 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_unordered_store:
6385 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6386 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6387 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6388 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6389 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6390 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6391 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6393 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_unordered_store:
6394 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6395 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6396 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6397 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6398 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6399 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
6400 ; GFX940-TGSPLIT-NEXT: s_endpgm
6402 ; GFX11-WGP-LABEL: local_wavefront_one_as_unordered_store:
6403 ; GFX11-WGP: ; %bb.0: ; %entry
6404 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6405 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6406 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
6407 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
6408 ; GFX11-WGP-NEXT: s_endpgm
6410 ; GFX11-CU-LABEL: local_wavefront_one_as_unordered_store:
6411 ; GFX11-CU: ; %bb.0: ; %entry
6412 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6413 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6414 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
6415 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
6416 ; GFX11-CU-NEXT: s_endpgm
6417 i32 %in, ptr addrspace(3) %out) {
6419 store atomic i32 %in, ptr addrspace(3) %out syncscope("wavefront-one-as") unordered, align 4
6423 define amdgpu_kernel void @local_wavefront_one_as_monotonic_store(
6424 ; GFX6-LABEL: local_wavefront_one_as_monotonic_store:
6425 ; GFX6: ; %bb.0: ; %entry
6426 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6427 ; GFX6-NEXT: s_mov_b32 m0, -1
6428 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6429 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
6430 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
6431 ; GFX6-NEXT: ds_write_b32 v0, v1
6432 ; GFX6-NEXT: s_endpgm
6434 ; GFX7-LABEL: local_wavefront_one_as_monotonic_store:
6435 ; GFX7: ; %bb.0: ; %entry
6436 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6437 ; GFX7-NEXT: s_mov_b32 m0, -1
6438 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6439 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
6440 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
6441 ; GFX7-NEXT: ds_write_b32 v0, v1
6442 ; GFX7-NEXT: s_endpgm
6444 ; GFX10-WGP-LABEL: local_wavefront_one_as_monotonic_store:
6445 ; GFX10-WGP: ; %bb.0: ; %entry
6446 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6447 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6448 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
6449 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
6450 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6451 ; GFX10-WGP-NEXT: s_endpgm
6453 ; GFX10-CU-LABEL: local_wavefront_one_as_monotonic_store:
6454 ; GFX10-CU: ; %bb.0: ; %entry
6455 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6456 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6457 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
6458 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
6459 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6460 ; GFX10-CU-NEXT: s_endpgm
6462 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_monotonic_store:
6463 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6464 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6465 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6466 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6467 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
6468 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6469 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6470 ; SKIP-CACHE-INV-NEXT: s_endpgm
6472 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_store:
6473 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6474 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6475 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6476 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6477 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6478 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6479 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6481 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_store:
6482 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6483 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6484 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6485 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6486 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6487 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6488 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6490 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_store:
6491 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6492 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6493 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6494 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6495 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6496 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6497 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6499 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_store:
6500 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6501 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6502 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6503 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6504 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6505 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
6506 ; GFX940-TGSPLIT-NEXT: s_endpgm
6508 ; GFX11-WGP-LABEL: local_wavefront_one_as_monotonic_store:
6509 ; GFX11-WGP: ; %bb.0: ; %entry
6510 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6511 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6512 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
6513 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
6514 ; GFX11-WGP-NEXT: s_endpgm
6516 ; GFX11-CU-LABEL: local_wavefront_one_as_monotonic_store:
6517 ; GFX11-CU: ; %bb.0: ; %entry
6518 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6519 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6520 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
6521 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
6522 ; GFX11-CU-NEXT: s_endpgm
6523 i32 %in, ptr addrspace(3) %out) {
6525 store atomic i32 %in, ptr addrspace(3) %out syncscope("wavefront-one-as") monotonic, align 4
6529 define amdgpu_kernel void @local_wavefront_one_as_release_store(
6530 ; GFX6-LABEL: local_wavefront_one_as_release_store:
6531 ; GFX6: ; %bb.0: ; %entry
6532 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6533 ; GFX6-NEXT: s_mov_b32 m0, -1
6534 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6535 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
6536 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
6537 ; GFX6-NEXT: ds_write_b32 v0, v1
6538 ; GFX6-NEXT: s_endpgm
6540 ; GFX7-LABEL: local_wavefront_one_as_release_store:
6541 ; GFX7: ; %bb.0: ; %entry
6542 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6543 ; GFX7-NEXT: s_mov_b32 m0, -1
6544 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6545 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
6546 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
6547 ; GFX7-NEXT: ds_write_b32 v0, v1
6548 ; GFX7-NEXT: s_endpgm
6550 ; GFX10-WGP-LABEL: local_wavefront_one_as_release_store:
6551 ; GFX10-WGP: ; %bb.0: ; %entry
6552 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6553 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6554 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
6555 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
6556 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6557 ; GFX10-WGP-NEXT: s_endpgm
6559 ; GFX10-CU-LABEL: local_wavefront_one_as_release_store:
6560 ; GFX10-CU: ; %bb.0: ; %entry
6561 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6562 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6563 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
6564 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
6565 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6566 ; GFX10-CU-NEXT: s_endpgm
6568 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_release_store:
6569 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6570 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6571 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6572 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6573 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
6574 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6575 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6576 ; SKIP-CACHE-INV-NEXT: s_endpgm
6578 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_store:
6579 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6580 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6581 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6582 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6583 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6584 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6585 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6587 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_release_store:
6588 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6589 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6590 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6591 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6592 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6593 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6594 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6596 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_store:
6597 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6598 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6599 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6600 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6601 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6602 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6603 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6605 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_release_store:
6606 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6607 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6608 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6609 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6610 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6611 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
6612 ; GFX940-TGSPLIT-NEXT: s_endpgm
6614 ; GFX11-WGP-LABEL: local_wavefront_one_as_release_store:
6615 ; GFX11-WGP: ; %bb.0: ; %entry
6616 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6617 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6618 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
6619 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
6620 ; GFX11-WGP-NEXT: s_endpgm
6622 ; GFX11-CU-LABEL: local_wavefront_one_as_release_store:
6623 ; GFX11-CU: ; %bb.0: ; %entry
6624 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6625 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6626 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
6627 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
6628 ; GFX11-CU-NEXT: s_endpgm
6629 i32 %in, ptr addrspace(3) %out) {
6631 store atomic i32 %in, ptr addrspace(3) %out syncscope("wavefront-one-as") release, align 4
6635 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_store(
6636 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_store:
6637 ; GFX6: ; %bb.0: ; %entry
6638 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6639 ; GFX6-NEXT: s_mov_b32 m0, -1
6640 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6641 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
6642 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
6643 ; GFX6-NEXT: ds_write_b32 v0, v1
6644 ; GFX6-NEXT: s_endpgm
6646 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_store:
6647 ; GFX7: ; %bb.0: ; %entry
6648 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6649 ; GFX7-NEXT: s_mov_b32 m0, -1
6650 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6651 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
6652 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
6653 ; GFX7-NEXT: ds_write_b32 v0, v1
6654 ; GFX7-NEXT: s_endpgm
6656 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_store:
6657 ; GFX10-WGP: ; %bb.0: ; %entry
6658 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6659 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6660 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
6661 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
6662 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6663 ; GFX10-WGP-NEXT: s_endpgm
6665 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_store:
6666 ; GFX10-CU: ; %bb.0: ; %entry
6667 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6668 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6669 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
6670 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
6671 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6672 ; GFX10-CU-NEXT: s_endpgm
6674 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_store:
6675 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6676 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6677 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6678 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6679 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
6680 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6681 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6682 ; SKIP-CACHE-INV-NEXT: s_endpgm
6684 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_store:
6685 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6686 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6687 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6688 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6689 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6690 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6691 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6693 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_store:
6694 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6695 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6696 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6697 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6698 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6699 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6700 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6702 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_store:
6703 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6704 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6705 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6706 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6707 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6708 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6709 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6711 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_store:
6712 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6713 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6714 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6715 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
6716 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
6717 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
6718 ; GFX940-TGSPLIT-NEXT: s_endpgm
6720 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_store:
6721 ; GFX11-WGP: ; %bb.0: ; %entry
6722 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6723 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6724 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
6725 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
6726 ; GFX11-WGP-NEXT: s_endpgm
6728 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_store:
6729 ; GFX11-CU: ; %bb.0: ; %entry
6730 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6731 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6732 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s1 :: v_dual_mov_b32 v1, s0
6733 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
6734 ; GFX11-CU-NEXT: s_endpgm
6735 i32 %in, ptr addrspace(3) %out) {
6737 store atomic i32 %in, ptr addrspace(3) %out syncscope("wavefront-one-as") seq_cst, align 4
6741 define amdgpu_kernel void @local_wavefront_one_as_monotonic_atomicrmw(
6742 ; GFX6-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6743 ; GFX6: ; %bb.0: ; %entry
6744 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6745 ; GFX6-NEXT: s_mov_b32 m0, -1
6746 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6747 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
6748 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6749 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6750 ; GFX6-NEXT: s_endpgm
6752 ; GFX7-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6753 ; GFX7: ; %bb.0: ; %entry
6754 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6755 ; GFX7-NEXT: s_mov_b32 m0, -1
6756 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6757 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6758 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6759 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6760 ; GFX7-NEXT: s_endpgm
6762 ; GFX10-WGP-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6763 ; GFX10-WGP: ; %bb.0: ; %entry
6764 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6765 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6766 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6767 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6768 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6769 ; GFX10-WGP-NEXT: s_endpgm
6771 ; GFX10-CU-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6772 ; GFX10-CU: ; %bb.0: ; %entry
6773 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6774 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6775 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6776 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6777 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6778 ; GFX10-CU-NEXT: s_endpgm
6780 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6781 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6782 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6783 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6784 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6785 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6786 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6787 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6788 ; SKIP-CACHE-INV-NEXT: s_endpgm
6790 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6791 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6792 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6793 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6794 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6795 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6796 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6797 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6799 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6800 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6801 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6802 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6803 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6804 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6805 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6806 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6808 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6809 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6810 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6811 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6812 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6813 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6814 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6815 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6817 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6818 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6819 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6820 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6821 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6822 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6823 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6824 ; GFX940-TGSPLIT-NEXT: s_endpgm
6826 ; GFX11-WGP-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6827 ; GFX11-WGP: ; %bb.0: ; %entry
6828 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6829 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6830 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6831 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
6832 ; GFX11-WGP-NEXT: s_endpgm
6834 ; GFX11-CU-LABEL: local_wavefront_one_as_monotonic_atomicrmw:
6835 ; GFX11-CU: ; %bb.0: ; %entry
6836 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6837 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6838 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6839 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
6840 ; GFX11-CU-NEXT: s_endpgm
6841 ptr addrspace(3) %out, i32 %in) {
6843 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront-one-as") monotonic
6847 define amdgpu_kernel void @local_wavefront_one_as_acquire_atomicrmw(
6848 ; GFX6-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6849 ; GFX6: ; %bb.0: ; %entry
6850 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6851 ; GFX6-NEXT: s_mov_b32 m0, -1
6852 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6853 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
6854 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6855 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6856 ; GFX6-NEXT: s_endpgm
6858 ; GFX7-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6859 ; GFX7: ; %bb.0: ; %entry
6860 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6861 ; GFX7-NEXT: s_mov_b32 m0, -1
6862 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6863 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6864 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6865 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6866 ; GFX7-NEXT: s_endpgm
6868 ; GFX10-WGP-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6869 ; GFX10-WGP: ; %bb.0: ; %entry
6870 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6871 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6872 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6873 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6874 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6875 ; GFX10-WGP-NEXT: s_endpgm
6877 ; GFX10-CU-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6878 ; GFX10-CU: ; %bb.0: ; %entry
6879 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6880 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6881 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6882 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6883 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6884 ; GFX10-CU-NEXT: s_endpgm
6886 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6887 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6888 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6889 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6890 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6891 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6892 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6893 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6894 ; SKIP-CACHE-INV-NEXT: s_endpgm
6896 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6897 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6898 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6899 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6900 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6901 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6902 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6903 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6905 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6906 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6907 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6908 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6909 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6910 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6911 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6912 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6914 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6915 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6916 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6917 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6918 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6919 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6920 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6921 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6923 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6924 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6925 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6926 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6927 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6928 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
6929 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6930 ; GFX940-TGSPLIT-NEXT: s_endpgm
6932 ; GFX11-WGP-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6933 ; GFX11-WGP: ; %bb.0: ; %entry
6934 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6935 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6936 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6937 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
6938 ; GFX11-WGP-NEXT: s_endpgm
6940 ; GFX11-CU-LABEL: local_wavefront_one_as_acquire_atomicrmw:
6941 ; GFX11-CU: ; %bb.0: ; %entry
6942 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
6943 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6944 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6945 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
6946 ; GFX11-CU-NEXT: s_endpgm
6947 ptr addrspace(3) %out, i32 %in) {
6949 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront-one-as") acquire
6953 define amdgpu_kernel void @local_wavefront_one_as_release_atomicrmw(
6954 ; GFX6-LABEL: local_wavefront_one_as_release_atomicrmw:
6955 ; GFX6: ; %bb.0: ; %entry
6956 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6957 ; GFX6-NEXT: s_mov_b32 m0, -1
6958 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6959 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
6960 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6961 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6962 ; GFX6-NEXT: s_endpgm
6964 ; GFX7-LABEL: local_wavefront_one_as_release_atomicrmw:
6965 ; GFX7: ; %bb.0: ; %entry
6966 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6967 ; GFX7-NEXT: s_mov_b32 m0, -1
6968 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6969 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6970 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6971 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6972 ; GFX7-NEXT: s_endpgm
6974 ; GFX10-WGP-LABEL: local_wavefront_one_as_release_atomicrmw:
6975 ; GFX10-WGP: ; %bb.0: ; %entry
6976 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6977 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6978 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6979 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6980 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6981 ; GFX10-WGP-NEXT: s_endpgm
6983 ; GFX10-CU-LABEL: local_wavefront_one_as_release_atomicrmw:
6984 ; GFX10-CU: ; %bb.0: ; %entry
6985 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
6986 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6987 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6988 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6989 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
6990 ; GFX10-CU-NEXT: s_endpgm
6992 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_release_atomicrmw:
6993 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6994 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
6995 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6996 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6997 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6998 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6999 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7000 ; SKIP-CACHE-INV-NEXT: s_endpgm
7002 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_atomicrmw:
7003 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7004 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7005 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7006 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7007 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7008 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7009 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7011 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_release_atomicrmw:
7012 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7013 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7014 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7015 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7016 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7017 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7018 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7020 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_atomicrmw:
7021 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7022 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7023 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7024 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7025 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7026 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7027 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7029 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_release_atomicrmw:
7030 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7031 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7032 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7033 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7034 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7035 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7036 ; GFX940-TGSPLIT-NEXT: s_endpgm
7038 ; GFX11-WGP-LABEL: local_wavefront_one_as_release_atomicrmw:
7039 ; GFX11-WGP: ; %bb.0: ; %entry
7040 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7041 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7042 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7043 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
7044 ; GFX11-WGP-NEXT: s_endpgm
7046 ; GFX11-CU-LABEL: local_wavefront_one_as_release_atomicrmw:
7047 ; GFX11-CU: ; %bb.0: ; %entry
7048 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7049 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7050 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7051 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
7052 ; GFX11-CU-NEXT: s_endpgm
7053 ptr addrspace(3) %out, i32 %in) {
7055 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront-one-as") release
7059 define amdgpu_kernel void @local_wavefront_one_as_acq_rel_atomicrmw(
7060 ; GFX6-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7061 ; GFX6: ; %bb.0: ; %entry
7062 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7063 ; GFX6-NEXT: s_mov_b32 m0, -1
7064 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7065 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
7066 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7067 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7068 ; GFX6-NEXT: s_endpgm
7070 ; GFX7-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7071 ; GFX7: ; %bb.0: ; %entry
7072 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7073 ; GFX7-NEXT: s_mov_b32 m0, -1
7074 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7075 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7076 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7077 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7078 ; GFX7-NEXT: s_endpgm
7080 ; GFX10-WGP-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7081 ; GFX10-WGP: ; %bb.0: ; %entry
7082 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7083 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7084 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7085 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7086 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7087 ; GFX10-WGP-NEXT: s_endpgm
7089 ; GFX10-CU-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7090 ; GFX10-CU: ; %bb.0: ; %entry
7091 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7092 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7093 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7094 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7095 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7096 ; GFX10-CU-NEXT: s_endpgm
7098 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7099 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7100 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7101 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7102 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7103 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7104 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7105 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7106 ; SKIP-CACHE-INV-NEXT: s_endpgm
7108 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7109 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7110 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7111 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7112 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7113 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7114 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7115 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7117 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7118 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7119 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7120 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7121 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7122 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7123 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7124 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7126 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7127 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7128 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7129 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7130 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7131 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7132 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7133 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7135 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7136 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7137 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7138 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7139 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7140 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7141 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7142 ; GFX940-TGSPLIT-NEXT: s_endpgm
7144 ; GFX11-WGP-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7145 ; GFX11-WGP: ; %bb.0: ; %entry
7146 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7147 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7148 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7149 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
7150 ; GFX11-WGP-NEXT: s_endpgm
7152 ; GFX11-CU-LABEL: local_wavefront_one_as_acq_rel_atomicrmw:
7153 ; GFX11-CU: ; %bb.0: ; %entry
7154 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7155 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7156 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7157 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
7158 ; GFX11-CU-NEXT: s_endpgm
7159 ptr addrspace(3) %out, i32 %in) {
7161 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront-one-as") acq_rel
7165 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_atomicrmw(
7166 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7167 ; GFX6: ; %bb.0: ; %entry
7168 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7169 ; GFX6-NEXT: s_mov_b32 m0, -1
7170 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7171 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
7172 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7173 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7174 ; GFX6-NEXT: s_endpgm
7176 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7177 ; GFX7: ; %bb.0: ; %entry
7178 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7179 ; GFX7-NEXT: s_mov_b32 m0, -1
7180 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7181 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7182 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7183 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7184 ; GFX7-NEXT: s_endpgm
7186 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7187 ; GFX10-WGP: ; %bb.0: ; %entry
7188 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7189 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7190 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7191 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7192 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7193 ; GFX10-WGP-NEXT: s_endpgm
7195 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7196 ; GFX10-CU: ; %bb.0: ; %entry
7197 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7198 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7199 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7200 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7201 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7202 ; GFX10-CU-NEXT: s_endpgm
7204 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7205 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7206 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7207 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7208 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7209 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7210 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7211 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7212 ; SKIP-CACHE-INV-NEXT: s_endpgm
7214 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7215 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7216 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7217 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7218 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7219 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7220 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7221 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7223 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7224 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7225 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7226 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7227 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7228 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7229 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7230 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7232 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7233 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7234 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7235 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7236 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7237 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7238 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7239 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7241 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7242 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7243 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7244 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7245 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7246 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7247 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
7248 ; GFX940-TGSPLIT-NEXT: s_endpgm
7250 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7251 ; GFX11-WGP: ; %bb.0: ; %entry
7252 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7253 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7254 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7255 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
7256 ; GFX11-WGP-NEXT: s_endpgm
7258 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_atomicrmw:
7259 ; GFX11-CU: ; %bb.0: ; %entry
7260 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7261 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7262 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7263 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
7264 ; GFX11-CU-NEXT: s_endpgm
7265 ptr addrspace(3) %out, i32 %in) {
7267 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront-one-as") seq_cst
7271 define amdgpu_kernel void @local_wavefront_one_as_acquire_ret_atomicrmw(
7272 ; GFX6-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7273 ; GFX6: ; %bb.0: ; %entry
7274 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7275 ; GFX6-NEXT: s_mov_b32 m0, -1
7276 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7277 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
7278 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7279 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7280 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7281 ; GFX6-NEXT: ds_write_b32 v0, v1
7282 ; GFX6-NEXT: s_endpgm
7284 ; GFX7-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7285 ; GFX7: ; %bb.0: ; %entry
7286 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7287 ; GFX7-NEXT: s_mov_b32 m0, -1
7288 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7289 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7290 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7291 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7292 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7293 ; GFX7-NEXT: ds_write_b32 v0, v1
7294 ; GFX7-NEXT: s_endpgm
7296 ; GFX10-WGP-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7297 ; GFX10-WGP: ; %bb.0: ; %entry
7298 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7299 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7300 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7301 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7302 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7303 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7304 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7305 ; GFX10-WGP-NEXT: s_endpgm
7307 ; GFX10-CU-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7308 ; GFX10-CU: ; %bb.0: ; %entry
7309 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7310 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7311 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7312 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7313 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7314 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7315 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7316 ; GFX10-CU-NEXT: s_endpgm
7318 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7319 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7320 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7321 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7322 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7323 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7324 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7325 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7326 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7327 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7328 ; SKIP-CACHE-INV-NEXT: s_endpgm
7330 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7331 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7332 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7333 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7334 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7335 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7336 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7337 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7338 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7339 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7341 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7342 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7343 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7344 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7345 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7346 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7347 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7348 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7349 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7350 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7352 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7353 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7354 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7355 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7356 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7357 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7358 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7359 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7360 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7361 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7363 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7364 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7365 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7366 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7367 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7368 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7369 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7370 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7371 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
7372 ; GFX940-TGSPLIT-NEXT: s_endpgm
7374 ; GFX11-WGP-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7375 ; GFX11-WGP: ; %bb.0: ; %entry
7376 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7377 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7378 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7379 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
7380 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7381 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
7382 ; GFX11-WGP-NEXT: s_endpgm
7384 ; GFX11-CU-LABEL: local_wavefront_one_as_acquire_ret_atomicrmw:
7385 ; GFX11-CU: ; %bb.0: ; %entry
7386 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7387 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7388 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7389 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
7390 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7391 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
7392 ; GFX11-CU-NEXT: s_endpgm
7393 ptr addrspace(3) %out, i32 %in) {
7395 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront-one-as") acquire
7396 store i32 %val, ptr addrspace(3) %out, align 4
7400 define amdgpu_kernel void @local_wavefront_one_as_acq_rel_ret_atomicrmw(
7401 ; GFX6-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7402 ; GFX6: ; %bb.0: ; %entry
7403 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7404 ; GFX6-NEXT: s_mov_b32 m0, -1
7405 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7406 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
7407 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7408 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7409 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7410 ; GFX6-NEXT: ds_write_b32 v0, v1
7411 ; GFX6-NEXT: s_endpgm
7413 ; GFX7-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7414 ; GFX7: ; %bb.0: ; %entry
7415 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7416 ; GFX7-NEXT: s_mov_b32 m0, -1
7417 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7418 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7419 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7420 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7421 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7422 ; GFX7-NEXT: ds_write_b32 v0, v1
7423 ; GFX7-NEXT: s_endpgm
7425 ; GFX10-WGP-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7426 ; GFX10-WGP: ; %bb.0: ; %entry
7427 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7428 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7429 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7430 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7431 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7432 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7433 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7434 ; GFX10-WGP-NEXT: s_endpgm
7436 ; GFX10-CU-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7437 ; GFX10-CU: ; %bb.0: ; %entry
7438 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7439 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7440 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7441 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7442 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7443 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7444 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7445 ; GFX10-CU-NEXT: s_endpgm
7447 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7448 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7449 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7450 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7451 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7452 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7453 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7454 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7455 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7456 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7457 ; SKIP-CACHE-INV-NEXT: s_endpgm
7459 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7460 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7461 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7462 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7463 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7464 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7465 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7466 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7467 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7468 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7470 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7471 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7472 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7473 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7474 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7475 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7476 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7477 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7478 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7479 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7481 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7482 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7483 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7484 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7485 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7486 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7487 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7488 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7489 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7490 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7492 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7493 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7494 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7495 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7496 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7497 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7498 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7499 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7500 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
7501 ; GFX940-TGSPLIT-NEXT: s_endpgm
7503 ; GFX11-WGP-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7504 ; GFX11-WGP: ; %bb.0: ; %entry
7505 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7506 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7507 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7508 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
7509 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7510 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
7511 ; GFX11-WGP-NEXT: s_endpgm
7513 ; GFX11-CU-LABEL: local_wavefront_one_as_acq_rel_ret_atomicrmw:
7514 ; GFX11-CU: ; %bb.0: ; %entry
7515 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7516 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7517 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7518 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
7519 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7520 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
7521 ; GFX11-CU-NEXT: s_endpgm
7522 ptr addrspace(3) %out, i32 %in) {
7524 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront-one-as") acq_rel
7525 store i32 %val, ptr addrspace(3) %out, align 4
7529 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_ret_atomicrmw(
7530 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7531 ; GFX6: ; %bb.0: ; %entry
7532 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7533 ; GFX6-NEXT: s_mov_b32 m0, -1
7534 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7535 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
7536 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7537 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7538 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7539 ; GFX6-NEXT: ds_write_b32 v0, v1
7540 ; GFX6-NEXT: s_endpgm
7542 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7543 ; GFX7: ; %bb.0: ; %entry
7544 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7545 ; GFX7-NEXT: s_mov_b32 m0, -1
7546 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7547 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7548 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7549 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7550 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7551 ; GFX7-NEXT: ds_write_b32 v0, v1
7552 ; GFX7-NEXT: s_endpgm
7554 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7555 ; GFX10-WGP: ; %bb.0: ; %entry
7556 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7557 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7558 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7559 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7560 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7561 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7562 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7563 ; GFX10-WGP-NEXT: s_endpgm
7565 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7566 ; GFX10-CU: ; %bb.0: ; %entry
7567 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7568 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7569 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7570 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7571 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7572 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7573 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7574 ; GFX10-CU-NEXT: s_endpgm
7576 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7577 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7578 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7579 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7580 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7581 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7582 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7583 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7584 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7585 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7586 ; SKIP-CACHE-INV-NEXT: s_endpgm
7588 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7589 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7590 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7591 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7592 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7593 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7594 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7595 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7596 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7597 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7599 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7600 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7601 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7602 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7603 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7604 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7605 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7606 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7607 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7608 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7610 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7611 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7612 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7613 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7614 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7615 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7616 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7617 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7618 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7619 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7621 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7622 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7623 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7624 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7625 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7626 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7627 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
7628 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7629 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
7630 ; GFX940-TGSPLIT-NEXT: s_endpgm
7632 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7633 ; GFX11-WGP: ; %bb.0: ; %entry
7634 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7635 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7636 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7637 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
7638 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7639 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
7640 ; GFX11-WGP-NEXT: s_endpgm
7642 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_ret_atomicrmw:
7643 ; GFX11-CU: ; %bb.0: ; %entry
7644 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7645 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7646 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7647 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
7648 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7649 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
7650 ; GFX11-CU-NEXT: s_endpgm
7651 ptr addrspace(3) %out, i32 %in) {
7653 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("wavefront-one-as") seq_cst
7654 store i32 %val, ptr addrspace(3) %out, align 4
7658 define amdgpu_kernel void @local_wavefront_one_as_monotonic_monotonic_cmpxchg(
7659 ; GFX6-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7660 ; GFX6: ; %bb.0: ; %entry
7661 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7662 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7663 ; GFX6-NEXT: s_mov_b32 m0, -1
7664 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7665 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7666 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7667 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7668 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7669 ; GFX6-NEXT: s_endpgm
7671 ; GFX7-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7672 ; GFX7: ; %bb.0: ; %entry
7673 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7674 ; GFX7-NEXT: s_mov_b32 m0, -1
7675 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7676 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7677 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7678 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7679 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7680 ; GFX7-NEXT: s_endpgm
7682 ; GFX10-WGP-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7683 ; GFX10-WGP: ; %bb.0: ; %entry
7684 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7685 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7686 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7687 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7688 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7689 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7690 ; GFX10-WGP-NEXT: s_endpgm
7692 ; GFX10-CU-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7693 ; GFX10-CU: ; %bb.0: ; %entry
7694 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7695 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7696 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7697 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7698 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7699 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7700 ; GFX10-CU-NEXT: s_endpgm
7702 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7703 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7704 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7705 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7706 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7707 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7708 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
7709 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
7710 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7711 ; SKIP-CACHE-INV-NEXT: s_endpgm
7713 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7714 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7715 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7716 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7717 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7718 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7719 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7720 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7721 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7723 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7724 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7725 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7726 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7727 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7728 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7729 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7730 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7731 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7733 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7734 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7735 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7736 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7737 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7738 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7739 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7740 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7741 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7743 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7744 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7745 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7746 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7747 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7748 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7749 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7750 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7751 ; GFX940-TGSPLIT-NEXT: s_endpgm
7753 ; GFX11-WGP-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7754 ; GFX11-WGP: ; %bb.0: ; %entry
7755 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7756 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7757 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7758 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
7759 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
7760 ; GFX11-WGP-NEXT: s_endpgm
7762 ; GFX11-CU-LABEL: local_wavefront_one_as_monotonic_monotonic_cmpxchg:
7763 ; GFX11-CU: ; %bb.0: ; %entry
7764 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7765 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7766 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7767 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
7768 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
7769 ; GFX11-CU-NEXT: s_endpgm
7770 ptr addrspace(3) %out, i32 %in, i32 %old) {
7772 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
7773 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") monotonic monotonic
7777 define amdgpu_kernel void @local_wavefront_one_as_acquire_monotonic_cmpxchg(
7778 ; GFX6-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7779 ; GFX6: ; %bb.0: ; %entry
7780 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7781 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7782 ; GFX6-NEXT: s_mov_b32 m0, -1
7783 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7784 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7785 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7786 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7787 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7788 ; GFX6-NEXT: s_endpgm
7790 ; GFX7-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7791 ; GFX7: ; %bb.0: ; %entry
7792 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7793 ; GFX7-NEXT: s_mov_b32 m0, -1
7794 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7795 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7796 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7797 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7798 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7799 ; GFX7-NEXT: s_endpgm
7801 ; GFX10-WGP-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7802 ; GFX10-WGP: ; %bb.0: ; %entry
7803 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7804 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7805 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7806 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7807 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7808 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7809 ; GFX10-WGP-NEXT: s_endpgm
7811 ; GFX10-CU-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7812 ; GFX10-CU: ; %bb.0: ; %entry
7813 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7814 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7815 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7816 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7817 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7818 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7819 ; GFX10-CU-NEXT: s_endpgm
7821 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7822 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7823 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7824 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7825 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7826 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7827 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
7828 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
7829 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7830 ; SKIP-CACHE-INV-NEXT: s_endpgm
7832 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7833 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7834 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7835 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7836 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7837 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7838 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7839 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7840 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7842 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7843 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7844 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7845 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7846 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7847 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7848 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7849 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7850 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7852 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7853 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7854 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7855 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7856 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7857 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7858 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7859 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7860 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7862 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7863 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7864 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7865 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7866 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7867 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7868 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7869 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7870 ; GFX940-TGSPLIT-NEXT: s_endpgm
7872 ; GFX11-WGP-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7873 ; GFX11-WGP: ; %bb.0: ; %entry
7874 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7875 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7876 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7877 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
7878 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
7879 ; GFX11-WGP-NEXT: s_endpgm
7881 ; GFX11-CU-LABEL: local_wavefront_one_as_acquire_monotonic_cmpxchg:
7882 ; GFX11-CU: ; %bb.0: ; %entry
7883 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7884 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7885 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7886 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
7887 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
7888 ; GFX11-CU-NEXT: s_endpgm
7889 ptr addrspace(3) %out, i32 %in, i32 %old) {
7891 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
7892 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acquire monotonic
7896 define amdgpu_kernel void @local_wavefront_one_as_release_monotonic_cmpxchg(
7897 ; GFX6-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7898 ; GFX6: ; %bb.0: ; %entry
7899 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7900 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7901 ; GFX6-NEXT: s_mov_b32 m0, -1
7902 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7903 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7904 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7905 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7906 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7907 ; GFX6-NEXT: s_endpgm
7909 ; GFX7-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7910 ; GFX7: ; %bb.0: ; %entry
7911 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7912 ; GFX7-NEXT: s_mov_b32 m0, -1
7913 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7914 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7915 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7916 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7917 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7918 ; GFX7-NEXT: s_endpgm
7920 ; GFX10-WGP-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7921 ; GFX10-WGP: ; %bb.0: ; %entry
7922 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7923 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7924 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7925 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7926 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7927 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7928 ; GFX10-WGP-NEXT: s_endpgm
7930 ; GFX10-CU-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7931 ; GFX10-CU: ; %bb.0: ; %entry
7932 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7933 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7934 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7935 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7936 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7937 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7938 ; GFX10-CU-NEXT: s_endpgm
7940 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7941 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7942 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7943 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7944 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7945 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7946 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
7947 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
7948 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7949 ; SKIP-CACHE-INV-NEXT: s_endpgm
7951 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7952 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7953 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7954 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7955 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7956 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7957 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7958 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7959 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7961 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7962 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7963 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7964 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7965 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7966 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7967 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7968 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7969 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7971 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7972 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7973 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7974 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7975 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7976 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7977 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7978 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7979 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7981 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7982 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7983 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7984 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7985 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7986 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7987 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7988 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
7989 ; GFX940-TGSPLIT-NEXT: s_endpgm
7991 ; GFX11-WGP-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
7992 ; GFX11-WGP: ; %bb.0: ; %entry
7993 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7994 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7995 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7996 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
7997 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
7998 ; GFX11-WGP-NEXT: s_endpgm
8000 ; GFX11-CU-LABEL: local_wavefront_one_as_release_monotonic_cmpxchg:
8001 ; GFX11-CU: ; %bb.0: ; %entry
8002 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8003 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8004 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8005 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
8006 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8007 ; GFX11-CU-NEXT: s_endpgm
8008 ptr addrspace(3) %out, i32 %in, i32 %old) {
8010 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8011 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") release monotonic
8015 define amdgpu_kernel void @local_wavefront_one_as_acq_rel_monotonic_cmpxchg(
8016 ; GFX6-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8017 ; GFX6: ; %bb.0: ; %entry
8018 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
8019 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
8020 ; GFX6-NEXT: s_mov_b32 m0, -1
8021 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8022 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8023 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
8024 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
8025 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8026 ; GFX6-NEXT: s_endpgm
8028 ; GFX7-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8029 ; GFX7: ; %bb.0: ; %entry
8030 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8031 ; GFX7-NEXT: s_mov_b32 m0, -1
8032 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8033 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8034 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
8035 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
8036 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8037 ; GFX7-NEXT: s_endpgm
8039 ; GFX10-WGP-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8040 ; GFX10-WGP: ; %bb.0: ; %entry
8041 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8042 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8043 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8044 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8045 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
8046 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8047 ; GFX10-WGP-NEXT: s_endpgm
8049 ; GFX10-CU-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8050 ; GFX10-CU: ; %bb.0: ; %entry
8051 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8052 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8053 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8054 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8055 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
8056 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8057 ; GFX10-CU-NEXT: s_endpgm
8059 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8060 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8061 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8062 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8063 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8064 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8065 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8066 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8067 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8068 ; SKIP-CACHE-INV-NEXT: s_endpgm
8070 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8071 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8072 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8073 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8074 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8075 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8076 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8077 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8078 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8080 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8081 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8082 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8083 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8084 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8085 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8086 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8087 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8088 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8090 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8091 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8092 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8093 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8094 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8095 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8096 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8097 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8098 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8100 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8101 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8102 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8103 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8104 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8105 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8106 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8107 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8108 ; GFX940-TGSPLIT-NEXT: s_endpgm
8110 ; GFX11-WGP-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8111 ; GFX11-WGP: ; %bb.0: ; %entry
8112 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8113 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8114 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8115 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
8116 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8117 ; GFX11-WGP-NEXT: s_endpgm
8119 ; GFX11-CU-LABEL: local_wavefront_one_as_acq_rel_monotonic_cmpxchg:
8120 ; GFX11-CU: ; %bb.0: ; %entry
8121 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8122 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8123 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8124 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
8125 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8126 ; GFX11-CU-NEXT: s_endpgm
8127 ptr addrspace(3) %out, i32 %in, i32 %old) {
8129 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8130 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acq_rel monotonic
8134 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_monotonic_cmpxchg(
8135 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8136 ; GFX6: ; %bb.0: ; %entry
8137 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
8138 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
8139 ; GFX6-NEXT: s_mov_b32 m0, -1
8140 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8141 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8142 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
8143 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
8144 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8145 ; GFX6-NEXT: s_endpgm
8147 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8148 ; GFX7: ; %bb.0: ; %entry
8149 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8150 ; GFX7-NEXT: s_mov_b32 m0, -1
8151 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8152 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8153 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
8154 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
8155 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8156 ; GFX7-NEXT: s_endpgm
8158 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8159 ; GFX10-WGP: ; %bb.0: ; %entry
8160 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8161 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8162 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8163 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8164 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
8165 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8166 ; GFX10-WGP-NEXT: s_endpgm
8168 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8169 ; GFX10-CU: ; %bb.0: ; %entry
8170 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8171 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8172 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8173 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8174 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
8175 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8176 ; GFX10-CU-NEXT: s_endpgm
8178 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8179 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8180 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8181 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8182 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8183 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8184 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8185 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8186 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8187 ; SKIP-CACHE-INV-NEXT: s_endpgm
8189 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8190 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8191 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8192 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8193 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8194 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8195 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8196 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8197 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8199 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8200 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8201 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8202 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8203 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8204 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8205 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8206 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8207 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8209 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8210 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8211 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8212 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8213 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8214 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8215 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8216 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8217 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8219 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8220 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8221 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8222 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8223 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8224 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8225 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8226 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8227 ; GFX940-TGSPLIT-NEXT: s_endpgm
8229 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8230 ; GFX11-WGP: ; %bb.0: ; %entry
8231 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8232 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8233 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8234 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
8235 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8236 ; GFX11-WGP-NEXT: s_endpgm
8238 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_monotonic_cmpxchg:
8239 ; GFX11-CU: ; %bb.0: ; %entry
8240 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8241 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8242 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8243 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
8244 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8245 ; GFX11-CU-NEXT: s_endpgm
8246 ptr addrspace(3) %out, i32 %in, i32 %old) {
8248 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8249 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") seq_cst monotonic
8253 define amdgpu_kernel void @local_wavefront_one_as_monotonic_acquire_cmpxchg(
8254 ; GFX6-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8255 ; GFX6: ; %bb.0: ; %entry
8256 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
8257 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
8258 ; GFX6-NEXT: s_mov_b32 m0, -1
8259 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8260 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8261 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
8262 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
8263 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8264 ; GFX6-NEXT: s_endpgm
8266 ; GFX7-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8267 ; GFX7: ; %bb.0: ; %entry
8268 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8269 ; GFX7-NEXT: s_mov_b32 m0, -1
8270 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8271 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8272 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
8273 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
8274 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8275 ; GFX7-NEXT: s_endpgm
8277 ; GFX10-WGP-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8278 ; GFX10-WGP: ; %bb.0: ; %entry
8279 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8280 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8281 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8282 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8283 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
8284 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8285 ; GFX10-WGP-NEXT: s_endpgm
8287 ; GFX10-CU-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8288 ; GFX10-CU: ; %bb.0: ; %entry
8289 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8290 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8291 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8292 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8293 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
8294 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8295 ; GFX10-CU-NEXT: s_endpgm
8297 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8298 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8299 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8300 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8301 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8302 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8303 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8304 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8305 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8306 ; SKIP-CACHE-INV-NEXT: s_endpgm
8308 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8309 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8310 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8311 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8312 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8313 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8314 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8315 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8316 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8318 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8319 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8320 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8321 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8322 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8323 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8324 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8325 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8326 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8328 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8329 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8330 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8331 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8332 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8333 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8334 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8335 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8336 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8338 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8339 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8340 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8341 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8342 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8343 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8344 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8345 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8346 ; GFX940-TGSPLIT-NEXT: s_endpgm
8348 ; GFX11-WGP-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8349 ; GFX11-WGP: ; %bb.0: ; %entry
8350 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8351 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8352 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8353 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
8354 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8355 ; GFX11-WGP-NEXT: s_endpgm
8357 ; GFX11-CU-LABEL: local_wavefront_one_as_monotonic_acquire_cmpxchg:
8358 ; GFX11-CU: ; %bb.0: ; %entry
8359 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8360 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8361 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8362 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
8363 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8364 ; GFX11-CU-NEXT: s_endpgm
8365 ptr addrspace(3) %out, i32 %in, i32 %old) {
8367 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8368 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") monotonic acquire
8372 define amdgpu_kernel void @local_wavefront_one_as_acquire_acquire_cmpxchg(
8373 ; GFX6-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8374 ; GFX6: ; %bb.0: ; %entry
8375 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
8376 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
8377 ; GFX6-NEXT: s_mov_b32 m0, -1
8378 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8379 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8380 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
8381 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
8382 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8383 ; GFX6-NEXT: s_endpgm
8385 ; GFX7-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8386 ; GFX7: ; %bb.0: ; %entry
8387 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8388 ; GFX7-NEXT: s_mov_b32 m0, -1
8389 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8390 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8391 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
8392 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
8393 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8394 ; GFX7-NEXT: s_endpgm
8396 ; GFX10-WGP-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8397 ; GFX10-WGP: ; %bb.0: ; %entry
8398 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8399 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8400 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8401 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8402 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
8403 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8404 ; GFX10-WGP-NEXT: s_endpgm
8406 ; GFX10-CU-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8407 ; GFX10-CU: ; %bb.0: ; %entry
8408 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8409 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8410 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8411 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8412 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
8413 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8414 ; GFX10-CU-NEXT: s_endpgm
8416 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8417 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8418 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8419 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8420 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8421 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8422 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8423 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8424 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8425 ; SKIP-CACHE-INV-NEXT: s_endpgm
8427 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8428 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8429 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8430 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8431 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8432 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8433 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8434 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8435 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8437 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8438 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8439 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8440 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8441 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8442 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8443 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8444 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8445 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8447 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8448 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8449 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8450 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8451 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8452 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8453 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8454 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8455 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8457 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8458 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8459 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8460 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8461 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8462 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8463 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8464 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8465 ; GFX940-TGSPLIT-NEXT: s_endpgm
8467 ; GFX11-WGP-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8468 ; GFX11-WGP: ; %bb.0: ; %entry
8469 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8470 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8471 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8472 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
8473 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8474 ; GFX11-WGP-NEXT: s_endpgm
8476 ; GFX11-CU-LABEL: local_wavefront_one_as_acquire_acquire_cmpxchg:
8477 ; GFX11-CU: ; %bb.0: ; %entry
8478 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8479 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8480 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8481 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
8482 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8483 ; GFX11-CU-NEXT: s_endpgm
8484 ptr addrspace(3) %out, i32 %in, i32 %old) {
8486 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8487 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acquire acquire
8491 define amdgpu_kernel void @local_wavefront_one_as_release_acquire_cmpxchg(
8492 ; GFX6-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8493 ; GFX6: ; %bb.0: ; %entry
8494 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
8495 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
8496 ; GFX6-NEXT: s_mov_b32 m0, -1
8497 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8498 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8499 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
8500 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
8501 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8502 ; GFX6-NEXT: s_endpgm
8504 ; GFX7-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8505 ; GFX7: ; %bb.0: ; %entry
8506 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8507 ; GFX7-NEXT: s_mov_b32 m0, -1
8508 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8509 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8510 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
8511 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
8512 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8513 ; GFX7-NEXT: s_endpgm
8515 ; GFX10-WGP-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8516 ; GFX10-WGP: ; %bb.0: ; %entry
8517 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8518 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8519 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8520 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8521 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
8522 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8523 ; GFX10-WGP-NEXT: s_endpgm
8525 ; GFX10-CU-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8526 ; GFX10-CU: ; %bb.0: ; %entry
8527 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8528 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8529 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8530 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8531 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
8532 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8533 ; GFX10-CU-NEXT: s_endpgm
8535 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8536 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8537 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8538 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8539 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8540 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8541 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8542 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8543 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8544 ; SKIP-CACHE-INV-NEXT: s_endpgm
8546 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8547 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8548 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8549 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8550 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8551 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8552 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8553 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8554 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8556 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8557 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8558 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8559 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8560 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8561 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8562 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8563 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8564 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8566 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8567 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8568 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8569 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8570 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8571 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8572 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8573 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8574 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8576 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8577 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8578 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8579 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8580 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8581 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8582 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8583 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8584 ; GFX940-TGSPLIT-NEXT: s_endpgm
8586 ; GFX11-WGP-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8587 ; GFX11-WGP: ; %bb.0: ; %entry
8588 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8589 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8590 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8591 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
8592 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8593 ; GFX11-WGP-NEXT: s_endpgm
8595 ; GFX11-CU-LABEL: local_wavefront_one_as_release_acquire_cmpxchg:
8596 ; GFX11-CU: ; %bb.0: ; %entry
8597 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8598 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8599 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8600 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
8601 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8602 ; GFX11-CU-NEXT: s_endpgm
8603 ptr addrspace(3) %out, i32 %in, i32 %old) {
8605 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8606 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") release acquire
8610 define amdgpu_kernel void @local_wavefront_one_as_acq_rel_acquire_cmpxchg(
8611 ; GFX6-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8612 ; GFX6: ; %bb.0: ; %entry
8613 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
8614 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
8615 ; GFX6-NEXT: s_mov_b32 m0, -1
8616 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8617 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8618 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
8619 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
8620 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8621 ; GFX6-NEXT: s_endpgm
8623 ; GFX7-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8624 ; GFX7: ; %bb.0: ; %entry
8625 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8626 ; GFX7-NEXT: s_mov_b32 m0, -1
8627 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8628 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8629 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
8630 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
8631 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8632 ; GFX7-NEXT: s_endpgm
8634 ; GFX10-WGP-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8635 ; GFX10-WGP: ; %bb.0: ; %entry
8636 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8637 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8638 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8639 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8640 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
8641 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8642 ; GFX10-WGP-NEXT: s_endpgm
8644 ; GFX10-CU-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8645 ; GFX10-CU: ; %bb.0: ; %entry
8646 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8647 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8648 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8649 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8650 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
8651 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8652 ; GFX10-CU-NEXT: s_endpgm
8654 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8655 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8656 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8657 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8658 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8659 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8660 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8661 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8662 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8663 ; SKIP-CACHE-INV-NEXT: s_endpgm
8665 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8666 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8667 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8668 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8669 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8670 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8671 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8672 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8673 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8675 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8676 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8677 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8678 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8679 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8680 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8681 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8682 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8683 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8685 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8686 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8687 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8688 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8689 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8690 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8691 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8692 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8693 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8695 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8696 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8697 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8698 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8699 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8700 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8701 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8702 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8703 ; GFX940-TGSPLIT-NEXT: s_endpgm
8705 ; GFX11-WGP-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8706 ; GFX11-WGP: ; %bb.0: ; %entry
8707 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8708 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8709 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8710 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
8711 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8712 ; GFX11-WGP-NEXT: s_endpgm
8714 ; GFX11-CU-LABEL: local_wavefront_one_as_acq_rel_acquire_cmpxchg:
8715 ; GFX11-CU: ; %bb.0: ; %entry
8716 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8717 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8718 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8719 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
8720 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8721 ; GFX11-CU-NEXT: s_endpgm
8722 ptr addrspace(3) %out, i32 %in, i32 %old) {
8724 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8725 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acq_rel acquire
8729 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_acquire_cmpxchg(
8730 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8731 ; GFX6: ; %bb.0: ; %entry
8732 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
8733 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
8734 ; GFX6-NEXT: s_mov_b32 m0, -1
8735 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8736 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8737 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
8738 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
8739 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8740 ; GFX6-NEXT: s_endpgm
8742 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8743 ; GFX7: ; %bb.0: ; %entry
8744 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8745 ; GFX7-NEXT: s_mov_b32 m0, -1
8746 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8747 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8748 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
8749 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
8750 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8751 ; GFX7-NEXT: s_endpgm
8753 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8754 ; GFX10-WGP: ; %bb.0: ; %entry
8755 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8756 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8757 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8758 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8759 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
8760 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8761 ; GFX10-WGP-NEXT: s_endpgm
8763 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8764 ; GFX10-CU: ; %bb.0: ; %entry
8765 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8766 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8767 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8768 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8769 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
8770 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8771 ; GFX10-CU-NEXT: s_endpgm
8773 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8774 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8775 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8776 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8777 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8778 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8779 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8780 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8781 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8782 ; SKIP-CACHE-INV-NEXT: s_endpgm
8784 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8785 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8786 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8787 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8788 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8789 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8790 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8791 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8792 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8794 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8795 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8796 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8797 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8798 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8799 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8800 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8801 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8802 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8804 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8805 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8806 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8807 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8808 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8809 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8810 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8811 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8812 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8814 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8815 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8816 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8817 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8818 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8819 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8820 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8821 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8822 ; GFX940-TGSPLIT-NEXT: s_endpgm
8824 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8825 ; GFX11-WGP: ; %bb.0: ; %entry
8826 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8827 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8828 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8829 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
8830 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8831 ; GFX11-WGP-NEXT: s_endpgm
8833 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_acquire_cmpxchg:
8834 ; GFX11-CU: ; %bb.0: ; %entry
8835 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8836 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8837 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8838 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
8839 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8840 ; GFX11-CU-NEXT: s_endpgm
8841 ptr addrspace(3) %out, i32 %in, i32 %old) {
8843 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8844 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") seq_cst acquire
8848 define amdgpu_kernel void @local_wavefront_one_as_monotonic_seq_cst_cmpxchg(
8849 ; GFX6-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8850 ; GFX6: ; %bb.0: ; %entry
8851 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
8852 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
8853 ; GFX6-NEXT: s_mov_b32 m0, -1
8854 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8855 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8856 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
8857 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
8858 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8859 ; GFX6-NEXT: s_endpgm
8861 ; GFX7-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8862 ; GFX7: ; %bb.0: ; %entry
8863 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8864 ; GFX7-NEXT: s_mov_b32 m0, -1
8865 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8866 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8867 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
8868 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
8869 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8870 ; GFX7-NEXT: s_endpgm
8872 ; GFX10-WGP-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8873 ; GFX10-WGP: ; %bb.0: ; %entry
8874 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8875 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8876 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8877 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8878 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
8879 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8880 ; GFX10-WGP-NEXT: s_endpgm
8882 ; GFX10-CU-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8883 ; GFX10-CU: ; %bb.0: ; %entry
8884 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8885 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8886 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8887 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8888 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
8889 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8890 ; GFX10-CU-NEXT: s_endpgm
8892 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8893 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8894 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8895 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8896 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8897 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8898 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8899 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8900 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8901 ; SKIP-CACHE-INV-NEXT: s_endpgm
8903 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8904 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8905 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8906 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8907 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8908 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8909 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8910 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8911 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8913 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8914 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8915 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8916 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8917 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8918 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8919 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8920 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8921 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8923 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8924 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8925 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8926 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8927 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8928 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8929 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8930 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8931 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8933 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8934 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8935 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8936 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8937 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8938 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8939 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8940 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8941 ; GFX940-TGSPLIT-NEXT: s_endpgm
8943 ; GFX11-WGP-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8944 ; GFX11-WGP: ; %bb.0: ; %entry
8945 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8946 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8947 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8948 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
8949 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8950 ; GFX11-WGP-NEXT: s_endpgm
8952 ; GFX11-CU-LABEL: local_wavefront_one_as_monotonic_seq_cst_cmpxchg:
8953 ; GFX11-CU: ; %bb.0: ; %entry
8954 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8955 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8956 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
8957 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
8958 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
8959 ; GFX11-CU-NEXT: s_endpgm
8960 ptr addrspace(3) %out, i32 %in, i32 %old) {
8962 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8963 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") monotonic seq_cst
8967 define amdgpu_kernel void @local_wavefront_one_as_acquire_seq_cst_cmpxchg(
8968 ; GFX6-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
8969 ; GFX6: ; %bb.0: ; %entry
8970 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
8971 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
8972 ; GFX6-NEXT: s_mov_b32 m0, -1
8973 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8974 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8975 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
8976 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
8977 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8978 ; GFX6-NEXT: s_endpgm
8980 ; GFX7-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
8981 ; GFX7: ; %bb.0: ; %entry
8982 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8983 ; GFX7-NEXT: s_mov_b32 m0, -1
8984 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8985 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8986 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
8987 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
8988 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8989 ; GFX7-NEXT: s_endpgm
8991 ; GFX10-WGP-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
8992 ; GFX10-WGP: ; %bb.0: ; %entry
8993 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8994 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8995 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8996 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8997 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
8998 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
8999 ; GFX10-WGP-NEXT: s_endpgm
9001 ; GFX10-CU-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
9002 ; GFX10-CU: ; %bb.0: ; %entry
9003 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9004 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9005 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9006 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
9007 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
9008 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9009 ; GFX10-CU-NEXT: s_endpgm
9011 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
9012 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9013 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9014 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9015 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9016 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9017 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
9018 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
9019 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9020 ; SKIP-CACHE-INV-NEXT: s_endpgm
9022 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
9023 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9024 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9025 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9026 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9027 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9028 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9029 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9030 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9032 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
9033 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9034 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9035 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9036 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9037 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9038 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9039 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9040 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9042 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
9043 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9044 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9045 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9046 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9047 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9048 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9049 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9050 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9052 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
9053 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9054 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9055 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9056 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9057 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9058 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9059 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9060 ; GFX940-TGSPLIT-NEXT: s_endpgm
9062 ; GFX11-WGP-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
9063 ; GFX11-WGP: ; %bb.0: ; %entry
9064 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9065 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9066 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9067 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
9068 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
9069 ; GFX11-WGP-NEXT: s_endpgm
9071 ; GFX11-CU-LABEL: local_wavefront_one_as_acquire_seq_cst_cmpxchg:
9072 ; GFX11-CU: ; %bb.0: ; %entry
9073 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9074 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9075 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9076 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
9077 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
9078 ; GFX11-CU-NEXT: s_endpgm
9079 ptr addrspace(3) %out, i32 %in, i32 %old) {
9081 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
9082 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acquire seq_cst
9086 define amdgpu_kernel void @local_wavefront_one_as_release_seq_cst_cmpxchg(
9087 ; GFX6-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9088 ; GFX6: ; %bb.0: ; %entry
9089 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
9090 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
9091 ; GFX6-NEXT: s_mov_b32 m0, -1
9092 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9093 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9094 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
9095 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
9096 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9097 ; GFX6-NEXT: s_endpgm
9099 ; GFX7-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9100 ; GFX7: ; %bb.0: ; %entry
9101 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9102 ; GFX7-NEXT: s_mov_b32 m0, -1
9103 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9104 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9105 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
9106 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
9107 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9108 ; GFX7-NEXT: s_endpgm
9110 ; GFX10-WGP-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9111 ; GFX10-WGP: ; %bb.0: ; %entry
9112 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9113 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9114 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9115 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
9116 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
9117 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9118 ; GFX10-WGP-NEXT: s_endpgm
9120 ; GFX10-CU-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9121 ; GFX10-CU: ; %bb.0: ; %entry
9122 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9123 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9124 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9125 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
9126 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
9127 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9128 ; GFX10-CU-NEXT: s_endpgm
9130 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9131 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9132 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9133 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9134 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9135 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9136 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
9137 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
9138 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9139 ; SKIP-CACHE-INV-NEXT: s_endpgm
9141 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9142 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9143 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9144 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9145 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9146 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9147 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9148 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9149 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9151 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9152 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9153 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9154 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9155 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9156 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9157 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9158 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9159 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9161 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9162 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9163 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9164 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9165 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9166 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9167 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9168 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9169 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9171 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9172 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9173 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9174 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9175 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9176 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9177 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9178 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9179 ; GFX940-TGSPLIT-NEXT: s_endpgm
9181 ; GFX11-WGP-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9182 ; GFX11-WGP: ; %bb.0: ; %entry
9183 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9184 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9185 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9186 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
9187 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
9188 ; GFX11-WGP-NEXT: s_endpgm
9190 ; GFX11-CU-LABEL: local_wavefront_one_as_release_seq_cst_cmpxchg:
9191 ; GFX11-CU: ; %bb.0: ; %entry
9192 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9193 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9194 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9195 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
9196 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
9197 ; GFX11-CU-NEXT: s_endpgm
9198 ptr addrspace(3) %out, i32 %in, i32 %old) {
9200 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
9201 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") release seq_cst
9205 define amdgpu_kernel void @local_wavefront_one_as_acq_rel_seq_cst_cmpxchg(
9206 ; GFX6-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9207 ; GFX6: ; %bb.0: ; %entry
9208 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
9209 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
9210 ; GFX6-NEXT: s_mov_b32 m0, -1
9211 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9212 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9213 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
9214 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
9215 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9216 ; GFX6-NEXT: s_endpgm
9218 ; GFX7-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9219 ; GFX7: ; %bb.0: ; %entry
9220 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9221 ; GFX7-NEXT: s_mov_b32 m0, -1
9222 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9223 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9224 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
9225 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
9226 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9227 ; GFX7-NEXT: s_endpgm
9229 ; GFX10-WGP-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9230 ; GFX10-WGP: ; %bb.0: ; %entry
9231 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9232 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9233 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9234 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
9235 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
9236 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9237 ; GFX10-WGP-NEXT: s_endpgm
9239 ; GFX10-CU-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9240 ; GFX10-CU: ; %bb.0: ; %entry
9241 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9242 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9243 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9244 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
9245 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
9246 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9247 ; GFX10-CU-NEXT: s_endpgm
9249 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9250 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9251 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9252 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9253 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9254 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9255 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
9256 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
9257 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9258 ; SKIP-CACHE-INV-NEXT: s_endpgm
9260 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9261 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9262 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9263 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9264 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9265 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9266 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9267 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9268 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9270 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9271 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9272 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9273 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9274 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9275 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9276 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9277 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9278 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9280 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9281 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9282 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9283 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9284 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9285 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9286 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9287 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9288 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9290 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9291 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9292 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9293 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9294 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9295 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9296 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9297 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9298 ; GFX940-TGSPLIT-NEXT: s_endpgm
9300 ; GFX11-WGP-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9301 ; GFX11-WGP: ; %bb.0: ; %entry
9302 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9303 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9304 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9305 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
9306 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
9307 ; GFX11-WGP-NEXT: s_endpgm
9309 ; GFX11-CU-LABEL: local_wavefront_one_as_acq_rel_seq_cst_cmpxchg:
9310 ; GFX11-CU: ; %bb.0: ; %entry
9311 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9312 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9313 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9314 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
9315 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
9316 ; GFX11-CU-NEXT: s_endpgm
9317 ptr addrspace(3) %out, i32 %in, i32 %old) {
9319 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
9320 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acq_rel seq_cst
9324 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_seq_cst_cmpxchg(
9325 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9326 ; GFX6: ; %bb.0: ; %entry
9327 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
9328 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
9329 ; GFX6-NEXT: s_mov_b32 m0, -1
9330 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9331 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9332 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
9333 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
9334 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9335 ; GFX6-NEXT: s_endpgm
9337 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9338 ; GFX7: ; %bb.0: ; %entry
9339 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9340 ; GFX7-NEXT: s_mov_b32 m0, -1
9341 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9342 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9343 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
9344 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
9345 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9346 ; GFX7-NEXT: s_endpgm
9348 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9349 ; GFX10-WGP: ; %bb.0: ; %entry
9350 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9351 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9352 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9353 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
9354 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
9355 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9356 ; GFX10-WGP-NEXT: s_endpgm
9358 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9359 ; GFX10-CU: ; %bb.0: ; %entry
9360 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9361 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9362 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9363 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
9364 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
9365 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9366 ; GFX10-CU-NEXT: s_endpgm
9368 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9369 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9370 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9371 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9372 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9373 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9374 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
9375 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
9376 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9377 ; SKIP-CACHE-INV-NEXT: s_endpgm
9379 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9380 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9381 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9382 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9383 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9384 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9385 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9386 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9387 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9389 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9390 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9391 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9392 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9393 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9394 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9395 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9396 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9397 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9399 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9400 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9401 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9402 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9403 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9404 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9405 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9406 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9407 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9409 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9410 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9411 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9412 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9413 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9414 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9415 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9416 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
9417 ; GFX940-TGSPLIT-NEXT: s_endpgm
9419 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9420 ; GFX11-WGP: ; %bb.0: ; %entry
9421 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9422 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9423 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9424 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
9425 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
9426 ; GFX11-WGP-NEXT: s_endpgm
9428 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_seq_cst_cmpxchg:
9429 ; GFX11-CU: ; %bb.0: ; %entry
9430 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9431 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9432 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9433 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
9434 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
9435 ; GFX11-CU-NEXT: s_endpgm
9436 ptr addrspace(3) %out, i32 %in, i32 %old) {
9438 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
9439 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") seq_cst seq_cst
9443 define amdgpu_kernel void @local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg(
9444 ; GFX6-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9445 ; GFX6: ; %bb.0: ; %entry
9446 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
9447 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
9448 ; GFX6-NEXT: s_mov_b32 m0, -1
9449 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9450 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9451 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
9452 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
9453 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9454 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9455 ; GFX6-NEXT: ds_write_b32 v0, v1
9456 ; GFX6-NEXT: s_endpgm
9458 ; GFX7-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9459 ; GFX7: ; %bb.0: ; %entry
9460 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9461 ; GFX7-NEXT: s_mov_b32 m0, -1
9462 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9463 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9464 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
9465 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
9466 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9467 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9468 ; GFX7-NEXT: ds_write_b32 v0, v1
9469 ; GFX7-NEXT: s_endpgm
9471 ; GFX10-WGP-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9472 ; GFX10-WGP: ; %bb.0: ; %entry
9473 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9474 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9475 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9476 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
9477 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
9478 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9479 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9480 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
9481 ; GFX10-WGP-NEXT: s_endpgm
9483 ; GFX10-CU-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9484 ; GFX10-CU: ; %bb.0: ; %entry
9485 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9486 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9487 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9488 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
9489 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
9490 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9491 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9492 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
9493 ; GFX10-CU-NEXT: s_endpgm
9495 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9496 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9497 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9498 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9499 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9500 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9501 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
9502 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
9503 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9504 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9505 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
9506 ; SKIP-CACHE-INV-NEXT: s_endpgm
9508 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9509 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9510 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9511 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9512 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9513 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9514 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9515 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9516 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9517 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9518 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9520 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9521 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9522 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9523 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9524 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9525 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9526 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9527 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9528 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9529 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
9530 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9532 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9533 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9534 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9535 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9536 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9537 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9538 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9539 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9540 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9541 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9542 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9544 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9545 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9546 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9547 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9548 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9549 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9550 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9551 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9552 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9553 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
9554 ; GFX940-TGSPLIT-NEXT: s_endpgm
9556 ; GFX11-WGP-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9557 ; GFX11-WGP: ; %bb.0: ; %entry
9558 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9559 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9560 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9561 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
9562 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
9563 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9564 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
9565 ; GFX11-WGP-NEXT: s_endpgm
9567 ; GFX11-CU-LABEL: local_wavefront_one_as_monotonic_monotonic_ret_cmpxchg:
9568 ; GFX11-CU: ; %bb.0: ; %entry
9569 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9570 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9571 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9572 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
9573 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
9574 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9575 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
9576 ; GFX11-CU-NEXT: s_endpgm
9577 ptr addrspace(3) %out, i32 %in, i32 %old) {
9579 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
9580 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") monotonic monotonic
9581 %val0 = extractvalue { i32, i1 } %val, 0
9582 store i32 %val0, ptr addrspace(3) %out, align 4
9586 define amdgpu_kernel void @local_wavefront_one_as_acquire_monotonic_ret_cmpxchg(
9587 ; GFX6-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9588 ; GFX6: ; %bb.0: ; %entry
9589 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
9590 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
9591 ; GFX6-NEXT: s_mov_b32 m0, -1
9592 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9593 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9594 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
9595 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
9596 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9597 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9598 ; GFX6-NEXT: ds_write_b32 v0, v1
9599 ; GFX6-NEXT: s_endpgm
9601 ; GFX7-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9602 ; GFX7: ; %bb.0: ; %entry
9603 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9604 ; GFX7-NEXT: s_mov_b32 m0, -1
9605 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9606 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9607 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
9608 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
9609 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9610 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9611 ; GFX7-NEXT: ds_write_b32 v0, v1
9612 ; GFX7-NEXT: s_endpgm
9614 ; GFX10-WGP-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9615 ; GFX10-WGP: ; %bb.0: ; %entry
9616 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9617 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9618 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9619 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
9620 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
9621 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9622 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9623 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
9624 ; GFX10-WGP-NEXT: s_endpgm
9626 ; GFX10-CU-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9627 ; GFX10-CU: ; %bb.0: ; %entry
9628 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9629 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9630 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9631 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
9632 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
9633 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9634 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9635 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
9636 ; GFX10-CU-NEXT: s_endpgm
9638 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9639 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9640 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9641 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9642 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9643 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9644 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
9645 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
9646 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9647 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9648 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
9649 ; SKIP-CACHE-INV-NEXT: s_endpgm
9651 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9652 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9653 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9654 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9655 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9656 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9657 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9658 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9659 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9660 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9661 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9663 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9664 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9665 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9666 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9667 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9668 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9669 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9670 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9671 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9672 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
9673 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9675 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9676 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9677 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9678 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9679 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9680 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9681 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9682 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9683 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9684 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9685 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9687 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9688 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9689 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9690 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9691 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9692 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9693 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9694 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9695 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9696 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
9697 ; GFX940-TGSPLIT-NEXT: s_endpgm
9699 ; GFX11-WGP-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9700 ; GFX11-WGP: ; %bb.0: ; %entry
9701 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9702 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9703 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9704 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
9705 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
9706 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9707 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
9708 ; GFX11-WGP-NEXT: s_endpgm
9710 ; GFX11-CU-LABEL: local_wavefront_one_as_acquire_monotonic_ret_cmpxchg:
9711 ; GFX11-CU: ; %bb.0: ; %entry
9712 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9713 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9714 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9715 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
9716 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
9717 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9718 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
9719 ; GFX11-CU-NEXT: s_endpgm
9720 ptr addrspace(3) %out, i32 %in, i32 %old) {
9722 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
9723 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acquire monotonic
9724 %val0 = extractvalue { i32, i1 } %val, 0
9725 store i32 %val0, ptr addrspace(3) %out, align 4
9729 define amdgpu_kernel void @local_wavefront_one_as_release_monotonic_ret_cmpxchg(
9730 ; GFX6-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9731 ; GFX6: ; %bb.0: ; %entry
9732 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
9733 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
9734 ; GFX6-NEXT: s_mov_b32 m0, -1
9735 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9736 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9737 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
9738 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
9739 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9740 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9741 ; GFX6-NEXT: ds_write_b32 v0, v1
9742 ; GFX6-NEXT: s_endpgm
9744 ; GFX7-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9745 ; GFX7: ; %bb.0: ; %entry
9746 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9747 ; GFX7-NEXT: s_mov_b32 m0, -1
9748 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9749 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9750 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
9751 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
9752 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9753 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9754 ; GFX7-NEXT: ds_write_b32 v0, v1
9755 ; GFX7-NEXT: s_endpgm
9757 ; GFX10-WGP-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9758 ; GFX10-WGP: ; %bb.0: ; %entry
9759 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9760 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9761 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9762 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
9763 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
9764 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9765 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9766 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
9767 ; GFX10-WGP-NEXT: s_endpgm
9769 ; GFX10-CU-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9770 ; GFX10-CU: ; %bb.0: ; %entry
9771 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9772 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9773 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9774 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
9775 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
9776 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9777 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9778 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
9779 ; GFX10-CU-NEXT: s_endpgm
9781 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9782 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9783 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9784 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9785 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9786 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9787 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
9788 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
9789 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9790 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9791 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
9792 ; SKIP-CACHE-INV-NEXT: s_endpgm
9794 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9795 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9796 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9797 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9798 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9799 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9800 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9801 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9802 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9803 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9804 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9806 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9807 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9808 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9809 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9810 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9811 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9812 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9813 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9814 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9815 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
9816 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9818 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9819 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9820 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9821 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9822 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9823 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9824 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9825 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9826 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9827 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9828 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9830 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9831 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9832 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9833 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9834 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9835 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9836 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9837 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9838 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9839 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
9840 ; GFX940-TGSPLIT-NEXT: s_endpgm
9842 ; GFX11-WGP-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9843 ; GFX11-WGP: ; %bb.0: ; %entry
9844 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9845 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9846 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9847 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
9848 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
9849 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9850 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
9851 ; GFX11-WGP-NEXT: s_endpgm
9853 ; GFX11-CU-LABEL: local_wavefront_one_as_release_monotonic_ret_cmpxchg:
9854 ; GFX11-CU: ; %bb.0: ; %entry
9855 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9856 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9857 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9858 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
9859 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
9860 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9861 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
9862 ; GFX11-CU-NEXT: s_endpgm
9863 ptr addrspace(3) %out, i32 %in, i32 %old) {
9865 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
9866 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") release monotonic
9867 %val0 = extractvalue { i32, i1 } %val, 0
9868 store i32 %val0, ptr addrspace(3) %out, align 4
9872 define amdgpu_kernel void @local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg(
9873 ; GFX6-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9874 ; GFX6: ; %bb.0: ; %entry
9875 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
9876 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
9877 ; GFX6-NEXT: s_mov_b32 m0, -1
9878 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9879 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9880 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
9881 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
9882 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9883 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9884 ; GFX6-NEXT: ds_write_b32 v0, v1
9885 ; GFX6-NEXT: s_endpgm
9887 ; GFX7-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9888 ; GFX7: ; %bb.0: ; %entry
9889 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9890 ; GFX7-NEXT: s_mov_b32 m0, -1
9891 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9892 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9893 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
9894 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
9895 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9896 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9897 ; GFX7-NEXT: ds_write_b32 v0, v1
9898 ; GFX7-NEXT: s_endpgm
9900 ; GFX10-WGP-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9901 ; GFX10-WGP: ; %bb.0: ; %entry
9902 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9903 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9904 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9905 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
9906 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
9907 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9908 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9909 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
9910 ; GFX10-WGP-NEXT: s_endpgm
9912 ; GFX10-CU-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9913 ; GFX10-CU: ; %bb.0: ; %entry
9914 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9915 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9916 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9917 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
9918 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
9919 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9920 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9921 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
9922 ; GFX10-CU-NEXT: s_endpgm
9924 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9925 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9926 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9927 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9928 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9929 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9930 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
9931 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
9932 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9933 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9934 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
9935 ; SKIP-CACHE-INV-NEXT: s_endpgm
9937 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9938 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9939 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9940 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9941 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9942 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9943 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9944 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9945 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9946 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9947 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9949 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9950 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9951 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9952 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9953 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9954 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9955 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9956 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9957 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9958 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
9959 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9961 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9962 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9963 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9964 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9965 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9966 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9967 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9968 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9969 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9970 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9971 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9973 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9974 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9975 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9976 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9977 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9978 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
9979 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
9980 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
9981 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9982 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
9983 ; GFX940-TGSPLIT-NEXT: s_endpgm
9985 ; GFX11-WGP-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9986 ; GFX11-WGP: ; %bb.0: ; %entry
9987 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9988 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9989 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9990 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
9991 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
9992 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9993 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
9994 ; GFX11-WGP-NEXT: s_endpgm
9996 ; GFX11-CU-LABEL: local_wavefront_one_as_acq_rel_monotonic_ret_cmpxchg:
9997 ; GFX11-CU: ; %bb.0: ; %entry
9998 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9999 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10000 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10001 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
10002 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10003 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10004 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10005 ; GFX11-CU-NEXT: s_endpgm
10006 ptr addrspace(3) %out, i32 %in, i32 %old) {
10008 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
10009 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acq_rel monotonic
10010 %val0 = extractvalue { i32, i1 } %val, 0
10011 store i32 %val0, ptr addrspace(3) %out, align 4
10015 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg(
10016 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10017 ; GFX6: ; %bb.0: ; %entry
10018 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
10019 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
10020 ; GFX6-NEXT: s_mov_b32 m0, -1
10021 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10022 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10023 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
10024 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
10025 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10026 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10027 ; GFX6-NEXT: ds_write_b32 v0, v1
10028 ; GFX6-NEXT: s_endpgm
10030 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10031 ; GFX7: ; %bb.0: ; %entry
10032 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10033 ; GFX7-NEXT: s_mov_b32 m0, -1
10034 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10035 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10036 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
10037 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
10038 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10039 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10040 ; GFX7-NEXT: ds_write_b32 v0, v1
10041 ; GFX7-NEXT: s_endpgm
10043 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10044 ; GFX10-WGP: ; %bb.0: ; %entry
10045 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10046 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10047 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10048 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
10049 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
10050 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10051 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10052 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10053 ; GFX10-WGP-NEXT: s_endpgm
10055 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10056 ; GFX10-CU: ; %bb.0: ; %entry
10057 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10058 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10059 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10060 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
10061 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
10062 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10063 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10064 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10065 ; GFX10-CU-NEXT: s_endpgm
10067 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10068 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10069 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10070 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10071 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10072 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10073 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
10074 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
10075 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10076 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10077 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10078 ; SKIP-CACHE-INV-NEXT: s_endpgm
10080 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10081 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10082 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10083 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10084 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10085 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10086 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10087 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10088 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10089 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10090 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10092 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10093 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10094 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10095 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10096 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10097 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10098 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10099 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10100 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10101 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10102 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10104 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10105 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10106 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10107 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10108 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10109 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10110 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10111 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10112 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10113 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10114 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10116 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10117 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10118 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10119 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10120 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10121 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10122 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10123 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10124 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10125 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10126 ; GFX940-TGSPLIT-NEXT: s_endpgm
10128 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10129 ; GFX11-WGP: ; %bb.0: ; %entry
10130 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10131 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10132 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10133 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
10134 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10135 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10136 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10137 ; GFX11-WGP-NEXT: s_endpgm
10139 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_monotonic_ret_cmpxchg:
10140 ; GFX11-CU: ; %bb.0: ; %entry
10141 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10142 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10143 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10144 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
10145 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10146 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10147 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10148 ; GFX11-CU-NEXT: s_endpgm
10149 ptr addrspace(3) %out, i32 %in, i32 %old) {
10151 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
10152 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") seq_cst monotonic
10153 %val0 = extractvalue { i32, i1 } %val, 0
10154 store i32 %val0, ptr addrspace(3) %out, align 4
10158 define amdgpu_kernel void @local_wavefront_one_as_monotonic_acquire_ret_cmpxchg(
10159 ; GFX6-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10160 ; GFX6: ; %bb.0: ; %entry
10161 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
10162 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
10163 ; GFX6-NEXT: s_mov_b32 m0, -1
10164 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10165 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10166 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
10167 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
10168 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10169 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10170 ; GFX6-NEXT: ds_write_b32 v0, v1
10171 ; GFX6-NEXT: s_endpgm
10173 ; GFX7-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10174 ; GFX7: ; %bb.0: ; %entry
10175 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10176 ; GFX7-NEXT: s_mov_b32 m0, -1
10177 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10178 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10179 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
10180 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
10181 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10182 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10183 ; GFX7-NEXT: ds_write_b32 v0, v1
10184 ; GFX7-NEXT: s_endpgm
10186 ; GFX10-WGP-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10187 ; GFX10-WGP: ; %bb.0: ; %entry
10188 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10189 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10190 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10191 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
10192 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
10193 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10194 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10195 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10196 ; GFX10-WGP-NEXT: s_endpgm
10198 ; GFX10-CU-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10199 ; GFX10-CU: ; %bb.0: ; %entry
10200 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10201 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10202 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10203 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
10204 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
10205 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10206 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10207 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10208 ; GFX10-CU-NEXT: s_endpgm
10210 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10211 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10212 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10213 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10214 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10215 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10216 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
10217 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
10218 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10219 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10220 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10221 ; SKIP-CACHE-INV-NEXT: s_endpgm
10223 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10224 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10225 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10226 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10227 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10228 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10229 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10230 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10231 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10232 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10233 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10235 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10236 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10237 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10238 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10239 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10240 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10241 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10242 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10243 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10244 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10245 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10247 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10248 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10249 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10250 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10251 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10252 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10253 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10254 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10255 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10256 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10257 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10259 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10260 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10261 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10262 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10263 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10264 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10265 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10266 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10267 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10268 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10269 ; GFX940-TGSPLIT-NEXT: s_endpgm
10271 ; GFX11-WGP-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10272 ; GFX11-WGP: ; %bb.0: ; %entry
10273 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10274 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10275 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10276 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
10277 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10278 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10279 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10280 ; GFX11-WGP-NEXT: s_endpgm
10282 ; GFX11-CU-LABEL: local_wavefront_one_as_monotonic_acquire_ret_cmpxchg:
10283 ; GFX11-CU: ; %bb.0: ; %entry
10284 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10285 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10286 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10287 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
10288 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10289 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10290 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10291 ; GFX11-CU-NEXT: s_endpgm
10292 ptr addrspace(3) %out, i32 %in, i32 %old) {
10294 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
10295 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") monotonic acquire
10296 %val0 = extractvalue { i32, i1 } %val, 0
10297 store i32 %val0, ptr addrspace(3) %out, align 4
10301 define amdgpu_kernel void @local_wavefront_one_as_acquire_acquire_ret_cmpxchg(
10302 ; GFX6-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10303 ; GFX6: ; %bb.0: ; %entry
10304 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
10305 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
10306 ; GFX6-NEXT: s_mov_b32 m0, -1
10307 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10308 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10309 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
10310 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
10311 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10312 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10313 ; GFX6-NEXT: ds_write_b32 v0, v1
10314 ; GFX6-NEXT: s_endpgm
10316 ; GFX7-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10317 ; GFX7: ; %bb.0: ; %entry
10318 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10319 ; GFX7-NEXT: s_mov_b32 m0, -1
10320 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10321 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10322 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
10323 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
10324 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10325 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10326 ; GFX7-NEXT: ds_write_b32 v0, v1
10327 ; GFX7-NEXT: s_endpgm
10329 ; GFX10-WGP-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10330 ; GFX10-WGP: ; %bb.0: ; %entry
10331 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10332 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10333 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10334 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
10335 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
10336 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10337 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10338 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10339 ; GFX10-WGP-NEXT: s_endpgm
10341 ; GFX10-CU-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10342 ; GFX10-CU: ; %bb.0: ; %entry
10343 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10344 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10345 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10346 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
10347 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
10348 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10349 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10350 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10351 ; GFX10-CU-NEXT: s_endpgm
10353 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10354 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10355 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10356 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10357 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10358 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10359 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
10360 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
10361 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10362 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10363 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10364 ; SKIP-CACHE-INV-NEXT: s_endpgm
10366 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10367 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10368 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10369 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10370 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10371 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10372 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10373 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10374 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10375 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10376 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10378 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10379 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10380 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10381 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10382 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10383 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10384 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10385 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10386 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10387 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10388 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10390 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10391 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10392 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10393 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10394 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10395 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10396 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10397 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10398 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10399 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10400 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10402 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10403 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10404 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10405 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10406 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10407 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10408 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10409 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10410 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10411 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10412 ; GFX940-TGSPLIT-NEXT: s_endpgm
10414 ; GFX11-WGP-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10415 ; GFX11-WGP: ; %bb.0: ; %entry
10416 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10417 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10418 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10419 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
10420 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10421 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10422 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10423 ; GFX11-WGP-NEXT: s_endpgm
10425 ; GFX11-CU-LABEL: local_wavefront_one_as_acquire_acquire_ret_cmpxchg:
10426 ; GFX11-CU: ; %bb.0: ; %entry
10427 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10428 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10429 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10430 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
10431 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10432 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10433 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10434 ; GFX11-CU-NEXT: s_endpgm
10435 ptr addrspace(3) %out, i32 %in, i32 %old) {
10437 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
10438 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acquire acquire
10439 %val0 = extractvalue { i32, i1 } %val, 0
10440 store i32 %val0, ptr addrspace(3) %out, align 4
10444 define amdgpu_kernel void @local_wavefront_one_as_release_acquire_ret_cmpxchg(
10445 ; GFX6-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10446 ; GFX6: ; %bb.0: ; %entry
10447 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
10448 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
10449 ; GFX6-NEXT: s_mov_b32 m0, -1
10450 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10451 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10452 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
10453 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
10454 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10455 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10456 ; GFX6-NEXT: ds_write_b32 v0, v1
10457 ; GFX6-NEXT: s_endpgm
10459 ; GFX7-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10460 ; GFX7: ; %bb.0: ; %entry
10461 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10462 ; GFX7-NEXT: s_mov_b32 m0, -1
10463 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10464 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10465 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
10466 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
10467 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10468 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10469 ; GFX7-NEXT: ds_write_b32 v0, v1
10470 ; GFX7-NEXT: s_endpgm
10472 ; GFX10-WGP-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10473 ; GFX10-WGP: ; %bb.0: ; %entry
10474 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10475 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10476 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10477 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
10478 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
10479 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10480 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10481 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10482 ; GFX10-WGP-NEXT: s_endpgm
10484 ; GFX10-CU-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10485 ; GFX10-CU: ; %bb.0: ; %entry
10486 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10487 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10488 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10489 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
10490 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
10491 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10492 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10493 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10494 ; GFX10-CU-NEXT: s_endpgm
10496 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10497 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10498 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10499 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10500 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10501 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10502 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
10503 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
10504 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10505 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10506 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10507 ; SKIP-CACHE-INV-NEXT: s_endpgm
10509 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10510 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10511 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10512 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10513 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10514 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10515 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10516 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10517 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10518 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10519 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10521 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10522 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10523 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10524 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10525 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10526 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10527 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10528 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10529 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10530 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10531 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10533 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10534 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10535 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10536 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10537 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10538 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10539 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10540 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10541 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10542 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10543 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10545 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10546 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10547 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10548 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10549 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10550 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10551 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10552 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10553 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10554 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10555 ; GFX940-TGSPLIT-NEXT: s_endpgm
10557 ; GFX11-WGP-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10558 ; GFX11-WGP: ; %bb.0: ; %entry
10559 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10560 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10561 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10562 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
10563 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10564 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10565 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10566 ; GFX11-WGP-NEXT: s_endpgm
10568 ; GFX11-CU-LABEL: local_wavefront_one_as_release_acquire_ret_cmpxchg:
10569 ; GFX11-CU: ; %bb.0: ; %entry
10570 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10571 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10572 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10573 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
10574 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10575 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10576 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10577 ; GFX11-CU-NEXT: s_endpgm
10578 ptr addrspace(3) %out, i32 %in, i32 %old) {
10580 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
10581 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") release acquire
10582 %val0 = extractvalue { i32, i1 } %val, 0
10583 store i32 %val0, ptr addrspace(3) %out, align 4
10587 define amdgpu_kernel void @local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg(
10588 ; GFX6-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10589 ; GFX6: ; %bb.0: ; %entry
10590 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
10591 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
10592 ; GFX6-NEXT: s_mov_b32 m0, -1
10593 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10594 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10595 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
10596 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
10597 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10598 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10599 ; GFX6-NEXT: ds_write_b32 v0, v1
10600 ; GFX6-NEXT: s_endpgm
10602 ; GFX7-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10603 ; GFX7: ; %bb.0: ; %entry
10604 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10605 ; GFX7-NEXT: s_mov_b32 m0, -1
10606 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10607 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10608 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
10609 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
10610 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10611 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10612 ; GFX7-NEXT: ds_write_b32 v0, v1
10613 ; GFX7-NEXT: s_endpgm
10615 ; GFX10-WGP-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10616 ; GFX10-WGP: ; %bb.0: ; %entry
10617 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10618 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10619 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10620 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
10621 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
10622 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10623 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10624 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10625 ; GFX10-WGP-NEXT: s_endpgm
10627 ; GFX10-CU-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10628 ; GFX10-CU: ; %bb.0: ; %entry
10629 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10630 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10631 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10632 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
10633 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
10634 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10635 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10636 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10637 ; GFX10-CU-NEXT: s_endpgm
10639 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10640 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10641 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10642 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10643 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10644 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10645 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
10646 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
10647 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10648 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10649 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10650 ; SKIP-CACHE-INV-NEXT: s_endpgm
10652 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10653 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10654 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10655 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10656 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10657 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10658 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10659 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10660 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10661 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10662 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10664 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10665 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10666 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10667 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10668 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10669 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10670 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10671 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10672 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10673 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10674 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10676 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10677 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10678 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10679 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10680 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10681 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10682 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10683 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10684 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10685 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10686 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10688 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10689 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10690 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10691 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10692 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10693 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10694 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10695 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10696 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10697 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10698 ; GFX940-TGSPLIT-NEXT: s_endpgm
10700 ; GFX11-WGP-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10701 ; GFX11-WGP: ; %bb.0: ; %entry
10702 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10703 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10704 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10705 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
10706 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10707 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10708 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10709 ; GFX11-WGP-NEXT: s_endpgm
10711 ; GFX11-CU-LABEL: local_wavefront_one_as_acq_rel_acquire_ret_cmpxchg:
10712 ; GFX11-CU: ; %bb.0: ; %entry
10713 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10714 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10715 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10716 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
10717 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10718 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10719 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10720 ; GFX11-CU-NEXT: s_endpgm
10721 ptr addrspace(3) %out, i32 %in, i32 %old) {
10723 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
10724 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acq_rel acquire
10725 %val0 = extractvalue { i32, i1 } %val, 0
10726 store i32 %val0, ptr addrspace(3) %out, align 4
10730 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg(
10731 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10732 ; GFX6: ; %bb.0: ; %entry
10733 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
10734 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
10735 ; GFX6-NEXT: s_mov_b32 m0, -1
10736 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10737 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10738 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
10739 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
10740 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10741 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10742 ; GFX6-NEXT: ds_write_b32 v0, v1
10743 ; GFX6-NEXT: s_endpgm
10745 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10746 ; GFX7: ; %bb.0: ; %entry
10747 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10748 ; GFX7-NEXT: s_mov_b32 m0, -1
10749 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10750 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10751 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
10752 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
10753 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10754 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10755 ; GFX7-NEXT: ds_write_b32 v0, v1
10756 ; GFX7-NEXT: s_endpgm
10758 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10759 ; GFX10-WGP: ; %bb.0: ; %entry
10760 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10761 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10762 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10763 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
10764 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
10765 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10766 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10767 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10768 ; GFX10-WGP-NEXT: s_endpgm
10770 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10771 ; GFX10-CU: ; %bb.0: ; %entry
10772 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10773 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10774 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10775 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
10776 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
10777 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10778 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10779 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10780 ; GFX10-CU-NEXT: s_endpgm
10782 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10783 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10784 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10785 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10786 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10787 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10788 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
10789 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
10790 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10791 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10792 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10793 ; SKIP-CACHE-INV-NEXT: s_endpgm
10795 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10796 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10797 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10798 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10799 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10800 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10801 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10802 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10803 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10804 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10805 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10807 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10808 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10809 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10810 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10811 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10812 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10813 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10814 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10815 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10816 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10817 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10819 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10820 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10821 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10822 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10823 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10824 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10825 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10826 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10827 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10828 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10829 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10831 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10832 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10833 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10834 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10835 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10836 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10837 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10838 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10839 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10840 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10841 ; GFX940-TGSPLIT-NEXT: s_endpgm
10843 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10844 ; GFX11-WGP: ; %bb.0: ; %entry
10845 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10846 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10847 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10848 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
10849 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10850 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10851 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10852 ; GFX11-WGP-NEXT: s_endpgm
10854 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_acquire_ret_cmpxchg:
10855 ; GFX11-CU: ; %bb.0: ; %entry
10856 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10857 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10858 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10859 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
10860 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10861 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10862 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10863 ; GFX11-CU-NEXT: s_endpgm
10864 ptr addrspace(3) %out, i32 %in, i32 %old) {
10866 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
10867 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") seq_cst acquire
10868 %val0 = extractvalue { i32, i1 } %val, 0
10869 store i32 %val0, ptr addrspace(3) %out, align 4
10873 define amdgpu_kernel void @local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg(
10874 ; GFX6-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10875 ; GFX6: ; %bb.0: ; %entry
10876 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
10877 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
10878 ; GFX6-NEXT: s_mov_b32 m0, -1
10879 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10880 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10881 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
10882 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
10883 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10884 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10885 ; GFX6-NEXT: ds_write_b32 v0, v1
10886 ; GFX6-NEXT: s_endpgm
10888 ; GFX7-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10889 ; GFX7: ; %bb.0: ; %entry
10890 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10891 ; GFX7-NEXT: s_mov_b32 m0, -1
10892 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10893 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10894 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
10895 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
10896 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10897 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10898 ; GFX7-NEXT: ds_write_b32 v0, v1
10899 ; GFX7-NEXT: s_endpgm
10901 ; GFX10-WGP-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10902 ; GFX10-WGP: ; %bb.0: ; %entry
10903 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10904 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10905 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10906 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
10907 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
10908 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10909 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10910 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10911 ; GFX10-WGP-NEXT: s_endpgm
10913 ; GFX10-CU-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10914 ; GFX10-CU: ; %bb.0: ; %entry
10915 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10916 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10917 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10918 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
10919 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
10920 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10921 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10922 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10923 ; GFX10-CU-NEXT: s_endpgm
10925 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10926 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10927 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10928 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10929 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10930 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10931 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
10932 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
10933 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10934 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10935 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10936 ; SKIP-CACHE-INV-NEXT: s_endpgm
10938 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10939 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10940 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10941 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10942 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10943 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10944 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10945 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10946 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10947 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10948 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10950 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10951 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10952 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10953 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10954 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10955 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10956 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10957 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10958 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10959 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10960 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10962 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10963 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10964 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10965 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10966 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10967 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10968 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10969 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10970 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10971 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10972 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10974 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10975 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10976 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10977 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10978 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10979 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
10980 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
10981 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
10982 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10983 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10984 ; GFX940-TGSPLIT-NEXT: s_endpgm
10986 ; GFX11-WGP-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10987 ; GFX11-WGP: ; %bb.0: ; %entry
10988 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10989 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10990 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10991 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
10992 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
10993 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10994 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10995 ; GFX11-WGP-NEXT: s_endpgm
10997 ; GFX11-CU-LABEL: local_wavefront_one_as_monotonic_seq_cst_ret_cmpxchg:
10998 ; GFX11-CU: ; %bb.0: ; %entry
10999 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11000 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11001 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11002 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
11003 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
11004 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11005 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
11006 ; GFX11-CU-NEXT: s_endpgm
11007 ptr addrspace(3) %out, i32 %in, i32 %old) {
11009 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11010 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") monotonic seq_cst
11011 %val0 = extractvalue { i32, i1 } %val, 0
11012 store i32 %val0, ptr addrspace(3) %out, align 4
11016 define amdgpu_kernel void @local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg(
11017 ; GFX6-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11018 ; GFX6: ; %bb.0: ; %entry
11019 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
11020 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
11021 ; GFX6-NEXT: s_mov_b32 m0, -1
11022 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11023 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11024 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
11025 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
11026 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11027 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11028 ; GFX6-NEXT: ds_write_b32 v0, v1
11029 ; GFX6-NEXT: s_endpgm
11031 ; GFX7-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11032 ; GFX7: ; %bb.0: ; %entry
11033 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11034 ; GFX7-NEXT: s_mov_b32 m0, -1
11035 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11036 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11037 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
11038 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
11039 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11040 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11041 ; GFX7-NEXT: ds_write_b32 v0, v1
11042 ; GFX7-NEXT: s_endpgm
11044 ; GFX10-WGP-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11045 ; GFX10-WGP: ; %bb.0: ; %entry
11046 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11047 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11048 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11049 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
11050 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
11051 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11052 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11053 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
11054 ; GFX10-WGP-NEXT: s_endpgm
11056 ; GFX10-CU-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11057 ; GFX10-CU: ; %bb.0: ; %entry
11058 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11059 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11060 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11061 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
11062 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
11063 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11064 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11065 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
11066 ; GFX10-CU-NEXT: s_endpgm
11068 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11069 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11070 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11071 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11072 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11073 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11074 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
11075 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
11076 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11077 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11078 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
11079 ; SKIP-CACHE-INV-NEXT: s_endpgm
11081 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11082 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11083 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11084 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11085 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11086 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11087 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11088 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11089 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11090 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
11091 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11093 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11094 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11095 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11096 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11097 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11098 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11099 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11100 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11101 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11102 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
11103 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11105 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11106 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11107 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11108 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11109 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11110 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11111 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11112 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11113 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11114 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
11115 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11117 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11118 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11119 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11120 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11121 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11122 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11123 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11124 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11125 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11126 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
11127 ; GFX940-TGSPLIT-NEXT: s_endpgm
11129 ; GFX11-WGP-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11130 ; GFX11-WGP: ; %bb.0: ; %entry
11131 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11132 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11133 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11134 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
11135 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
11136 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11137 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
11138 ; GFX11-WGP-NEXT: s_endpgm
11140 ; GFX11-CU-LABEL: local_wavefront_one_as_acquire_seq_cst_ret_cmpxchg:
11141 ; GFX11-CU: ; %bb.0: ; %entry
11142 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11143 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11144 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11145 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
11146 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
11147 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11148 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
11149 ; GFX11-CU-NEXT: s_endpgm
11150 ptr addrspace(3) %out, i32 %in, i32 %old) {
11152 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11153 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acquire seq_cst
11154 %val0 = extractvalue { i32, i1 } %val, 0
11155 store i32 %val0, ptr addrspace(3) %out, align 4
11159 define amdgpu_kernel void @local_wavefront_one_as_release_seq_cst_ret_cmpxchg(
11160 ; GFX6-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11161 ; GFX6: ; %bb.0: ; %entry
11162 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
11163 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
11164 ; GFX6-NEXT: s_mov_b32 m0, -1
11165 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11166 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11167 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
11168 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
11169 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11170 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11171 ; GFX6-NEXT: ds_write_b32 v0, v1
11172 ; GFX6-NEXT: s_endpgm
11174 ; GFX7-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11175 ; GFX7: ; %bb.0: ; %entry
11176 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11177 ; GFX7-NEXT: s_mov_b32 m0, -1
11178 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11179 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11180 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
11181 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
11182 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11183 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11184 ; GFX7-NEXT: ds_write_b32 v0, v1
11185 ; GFX7-NEXT: s_endpgm
11187 ; GFX10-WGP-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11188 ; GFX10-WGP: ; %bb.0: ; %entry
11189 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11190 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11191 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11192 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
11193 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
11194 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11195 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11196 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
11197 ; GFX10-WGP-NEXT: s_endpgm
11199 ; GFX10-CU-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11200 ; GFX10-CU: ; %bb.0: ; %entry
11201 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11202 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11203 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11204 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
11205 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
11206 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11207 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11208 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
11209 ; GFX10-CU-NEXT: s_endpgm
11211 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11212 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11213 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11214 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11215 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11216 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11217 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
11218 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
11219 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11220 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11221 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
11222 ; SKIP-CACHE-INV-NEXT: s_endpgm
11224 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11225 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11226 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11227 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11228 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11229 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11230 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11231 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11232 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11233 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
11234 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11236 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11237 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11238 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11239 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11240 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11241 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11242 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11243 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11244 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11245 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
11246 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11248 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11249 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11250 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11251 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11252 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11253 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11254 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11255 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11256 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11257 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
11258 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11260 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11261 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11262 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11263 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11264 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11265 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11266 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11267 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11268 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11269 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
11270 ; GFX940-TGSPLIT-NEXT: s_endpgm
11272 ; GFX11-WGP-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11273 ; GFX11-WGP: ; %bb.0: ; %entry
11274 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11275 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11276 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11277 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
11278 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
11279 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11280 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
11281 ; GFX11-WGP-NEXT: s_endpgm
11283 ; GFX11-CU-LABEL: local_wavefront_one_as_release_seq_cst_ret_cmpxchg:
11284 ; GFX11-CU: ; %bb.0: ; %entry
11285 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11286 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11287 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11288 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
11289 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
11290 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11291 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
11292 ; GFX11-CU-NEXT: s_endpgm
11293 ptr addrspace(3) %out, i32 %in, i32 %old) {
11295 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11296 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") release seq_cst
11297 %val0 = extractvalue { i32, i1 } %val, 0
11298 store i32 %val0, ptr addrspace(3) %out, align 4
11302 define amdgpu_kernel void @local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg(
11303 ; GFX6-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11304 ; GFX6: ; %bb.0: ; %entry
11305 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
11306 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
11307 ; GFX6-NEXT: s_mov_b32 m0, -1
11308 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11309 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11310 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
11311 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
11312 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11313 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11314 ; GFX6-NEXT: ds_write_b32 v0, v1
11315 ; GFX6-NEXT: s_endpgm
11317 ; GFX7-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11318 ; GFX7: ; %bb.0: ; %entry
11319 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11320 ; GFX7-NEXT: s_mov_b32 m0, -1
11321 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11322 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11323 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
11324 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
11325 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11326 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11327 ; GFX7-NEXT: ds_write_b32 v0, v1
11328 ; GFX7-NEXT: s_endpgm
11330 ; GFX10-WGP-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11331 ; GFX10-WGP: ; %bb.0: ; %entry
11332 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11333 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11334 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11335 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
11336 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
11337 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11338 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11339 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
11340 ; GFX10-WGP-NEXT: s_endpgm
11342 ; GFX10-CU-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11343 ; GFX10-CU: ; %bb.0: ; %entry
11344 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11345 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11346 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11347 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
11348 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
11349 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11350 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11351 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
11352 ; GFX10-CU-NEXT: s_endpgm
11354 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11355 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11356 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11357 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11358 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11359 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11360 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
11361 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
11362 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11363 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11364 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
11365 ; SKIP-CACHE-INV-NEXT: s_endpgm
11367 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11368 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11369 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11370 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11371 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11372 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11373 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11374 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11375 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11376 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
11377 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11379 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11380 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11381 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11382 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11383 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11384 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11385 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11386 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11387 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11388 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
11389 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11391 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11392 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11393 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11394 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11395 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11396 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11397 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11398 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11399 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11400 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
11401 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11403 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11404 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11405 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11406 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11407 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11408 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11409 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11410 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11411 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11412 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
11413 ; GFX940-TGSPLIT-NEXT: s_endpgm
11415 ; GFX11-WGP-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11416 ; GFX11-WGP: ; %bb.0: ; %entry
11417 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11418 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11419 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11420 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
11421 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
11422 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11423 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
11424 ; GFX11-WGP-NEXT: s_endpgm
11426 ; GFX11-CU-LABEL: local_wavefront_one_as_acq_rel_seq_cst_ret_cmpxchg:
11427 ; GFX11-CU: ; %bb.0: ; %entry
11428 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11429 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11430 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11431 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
11432 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
11433 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11434 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
11435 ; GFX11-CU-NEXT: s_endpgm
11436 ptr addrspace(3) %out, i32 %in, i32 %old) {
11438 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11439 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") acq_rel seq_cst
11440 %val0 = extractvalue { i32, i1 } %val, 0
11441 store i32 %val0, ptr addrspace(3) %out, align 4
11445 define amdgpu_kernel void @local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg(
11446 ; GFX6-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11447 ; GFX6: ; %bb.0: ; %entry
11448 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
11449 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
11450 ; GFX6-NEXT: s_mov_b32 m0, -1
11451 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11452 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11453 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
11454 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
11455 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11456 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11457 ; GFX6-NEXT: ds_write_b32 v0, v1
11458 ; GFX6-NEXT: s_endpgm
11460 ; GFX7-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11461 ; GFX7: ; %bb.0: ; %entry
11462 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11463 ; GFX7-NEXT: s_mov_b32 m0, -1
11464 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11465 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11466 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
11467 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
11468 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11469 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11470 ; GFX7-NEXT: ds_write_b32 v0, v1
11471 ; GFX7-NEXT: s_endpgm
11473 ; GFX10-WGP-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11474 ; GFX10-WGP: ; %bb.0: ; %entry
11475 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11476 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11477 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11478 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
11479 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
11480 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11481 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11482 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
11483 ; GFX10-WGP-NEXT: s_endpgm
11485 ; GFX10-CU-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11486 ; GFX10-CU: ; %bb.0: ; %entry
11487 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11488 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11489 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11490 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
11491 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
11492 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11493 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11494 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
11495 ; GFX10-CU-NEXT: s_endpgm
11497 ; SKIP-CACHE-INV-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11498 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11499 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11500 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11501 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11502 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11503 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
11504 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
11505 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11506 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11507 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
11508 ; SKIP-CACHE-INV-NEXT: s_endpgm
11510 ; GFX90A-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11511 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11512 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11513 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11514 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11515 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11516 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11517 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11518 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11519 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
11520 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11522 ; GFX90A-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11523 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11524 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11525 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11526 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11527 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11528 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11529 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11530 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11531 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
11532 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11534 ; GFX940-NOTTGSPLIT-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11535 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11536 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11537 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11538 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11539 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11540 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11541 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11542 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11543 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
11544 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11546 ; GFX940-TGSPLIT-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11547 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11548 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11549 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11550 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
11551 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
11552 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
11553 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
11554 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11555 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
11556 ; GFX940-TGSPLIT-NEXT: s_endpgm
11558 ; GFX11-WGP-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11559 ; GFX11-WGP: ; %bb.0: ; %entry
11560 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11561 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11562 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11563 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s2
11564 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
11565 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11566 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
11567 ; GFX11-WGP-NEXT: s_endpgm
11569 ; GFX11-CU-LABEL: local_wavefront_one_as_seq_cst_seq_cst_ret_cmpxchg:
11570 ; GFX11-CU: ; %bb.0: ; %entry
11571 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11572 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11573 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11574 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s2
11575 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
11576 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11577 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
11578 ; GFX11-CU-NEXT: s_endpgm
11579 ptr addrspace(3) %out, i32 %in, i32 %old) {
11581 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11582 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("wavefront-one-as") seq_cst seq_cst
11583 %val0 = extractvalue { i32, i1 } %val, 0
11584 store i32 %val0, ptr addrspace(3) %out, align 4