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
10 define amdgpu_kernel void @local_singlethread_unordered_load(
11 ; GFX6-LABEL: local_singlethread_unordered_load:
12 ; GFX6: ; %bb.0: ; %entry
13 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
14 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
15 ; GFX6-NEXT: s_mov_b32 m0, -1
16 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
17 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
18 ; GFX6-NEXT: ds_read_b32 v0, v0
19 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
20 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
21 ; GFX6-NEXT: ds_write_b32 v1, v0
24 ; GFX7-LABEL: local_singlethread_unordered_load:
25 ; GFX7: ; %bb.0: ; %entry
26 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
27 ; GFX7-NEXT: s_mov_b32 m0, -1
28 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
29 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
30 ; GFX7-NEXT: ds_read_b32 v0, v0
31 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
32 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
33 ; GFX7-NEXT: ds_write_b32 v1, v0
36 ; GFX10-WGP-LABEL: local_singlethread_unordered_load:
37 ; GFX10-WGP: ; %bb.0: ; %entry
38 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
39 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
40 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
41 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
42 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
43 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
44 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
45 ; GFX10-WGP-NEXT: s_endpgm
47 ; GFX10-CU-LABEL: local_singlethread_unordered_load:
48 ; GFX10-CU: ; %bb.0: ; %entry
49 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
50 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
51 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
52 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
53 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
54 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
55 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
56 ; GFX10-CU-NEXT: s_endpgm
58 ; SKIP-CACHE-INV-LABEL: local_singlethread_unordered_load:
59 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
60 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
61 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
62 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
63 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
64 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
65 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
66 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
67 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
68 ; SKIP-CACHE-INV-NEXT: s_endpgm
70 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_unordered_load:
71 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
72 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
73 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
74 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
75 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
76 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
77 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
78 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
79 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
81 ; GFX90A-TGSPLIT-LABEL: local_singlethread_unordered_load:
82 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
83 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
84 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
85 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
86 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
87 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
88 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
89 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
90 ; GFX90A-TGSPLIT-NEXT: s_endpgm
91 i32 addrspace(3)* %in, i32 addrspace(3)* %out) {
93 %val = load atomic i32, i32 addrspace(3)* %in syncscope("singlethread") unordered, align 4
94 store i32 %val, i32 addrspace(3)* %out
98 define amdgpu_kernel void @local_singlethread_monotonic_load(
99 ; GFX6-LABEL: local_singlethread_monotonic_load:
100 ; GFX6: ; %bb.0: ; %entry
101 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
102 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
103 ; GFX6-NEXT: s_mov_b32 m0, -1
104 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
105 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
106 ; GFX6-NEXT: ds_read_b32 v0, v0
107 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
108 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
109 ; GFX6-NEXT: ds_write_b32 v1, v0
110 ; GFX6-NEXT: s_endpgm
112 ; GFX7-LABEL: local_singlethread_monotonic_load:
113 ; GFX7: ; %bb.0: ; %entry
114 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
115 ; GFX7-NEXT: s_mov_b32 m0, -1
116 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
117 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
118 ; GFX7-NEXT: ds_read_b32 v0, v0
119 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
120 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
121 ; GFX7-NEXT: ds_write_b32 v1, v0
122 ; GFX7-NEXT: s_endpgm
124 ; GFX10-WGP-LABEL: local_singlethread_monotonic_load:
125 ; GFX10-WGP: ; %bb.0: ; %entry
126 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
127 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
128 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
129 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
130 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
131 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
132 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
133 ; GFX10-WGP-NEXT: s_endpgm
135 ; GFX10-CU-LABEL: local_singlethread_monotonic_load:
136 ; GFX10-CU: ; %bb.0: ; %entry
137 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
138 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
139 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
140 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
141 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
142 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
143 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
144 ; GFX10-CU-NEXT: s_endpgm
146 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_load:
147 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
148 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
149 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
150 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
151 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
152 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
153 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
154 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
155 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
156 ; SKIP-CACHE-INV-NEXT: s_endpgm
158 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_load:
159 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
160 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
161 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
162 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
163 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
164 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
165 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
166 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
167 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
169 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_load:
170 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
171 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
172 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
173 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
174 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
175 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
176 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
177 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
178 ; GFX90A-TGSPLIT-NEXT: s_endpgm
179 i32 addrspace(3)* %in, i32 addrspace(3)* %out) {
181 %val = load atomic i32, i32 addrspace(3)* %in syncscope("singlethread") monotonic, align 4
182 store i32 %val, i32 addrspace(3)* %out
186 define amdgpu_kernel void @local_singlethread_acquire_load(
187 ; GFX6-LABEL: local_singlethread_acquire_load:
188 ; GFX6: ; %bb.0: ; %entry
189 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
190 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
191 ; GFX6-NEXT: s_mov_b32 m0, -1
192 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
193 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
194 ; GFX6-NEXT: ds_read_b32 v0, v0
195 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
196 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
197 ; GFX6-NEXT: ds_write_b32 v1, v0
198 ; GFX6-NEXT: s_endpgm
200 ; GFX7-LABEL: local_singlethread_acquire_load:
201 ; GFX7: ; %bb.0: ; %entry
202 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
203 ; GFX7-NEXT: s_mov_b32 m0, -1
204 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
205 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
206 ; GFX7-NEXT: ds_read_b32 v0, v0
207 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
208 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
209 ; GFX7-NEXT: ds_write_b32 v1, v0
210 ; GFX7-NEXT: s_endpgm
212 ; GFX10-WGP-LABEL: local_singlethread_acquire_load:
213 ; GFX10-WGP: ; %bb.0: ; %entry
214 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
215 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
216 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
217 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
218 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
219 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
220 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
221 ; GFX10-WGP-NEXT: s_endpgm
223 ; GFX10-CU-LABEL: local_singlethread_acquire_load:
224 ; GFX10-CU: ; %bb.0: ; %entry
225 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
226 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
227 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
228 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
229 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
230 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
231 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
232 ; GFX10-CU-NEXT: s_endpgm
234 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_load:
235 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
236 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
237 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
238 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
239 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
240 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
241 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
242 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
243 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
244 ; SKIP-CACHE-INV-NEXT: s_endpgm
246 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_load:
247 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
248 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
249 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
250 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
251 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
252 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
253 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
254 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
255 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
257 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_load:
258 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
259 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
260 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
261 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
262 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
263 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
264 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
265 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
266 ; GFX90A-TGSPLIT-NEXT: s_endpgm
267 i32 addrspace(3)* %in, i32 addrspace(3)* %out) {
269 %val = load atomic i32, i32 addrspace(3)* %in syncscope("singlethread") acquire, align 4
270 store i32 %val, i32 addrspace(3)* %out
274 define amdgpu_kernel void @local_singlethread_seq_cst_load(
275 ; GFX6-LABEL: local_singlethread_seq_cst_load:
276 ; GFX6: ; %bb.0: ; %entry
277 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
278 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
279 ; GFX6-NEXT: s_mov_b32 m0, -1
280 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
281 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
282 ; GFX6-NEXT: ds_read_b32 v0, v0
283 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
284 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
285 ; GFX6-NEXT: ds_write_b32 v1, v0
286 ; GFX6-NEXT: s_endpgm
288 ; GFX7-LABEL: local_singlethread_seq_cst_load:
289 ; GFX7: ; %bb.0: ; %entry
290 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
291 ; GFX7-NEXT: s_mov_b32 m0, -1
292 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
293 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
294 ; GFX7-NEXT: ds_read_b32 v0, v0
295 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
296 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
297 ; GFX7-NEXT: ds_write_b32 v1, v0
298 ; GFX7-NEXT: s_endpgm
300 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_load:
301 ; GFX10-WGP: ; %bb.0: ; %entry
302 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
303 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
304 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
305 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
306 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
307 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
308 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
309 ; GFX10-WGP-NEXT: s_endpgm
311 ; GFX10-CU-LABEL: local_singlethread_seq_cst_load:
312 ; GFX10-CU: ; %bb.0: ; %entry
313 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
314 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
315 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
316 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
317 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
318 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
319 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
320 ; GFX10-CU-NEXT: s_endpgm
322 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_load:
323 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
324 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
325 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
326 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
327 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
328 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
329 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
330 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
331 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
332 ; SKIP-CACHE-INV-NEXT: s_endpgm
334 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_load:
335 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
336 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
337 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
338 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
339 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
340 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
341 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
342 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
343 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
345 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_load:
346 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
347 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
348 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
349 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
350 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
351 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
352 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
353 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
354 ; GFX90A-TGSPLIT-NEXT: s_endpgm
355 i32 addrspace(3)* %in, i32 addrspace(3)* %out) {
357 %val = load atomic i32, i32 addrspace(3)* %in syncscope("singlethread") seq_cst, align 4
358 store i32 %val, i32 addrspace(3)* %out
362 define amdgpu_kernel void @local_singlethread_unordered_store(
363 ; GFX6-LABEL: local_singlethread_unordered_store:
364 ; GFX6: ; %bb.0: ; %entry
365 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
366 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
367 ; GFX6-NEXT: s_mov_b32 m0, -1
368 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
369 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
370 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
371 ; GFX6-NEXT: ds_write_b32 v0, v1
372 ; GFX6-NEXT: s_endpgm
374 ; GFX7-LABEL: local_singlethread_unordered_store:
375 ; GFX7: ; %bb.0: ; %entry
376 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
377 ; GFX7-NEXT: s_mov_b32 m0, -1
378 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
379 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
380 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
381 ; GFX7-NEXT: ds_write_b32 v0, v1
382 ; GFX7-NEXT: s_endpgm
384 ; GFX10-WGP-LABEL: local_singlethread_unordered_store:
385 ; GFX10-WGP: ; %bb.0: ; %entry
386 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
387 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
388 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
389 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
390 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
391 ; GFX10-WGP-NEXT: s_endpgm
393 ; GFX10-CU-LABEL: local_singlethread_unordered_store:
394 ; GFX10-CU: ; %bb.0: ; %entry
395 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
396 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
397 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
398 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
399 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
400 ; GFX10-CU-NEXT: s_endpgm
402 ; SKIP-CACHE-INV-LABEL: local_singlethread_unordered_store:
403 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
404 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
405 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
406 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
407 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
408 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
409 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
410 ; SKIP-CACHE-INV-NEXT: s_endpgm
412 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_unordered_store:
413 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
414 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
415 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
416 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
417 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
418 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
419 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
421 ; GFX90A-TGSPLIT-LABEL: local_singlethread_unordered_store:
422 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
423 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
424 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
425 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
426 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
427 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
428 ; GFX90A-TGSPLIT-NEXT: s_endpgm
429 i32 %in, i32 addrspace(3)* %out) {
431 store atomic i32 %in, i32 addrspace(3)* %out syncscope("singlethread") unordered, align 4
435 define amdgpu_kernel void @local_singlethread_monotonic_store(
436 ; GFX6-LABEL: local_singlethread_monotonic_store:
437 ; GFX6: ; %bb.0: ; %entry
438 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
439 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
440 ; GFX6-NEXT: s_mov_b32 m0, -1
441 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
442 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
443 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
444 ; GFX6-NEXT: ds_write_b32 v0, v1
445 ; GFX6-NEXT: s_endpgm
447 ; GFX7-LABEL: local_singlethread_monotonic_store:
448 ; GFX7: ; %bb.0: ; %entry
449 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
450 ; GFX7-NEXT: s_mov_b32 m0, -1
451 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
452 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
453 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
454 ; GFX7-NEXT: ds_write_b32 v0, v1
455 ; GFX7-NEXT: s_endpgm
457 ; GFX10-WGP-LABEL: local_singlethread_monotonic_store:
458 ; GFX10-WGP: ; %bb.0: ; %entry
459 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
460 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
461 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
462 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
463 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
464 ; GFX10-WGP-NEXT: s_endpgm
466 ; GFX10-CU-LABEL: local_singlethread_monotonic_store:
467 ; GFX10-CU: ; %bb.0: ; %entry
468 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
469 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
470 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
471 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
472 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
473 ; GFX10-CU-NEXT: s_endpgm
475 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_store:
476 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
477 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
478 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
479 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
480 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
481 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
482 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
483 ; SKIP-CACHE-INV-NEXT: s_endpgm
485 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_store:
486 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
487 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
488 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
489 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
490 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
491 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
492 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
494 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_store:
495 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
496 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
497 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
498 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
499 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
500 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
501 ; GFX90A-TGSPLIT-NEXT: s_endpgm
502 i32 %in, i32 addrspace(3)* %out) {
504 store atomic i32 %in, i32 addrspace(3)* %out syncscope("singlethread") monotonic, align 4
508 define amdgpu_kernel void @local_singlethread_release_store(
509 ; GFX6-LABEL: local_singlethread_release_store:
510 ; GFX6: ; %bb.0: ; %entry
511 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
512 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
513 ; GFX6-NEXT: s_mov_b32 m0, -1
514 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
515 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
516 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
517 ; GFX6-NEXT: ds_write_b32 v0, v1
518 ; GFX6-NEXT: s_endpgm
520 ; GFX7-LABEL: local_singlethread_release_store:
521 ; GFX7: ; %bb.0: ; %entry
522 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
523 ; GFX7-NEXT: s_mov_b32 m0, -1
524 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
525 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
526 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
527 ; GFX7-NEXT: ds_write_b32 v0, v1
528 ; GFX7-NEXT: s_endpgm
530 ; GFX10-WGP-LABEL: local_singlethread_release_store:
531 ; GFX10-WGP: ; %bb.0: ; %entry
532 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
533 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
534 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
535 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
536 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
537 ; GFX10-WGP-NEXT: s_endpgm
539 ; GFX10-CU-LABEL: local_singlethread_release_store:
540 ; GFX10-CU: ; %bb.0: ; %entry
541 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
542 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
543 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
544 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
545 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
546 ; GFX10-CU-NEXT: s_endpgm
548 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_store:
549 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
550 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
551 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
552 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
553 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
554 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
555 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
556 ; SKIP-CACHE-INV-NEXT: s_endpgm
558 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_store:
559 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
560 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
561 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
562 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
563 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
564 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
565 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
567 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_store:
568 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
569 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
570 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
571 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
572 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
573 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
574 ; GFX90A-TGSPLIT-NEXT: s_endpgm
575 i32 %in, i32 addrspace(3)* %out) {
577 store atomic i32 %in, i32 addrspace(3)* %out syncscope("singlethread") release, align 4
581 define amdgpu_kernel void @local_singlethread_seq_cst_store(
582 ; GFX6-LABEL: local_singlethread_seq_cst_store:
583 ; GFX6: ; %bb.0: ; %entry
584 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
585 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
586 ; GFX6-NEXT: s_mov_b32 m0, -1
587 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
588 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
589 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
590 ; GFX6-NEXT: ds_write_b32 v0, v1
591 ; GFX6-NEXT: s_endpgm
593 ; GFX7-LABEL: local_singlethread_seq_cst_store:
594 ; GFX7: ; %bb.0: ; %entry
595 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
596 ; GFX7-NEXT: s_mov_b32 m0, -1
597 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
598 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
599 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
600 ; GFX7-NEXT: ds_write_b32 v0, v1
601 ; GFX7-NEXT: s_endpgm
603 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_store:
604 ; GFX10-WGP: ; %bb.0: ; %entry
605 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
606 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
607 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
608 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
609 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
610 ; GFX10-WGP-NEXT: s_endpgm
612 ; GFX10-CU-LABEL: local_singlethread_seq_cst_store:
613 ; GFX10-CU: ; %bb.0: ; %entry
614 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
615 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
616 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
617 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
618 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
619 ; GFX10-CU-NEXT: s_endpgm
621 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_store:
622 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
623 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
624 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
625 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
626 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
627 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
628 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
629 ; SKIP-CACHE-INV-NEXT: s_endpgm
631 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_store:
632 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
633 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
634 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
635 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
636 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
637 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
638 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
640 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_store:
641 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
642 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
643 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
644 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
645 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
646 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
647 ; GFX90A-TGSPLIT-NEXT: s_endpgm
648 i32 %in, i32 addrspace(3)* %out) {
650 store atomic i32 %in, i32 addrspace(3)* %out syncscope("singlethread") seq_cst, align 4
654 define amdgpu_kernel void @local_singlethread_monotonic_atomicrmw(
655 ; GFX6-LABEL: local_singlethread_monotonic_atomicrmw:
656 ; GFX6: ; %bb.0: ; %entry
657 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
658 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
659 ; GFX6-NEXT: s_mov_b32 m0, -1
660 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
661 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
662 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
663 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
664 ; GFX6-NEXT: s_endpgm
666 ; GFX7-LABEL: local_singlethread_monotonic_atomicrmw:
667 ; GFX7: ; %bb.0: ; %entry
668 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
669 ; GFX7-NEXT: s_mov_b32 m0, -1
670 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
671 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
672 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
673 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
674 ; GFX7-NEXT: s_endpgm
676 ; GFX10-WGP-LABEL: local_singlethread_monotonic_atomicrmw:
677 ; GFX10-WGP: ; %bb.0: ; %entry
678 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
679 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
680 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
681 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
682 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
683 ; GFX10-WGP-NEXT: s_endpgm
685 ; GFX10-CU-LABEL: local_singlethread_monotonic_atomicrmw:
686 ; GFX10-CU: ; %bb.0: ; %entry
687 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
688 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
689 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
690 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
691 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
692 ; GFX10-CU-NEXT: s_endpgm
694 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_atomicrmw:
695 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
696 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
697 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
698 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
699 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
700 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
701 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
702 ; SKIP-CACHE-INV-NEXT: s_endpgm
704 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_atomicrmw:
705 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
706 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
707 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
708 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
709 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
710 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
711 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
713 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_atomicrmw:
714 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
715 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
716 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
717 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
718 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
719 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
720 ; GFX90A-TGSPLIT-NEXT: s_endpgm
721 i32 addrspace(3)* %out, i32 %in) {
723 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread") monotonic
727 define amdgpu_kernel void @local_singlethread_acquire_atomicrmw(
728 ; GFX6-LABEL: local_singlethread_acquire_atomicrmw:
729 ; GFX6: ; %bb.0: ; %entry
730 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
731 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
732 ; GFX6-NEXT: s_mov_b32 m0, -1
733 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
734 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
735 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
736 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
737 ; GFX6-NEXT: s_endpgm
739 ; GFX7-LABEL: local_singlethread_acquire_atomicrmw:
740 ; GFX7: ; %bb.0: ; %entry
741 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
742 ; GFX7-NEXT: s_mov_b32 m0, -1
743 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
744 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
745 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
746 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
747 ; GFX7-NEXT: s_endpgm
749 ; GFX10-WGP-LABEL: local_singlethread_acquire_atomicrmw:
750 ; GFX10-WGP: ; %bb.0: ; %entry
751 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
752 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
753 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
754 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
755 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
756 ; GFX10-WGP-NEXT: s_endpgm
758 ; GFX10-CU-LABEL: local_singlethread_acquire_atomicrmw:
759 ; GFX10-CU: ; %bb.0: ; %entry
760 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
761 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
762 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
763 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
764 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
765 ; GFX10-CU-NEXT: s_endpgm
767 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_atomicrmw:
768 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
769 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
770 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
771 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
772 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
773 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
774 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
775 ; SKIP-CACHE-INV-NEXT: s_endpgm
777 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_atomicrmw:
778 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
779 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
780 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
781 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
782 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
783 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
784 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
786 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_atomicrmw:
787 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
788 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
789 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
790 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
791 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
792 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
793 ; GFX90A-TGSPLIT-NEXT: s_endpgm
794 i32 addrspace(3)* %out, i32 %in) {
796 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread") acquire
800 define amdgpu_kernel void @local_singlethread_release_atomicrmw(
801 ; GFX6-LABEL: local_singlethread_release_atomicrmw:
802 ; GFX6: ; %bb.0: ; %entry
803 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
804 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
805 ; GFX6-NEXT: s_mov_b32 m0, -1
806 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
807 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
808 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
809 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
810 ; GFX6-NEXT: s_endpgm
812 ; GFX7-LABEL: local_singlethread_release_atomicrmw:
813 ; GFX7: ; %bb.0: ; %entry
814 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
815 ; GFX7-NEXT: s_mov_b32 m0, -1
816 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
817 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
818 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
819 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
820 ; GFX7-NEXT: s_endpgm
822 ; GFX10-WGP-LABEL: local_singlethread_release_atomicrmw:
823 ; GFX10-WGP: ; %bb.0: ; %entry
824 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
825 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
826 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
827 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
828 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
829 ; GFX10-WGP-NEXT: s_endpgm
831 ; GFX10-CU-LABEL: local_singlethread_release_atomicrmw:
832 ; GFX10-CU: ; %bb.0: ; %entry
833 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
834 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
835 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
836 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
837 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
838 ; GFX10-CU-NEXT: s_endpgm
840 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_atomicrmw:
841 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
842 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
843 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
844 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
845 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
846 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
847 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
848 ; SKIP-CACHE-INV-NEXT: s_endpgm
850 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_atomicrmw:
851 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
852 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
853 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
854 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
855 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
856 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
857 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
859 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_atomicrmw:
860 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
861 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
862 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
863 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
864 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
865 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
866 ; GFX90A-TGSPLIT-NEXT: s_endpgm
867 i32 addrspace(3)* %out, i32 %in) {
869 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread") release
873 define amdgpu_kernel void @local_singlethread_acq_rel_atomicrmw(
874 ; GFX6-LABEL: local_singlethread_acq_rel_atomicrmw:
875 ; GFX6: ; %bb.0: ; %entry
876 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
877 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
878 ; GFX6-NEXT: s_mov_b32 m0, -1
879 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
880 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
881 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
882 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
883 ; GFX6-NEXT: s_endpgm
885 ; GFX7-LABEL: local_singlethread_acq_rel_atomicrmw:
886 ; GFX7: ; %bb.0: ; %entry
887 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
888 ; GFX7-NEXT: s_mov_b32 m0, -1
889 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
890 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
891 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
892 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
893 ; GFX7-NEXT: s_endpgm
895 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_atomicrmw:
896 ; GFX10-WGP: ; %bb.0: ; %entry
897 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
898 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
899 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
900 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
901 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
902 ; GFX10-WGP-NEXT: s_endpgm
904 ; GFX10-CU-LABEL: local_singlethread_acq_rel_atomicrmw:
905 ; GFX10-CU: ; %bb.0: ; %entry
906 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
907 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
908 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
909 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
910 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
911 ; GFX10-CU-NEXT: s_endpgm
913 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_atomicrmw:
914 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
915 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
916 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
917 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
918 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
919 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
920 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
921 ; SKIP-CACHE-INV-NEXT: s_endpgm
923 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_atomicrmw:
924 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
925 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
926 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
927 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
928 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
929 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
930 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
932 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_atomicrmw:
933 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
934 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
935 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
936 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
937 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
938 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
939 ; GFX90A-TGSPLIT-NEXT: s_endpgm
940 i32 addrspace(3)* %out, i32 %in) {
942 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread") acq_rel
946 define amdgpu_kernel void @local_singlethread_seq_cst_atomicrmw(
947 ; GFX6-LABEL: local_singlethread_seq_cst_atomicrmw:
948 ; GFX6: ; %bb.0: ; %entry
949 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
950 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
951 ; GFX6-NEXT: s_mov_b32 m0, -1
952 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
953 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
954 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
955 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
956 ; GFX6-NEXT: s_endpgm
958 ; GFX7-LABEL: local_singlethread_seq_cst_atomicrmw:
959 ; GFX7: ; %bb.0: ; %entry
960 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
961 ; GFX7-NEXT: s_mov_b32 m0, -1
962 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
963 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
964 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
965 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
966 ; GFX7-NEXT: s_endpgm
968 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_atomicrmw:
969 ; GFX10-WGP: ; %bb.0: ; %entry
970 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
971 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
972 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
973 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
974 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
975 ; GFX10-WGP-NEXT: s_endpgm
977 ; GFX10-CU-LABEL: local_singlethread_seq_cst_atomicrmw:
978 ; GFX10-CU: ; %bb.0: ; %entry
979 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
980 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
981 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
982 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
983 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
984 ; GFX10-CU-NEXT: s_endpgm
986 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_atomicrmw:
987 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
988 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
989 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
990 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
991 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
992 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
993 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
994 ; SKIP-CACHE-INV-NEXT: s_endpgm
996 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_atomicrmw:
997 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
998 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
999 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1000 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1001 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1002 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1003 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1005 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_atomicrmw:
1006 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1007 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1008 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1009 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1010 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1011 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1012 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1013 i32 addrspace(3)* %out, i32 %in) {
1015 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread") seq_cst
1019 define amdgpu_kernel void @local_singlethread_acquire_ret_atomicrmw(
1020 ; GFX6-LABEL: local_singlethread_acquire_ret_atomicrmw:
1021 ; GFX6: ; %bb.0: ; %entry
1022 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
1023 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
1024 ; GFX6-NEXT: s_mov_b32 m0, -1
1025 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1026 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1027 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1028 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1029 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1030 ; GFX6-NEXT: ds_write_b32 v0, v1
1031 ; GFX6-NEXT: s_endpgm
1033 ; GFX7-LABEL: local_singlethread_acquire_ret_atomicrmw:
1034 ; GFX7: ; %bb.0: ; %entry
1035 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1036 ; GFX7-NEXT: s_mov_b32 m0, -1
1037 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1038 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1039 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1040 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1041 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1042 ; GFX7-NEXT: ds_write_b32 v0, v1
1043 ; GFX7-NEXT: s_endpgm
1045 ; GFX10-WGP-LABEL: local_singlethread_acquire_ret_atomicrmw:
1046 ; GFX10-WGP: ; %bb.0: ; %entry
1047 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1048 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1049 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1050 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1051 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1052 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1053 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
1054 ; GFX10-WGP-NEXT: s_endpgm
1056 ; GFX10-CU-LABEL: local_singlethread_acquire_ret_atomicrmw:
1057 ; GFX10-CU: ; %bb.0: ; %entry
1058 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1059 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1060 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1061 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1062 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1063 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1064 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
1065 ; GFX10-CU-NEXT: s_endpgm
1067 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_ret_atomicrmw:
1068 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1069 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
1070 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1071 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1072 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1073 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1074 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1075 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1076 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
1077 ; SKIP-CACHE-INV-NEXT: s_endpgm
1079 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_ret_atomicrmw:
1080 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1081 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1082 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1083 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1084 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1085 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1086 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1087 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1088 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1090 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_ret_atomicrmw:
1091 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1092 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1093 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1094 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1095 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1096 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1097 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1098 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
1099 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1100 i32 addrspace(3)* %out, i32 %in) {
1102 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread") acquire
1103 store i32 %val, i32 addrspace(3)* %out, align 4
1107 define amdgpu_kernel void @local_singlethread_acq_rel_ret_atomicrmw(
1108 ; GFX6-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
1109 ; GFX6: ; %bb.0: ; %entry
1110 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
1111 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
1112 ; GFX6-NEXT: s_mov_b32 m0, -1
1113 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1114 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1115 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1116 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1117 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1118 ; GFX6-NEXT: ds_write_b32 v0, v1
1119 ; GFX6-NEXT: s_endpgm
1121 ; GFX7-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
1122 ; GFX7: ; %bb.0: ; %entry
1123 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1124 ; GFX7-NEXT: s_mov_b32 m0, -1
1125 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1126 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1127 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1128 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1129 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1130 ; GFX7-NEXT: ds_write_b32 v0, v1
1131 ; GFX7-NEXT: s_endpgm
1133 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
1134 ; GFX10-WGP: ; %bb.0: ; %entry
1135 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1136 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1137 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1138 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1139 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1140 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1141 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
1142 ; GFX10-WGP-NEXT: s_endpgm
1144 ; GFX10-CU-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
1145 ; GFX10-CU: ; %bb.0: ; %entry
1146 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1147 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1148 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1149 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1150 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1151 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1152 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
1153 ; GFX10-CU-NEXT: s_endpgm
1155 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
1156 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1157 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
1158 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1159 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1160 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1161 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1162 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1163 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1164 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
1165 ; SKIP-CACHE-INV-NEXT: s_endpgm
1167 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
1168 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1169 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1170 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1171 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1172 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1173 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1174 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1175 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1176 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1178 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
1179 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1180 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1181 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1182 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1183 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1184 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1185 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1186 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
1187 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1188 i32 addrspace(3)* %out, i32 %in) {
1190 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread") acq_rel
1191 store i32 %val, i32 addrspace(3)* %out, align 4
1195 define amdgpu_kernel void @local_singlethread_seq_cst_ret_atomicrmw(
1196 ; GFX6-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
1197 ; GFX6: ; %bb.0: ; %entry
1198 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
1199 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
1200 ; GFX6-NEXT: s_mov_b32 m0, -1
1201 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1202 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
1203 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1204 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1205 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1206 ; GFX6-NEXT: ds_write_b32 v0, v1
1207 ; GFX6-NEXT: s_endpgm
1209 ; GFX7-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
1210 ; GFX7: ; %bb.0: ; %entry
1211 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1212 ; GFX7-NEXT: s_mov_b32 m0, -1
1213 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1214 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1215 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1216 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1217 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1218 ; GFX7-NEXT: ds_write_b32 v0, v1
1219 ; GFX7-NEXT: s_endpgm
1221 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
1222 ; GFX10-WGP: ; %bb.0: ; %entry
1223 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1224 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1225 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1226 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1227 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1228 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1229 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
1230 ; GFX10-WGP-NEXT: s_endpgm
1232 ; GFX10-CU-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
1233 ; GFX10-CU: ; %bb.0: ; %entry
1234 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1235 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1236 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1237 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1238 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1239 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1240 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
1241 ; GFX10-CU-NEXT: s_endpgm
1243 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
1244 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1245 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
1246 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1247 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1248 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
1249 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
1250 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1251 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1252 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
1253 ; SKIP-CACHE-INV-NEXT: s_endpgm
1255 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
1256 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1257 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1258 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1259 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1260 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1261 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1262 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1263 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1264 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1266 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
1267 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1268 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1269 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1270 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1271 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
1272 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1273 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1274 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
1275 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1276 i32 addrspace(3)* %out, i32 %in) {
1278 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread") seq_cst
1279 store i32 %val, i32 addrspace(3)* %out, align 4
1283 define amdgpu_kernel void @local_singlethread_monotonic_monotonic_cmpxchg(
1284 ; GFX6-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
1285 ; GFX6: ; %bb.0: ; %entry
1286 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1287 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1288 ; GFX6-NEXT: s_mov_b32 m0, -1
1289 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1290 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1291 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1292 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1293 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1294 ; GFX6-NEXT: s_endpgm
1296 ; GFX7-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
1297 ; GFX7: ; %bb.0: ; %entry
1298 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1299 ; GFX7-NEXT: s_mov_b32 m0, -1
1300 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1301 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1302 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1303 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1304 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1305 ; GFX7-NEXT: s_endpgm
1307 ; GFX10-WGP-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
1308 ; GFX10-WGP: ; %bb.0: ; %entry
1309 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1310 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1311 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1312 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1313 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1314 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1315 ; GFX10-WGP-NEXT: s_endpgm
1317 ; GFX10-CU-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
1318 ; GFX10-CU: ; %bb.0: ; %entry
1319 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1320 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1321 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1322 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1323 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1324 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1325 ; GFX10-CU-NEXT: s_endpgm
1327 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
1328 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1329 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
1330 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
1331 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1332 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1333 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1334 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1335 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
1336 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1337 ; SKIP-CACHE-INV-NEXT: s_endpgm
1339 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
1340 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1341 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1342 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1343 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1344 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1345 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1346 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1347 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1349 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
1350 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1351 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1352 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1353 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1354 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1355 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1356 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1357 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1358 i32 addrspace(3)* %out, i32 %in, i32 %old) {
1360 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
1361 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") monotonic monotonic
1365 define amdgpu_kernel void @local_singlethread_acquire_monotonic_cmpxchg(
1366 ; GFX6-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
1367 ; GFX6: ; %bb.0: ; %entry
1368 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1369 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1370 ; GFX6-NEXT: s_mov_b32 m0, -1
1371 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1372 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1373 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1374 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1375 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1376 ; GFX6-NEXT: s_endpgm
1378 ; GFX7-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
1379 ; GFX7: ; %bb.0: ; %entry
1380 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1381 ; GFX7-NEXT: s_mov_b32 m0, -1
1382 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1383 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1384 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1385 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1386 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1387 ; GFX7-NEXT: s_endpgm
1389 ; GFX10-WGP-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
1390 ; GFX10-WGP: ; %bb.0: ; %entry
1391 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1392 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1393 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1394 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1395 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1396 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1397 ; GFX10-WGP-NEXT: s_endpgm
1399 ; GFX10-CU-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
1400 ; GFX10-CU: ; %bb.0: ; %entry
1401 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1402 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1403 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1404 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1405 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1406 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1407 ; GFX10-CU-NEXT: s_endpgm
1409 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
1410 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1411 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
1412 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
1413 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1414 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1415 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1416 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1417 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
1418 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1419 ; SKIP-CACHE-INV-NEXT: s_endpgm
1421 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
1422 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1423 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1424 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1425 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1426 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1427 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1428 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1429 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1431 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
1432 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1433 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1434 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1435 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1436 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1437 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1438 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1439 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1440 i32 addrspace(3)* %out, i32 %in, i32 %old) {
1442 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
1443 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acquire monotonic
1447 define amdgpu_kernel void @local_singlethread_release_monotonic_cmpxchg(
1448 ; GFX6-LABEL: local_singlethread_release_monotonic_cmpxchg:
1449 ; GFX6: ; %bb.0: ; %entry
1450 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1451 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1452 ; GFX6-NEXT: s_mov_b32 m0, -1
1453 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1454 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1455 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1456 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1457 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1458 ; GFX6-NEXT: s_endpgm
1460 ; GFX7-LABEL: local_singlethread_release_monotonic_cmpxchg:
1461 ; GFX7: ; %bb.0: ; %entry
1462 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1463 ; GFX7-NEXT: s_mov_b32 m0, -1
1464 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1465 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1466 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1467 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1468 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1469 ; GFX7-NEXT: s_endpgm
1471 ; GFX10-WGP-LABEL: local_singlethread_release_monotonic_cmpxchg:
1472 ; GFX10-WGP: ; %bb.0: ; %entry
1473 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1474 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1475 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1476 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1477 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1478 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1479 ; GFX10-WGP-NEXT: s_endpgm
1481 ; GFX10-CU-LABEL: local_singlethread_release_monotonic_cmpxchg:
1482 ; GFX10-CU: ; %bb.0: ; %entry
1483 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1484 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1485 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1486 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1487 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1488 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1489 ; GFX10-CU-NEXT: s_endpgm
1491 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_monotonic_cmpxchg:
1492 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1493 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
1494 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
1495 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1496 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1497 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1498 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1499 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
1500 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1501 ; SKIP-CACHE-INV-NEXT: s_endpgm
1503 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_monotonic_cmpxchg:
1504 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1505 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1506 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1507 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1508 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1509 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1510 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1511 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1513 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_monotonic_cmpxchg:
1514 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1515 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1516 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1517 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1518 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1519 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1520 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1521 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1522 i32 addrspace(3)* %out, i32 %in, i32 %old) {
1524 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
1525 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") release monotonic
1529 define amdgpu_kernel void @local_singlethread_acq_rel_monotonic_cmpxchg(
1530 ; GFX6-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
1531 ; GFX6: ; %bb.0: ; %entry
1532 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1533 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1534 ; GFX6-NEXT: s_mov_b32 m0, -1
1535 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1536 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1537 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1538 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1539 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1540 ; GFX6-NEXT: s_endpgm
1542 ; GFX7-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
1543 ; GFX7: ; %bb.0: ; %entry
1544 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1545 ; GFX7-NEXT: s_mov_b32 m0, -1
1546 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1547 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1548 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1549 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1550 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1551 ; GFX7-NEXT: s_endpgm
1553 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
1554 ; GFX10-WGP: ; %bb.0: ; %entry
1555 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1556 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1557 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1558 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1559 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1560 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1561 ; GFX10-WGP-NEXT: s_endpgm
1563 ; GFX10-CU-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
1564 ; GFX10-CU: ; %bb.0: ; %entry
1565 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1566 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1567 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1568 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1569 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1570 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1571 ; GFX10-CU-NEXT: s_endpgm
1573 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
1574 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1575 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
1576 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
1577 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1578 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1579 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1580 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1581 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
1582 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1583 ; SKIP-CACHE-INV-NEXT: s_endpgm
1585 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
1586 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1587 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1588 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1589 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1590 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1591 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1592 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1593 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1595 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
1596 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1597 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1598 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1599 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1600 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1601 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1602 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1603 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1604 i32 addrspace(3)* %out, i32 %in, i32 %old) {
1606 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
1607 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel monotonic
1611 define amdgpu_kernel void @local_singlethread_seq_cst_monotonic_cmpxchg(
1612 ; GFX6-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
1613 ; GFX6: ; %bb.0: ; %entry
1614 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1615 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1616 ; GFX6-NEXT: s_mov_b32 m0, -1
1617 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1618 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1619 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1620 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1621 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1622 ; GFX6-NEXT: s_endpgm
1624 ; GFX7-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
1625 ; GFX7: ; %bb.0: ; %entry
1626 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1627 ; GFX7-NEXT: s_mov_b32 m0, -1
1628 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1629 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1630 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1631 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1632 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1633 ; GFX7-NEXT: s_endpgm
1635 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
1636 ; GFX10-WGP: ; %bb.0: ; %entry
1637 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1638 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1639 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1640 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1641 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1642 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1643 ; GFX10-WGP-NEXT: s_endpgm
1645 ; GFX10-CU-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
1646 ; GFX10-CU: ; %bb.0: ; %entry
1647 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1648 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1649 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1650 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1651 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1652 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1653 ; GFX10-CU-NEXT: s_endpgm
1655 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
1656 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1657 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
1658 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
1659 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1660 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1661 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1662 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1663 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
1664 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1665 ; SKIP-CACHE-INV-NEXT: s_endpgm
1667 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
1668 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1669 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1670 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1671 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1672 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1673 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1674 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1675 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1677 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
1678 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1679 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1680 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1681 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1682 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1683 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1684 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1685 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1686 i32 addrspace(3)* %out, i32 %in, i32 %old) {
1688 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
1689 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst monotonic
1693 define amdgpu_kernel void @local_singlethread_monotonic_acquire_cmpxchg(
1694 ; GFX6-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
1695 ; GFX6: ; %bb.0: ; %entry
1696 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1697 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1698 ; GFX6-NEXT: s_mov_b32 m0, -1
1699 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1700 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1701 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1702 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1703 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1704 ; GFX6-NEXT: s_endpgm
1706 ; GFX7-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
1707 ; GFX7: ; %bb.0: ; %entry
1708 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1709 ; GFX7-NEXT: s_mov_b32 m0, -1
1710 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1711 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1712 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1713 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1714 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1715 ; GFX7-NEXT: s_endpgm
1717 ; GFX10-WGP-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
1718 ; GFX10-WGP: ; %bb.0: ; %entry
1719 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1720 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1721 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1722 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1723 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1724 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1725 ; GFX10-WGP-NEXT: s_endpgm
1727 ; GFX10-CU-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
1728 ; GFX10-CU: ; %bb.0: ; %entry
1729 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1730 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1731 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1732 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1733 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1734 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1735 ; GFX10-CU-NEXT: s_endpgm
1737 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
1738 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1739 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
1740 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
1741 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1742 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1743 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1744 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1745 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
1746 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1747 ; SKIP-CACHE-INV-NEXT: s_endpgm
1749 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
1750 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1751 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1752 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1753 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1754 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1755 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1756 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1757 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1759 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
1760 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1761 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1762 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1763 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1764 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1765 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1766 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1767 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1768 i32 addrspace(3)* %out, i32 %in, i32 %old) {
1770 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
1771 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") monotonic acquire
1775 define amdgpu_kernel void @local_singlethread_acquire_acquire_cmpxchg(
1776 ; GFX6-LABEL: local_singlethread_acquire_acquire_cmpxchg:
1777 ; GFX6: ; %bb.0: ; %entry
1778 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1779 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1780 ; GFX6-NEXT: s_mov_b32 m0, -1
1781 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1782 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1783 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1784 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1785 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1786 ; GFX6-NEXT: s_endpgm
1788 ; GFX7-LABEL: local_singlethread_acquire_acquire_cmpxchg:
1789 ; GFX7: ; %bb.0: ; %entry
1790 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1791 ; GFX7-NEXT: s_mov_b32 m0, -1
1792 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1793 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1794 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1795 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1796 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1797 ; GFX7-NEXT: s_endpgm
1799 ; GFX10-WGP-LABEL: local_singlethread_acquire_acquire_cmpxchg:
1800 ; GFX10-WGP: ; %bb.0: ; %entry
1801 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1802 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1803 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1804 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1805 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1806 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1807 ; GFX10-WGP-NEXT: s_endpgm
1809 ; GFX10-CU-LABEL: local_singlethread_acquire_acquire_cmpxchg:
1810 ; GFX10-CU: ; %bb.0: ; %entry
1811 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1812 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1813 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1814 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1815 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1816 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1817 ; GFX10-CU-NEXT: s_endpgm
1819 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_acquire_cmpxchg:
1820 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1821 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
1822 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
1823 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1824 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1825 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1826 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1827 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
1828 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1829 ; SKIP-CACHE-INV-NEXT: s_endpgm
1831 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_acquire_cmpxchg:
1832 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1833 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1834 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1835 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1836 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1837 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1838 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1839 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1841 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_acquire_cmpxchg:
1842 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1843 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1844 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1845 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1846 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1847 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1848 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1849 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1850 i32 addrspace(3)* %out, i32 %in, i32 %old) {
1852 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
1853 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acquire acquire
1857 define amdgpu_kernel void @local_singlethread_release_acquire_cmpxchg(
1858 ; GFX6-LABEL: local_singlethread_release_acquire_cmpxchg:
1859 ; GFX6: ; %bb.0: ; %entry
1860 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1861 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1862 ; GFX6-NEXT: s_mov_b32 m0, -1
1863 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1864 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1865 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1866 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1867 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1868 ; GFX6-NEXT: s_endpgm
1870 ; GFX7-LABEL: local_singlethread_release_acquire_cmpxchg:
1871 ; GFX7: ; %bb.0: ; %entry
1872 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1873 ; GFX7-NEXT: s_mov_b32 m0, -1
1874 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1875 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1876 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1877 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1878 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1879 ; GFX7-NEXT: s_endpgm
1881 ; GFX10-WGP-LABEL: local_singlethread_release_acquire_cmpxchg:
1882 ; GFX10-WGP: ; %bb.0: ; %entry
1883 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1884 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1885 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1886 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1887 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1888 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1889 ; GFX10-WGP-NEXT: s_endpgm
1891 ; GFX10-CU-LABEL: local_singlethread_release_acquire_cmpxchg:
1892 ; GFX10-CU: ; %bb.0: ; %entry
1893 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1894 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1895 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1896 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1897 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1898 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1899 ; GFX10-CU-NEXT: s_endpgm
1901 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_acquire_cmpxchg:
1902 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1903 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
1904 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
1905 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1906 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1907 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1908 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1909 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
1910 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1911 ; SKIP-CACHE-INV-NEXT: s_endpgm
1913 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_acquire_cmpxchg:
1914 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1915 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1916 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1917 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1918 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1919 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1920 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1921 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1923 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_acquire_cmpxchg:
1924 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1925 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1926 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1927 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
1928 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1929 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
1930 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1931 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1932 i32 addrspace(3)* %out, i32 %in, i32 %old) {
1934 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
1935 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") release acquire
1939 define amdgpu_kernel void @local_singlethread_acq_rel_acquire_cmpxchg(
1940 ; GFX6-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
1941 ; GFX6: ; %bb.0: ; %entry
1942 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
1943 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
1944 ; GFX6-NEXT: s_mov_b32 m0, -1
1945 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1946 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
1947 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
1948 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
1949 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1950 ; GFX6-NEXT: s_endpgm
1952 ; GFX7-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
1953 ; GFX7: ; %bb.0: ; %entry
1954 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1955 ; GFX7-NEXT: s_mov_b32 m0, -1
1956 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1957 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1958 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
1959 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
1960 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1961 ; GFX7-NEXT: s_endpgm
1963 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
1964 ; GFX10-WGP: ; %bb.0: ; %entry
1965 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1966 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1967 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1968 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1969 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
1970 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1971 ; GFX10-WGP-NEXT: s_endpgm
1973 ; GFX10-CU-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
1974 ; GFX10-CU: ; %bb.0: ; %entry
1975 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1976 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1977 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1978 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1979 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
1980 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1981 ; GFX10-CU-NEXT: s_endpgm
1983 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
1984 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1985 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
1986 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
1987 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1988 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1989 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1990 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1991 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
1992 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
1993 ; SKIP-CACHE-INV-NEXT: s_endpgm
1995 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
1996 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1997 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
1998 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1999 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2000 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2001 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2002 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2003 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2005 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
2006 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2007 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2008 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2009 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2010 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2011 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2012 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2013 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2014 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2016 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2017 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel acquire
2021 define amdgpu_kernel void @local_singlethread_seq_cst_acquire_cmpxchg(
2022 ; GFX6-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
2023 ; GFX6: ; %bb.0: ; %entry
2024 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2025 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2026 ; GFX6-NEXT: s_mov_b32 m0, -1
2027 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2028 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2029 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2030 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2031 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2032 ; GFX6-NEXT: s_endpgm
2034 ; GFX7-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
2035 ; GFX7: ; %bb.0: ; %entry
2036 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2037 ; GFX7-NEXT: s_mov_b32 m0, -1
2038 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2039 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2040 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2041 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2042 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2043 ; GFX7-NEXT: s_endpgm
2045 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
2046 ; GFX10-WGP: ; %bb.0: ; %entry
2047 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2048 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2049 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2050 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2051 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2052 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2053 ; GFX10-WGP-NEXT: s_endpgm
2055 ; GFX10-CU-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
2056 ; GFX10-CU: ; %bb.0: ; %entry
2057 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2058 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2059 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2060 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2061 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2062 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2063 ; GFX10-CU-NEXT: s_endpgm
2065 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
2066 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2067 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2068 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2069 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2070 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2071 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2072 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2073 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2074 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2075 ; SKIP-CACHE-INV-NEXT: s_endpgm
2077 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
2078 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2079 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2080 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2081 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2082 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2083 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2084 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2085 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2087 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
2088 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2089 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2090 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2091 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2092 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2093 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2094 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2095 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2096 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2098 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2099 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst acquire
2103 define amdgpu_kernel void @local_singlethread_monotonic_seq_cst_cmpxchg(
2104 ; GFX6-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
2105 ; GFX6: ; %bb.0: ; %entry
2106 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2107 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2108 ; GFX6-NEXT: s_mov_b32 m0, -1
2109 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2110 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2111 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2112 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2113 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2114 ; GFX6-NEXT: s_endpgm
2116 ; GFX7-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
2117 ; GFX7: ; %bb.0: ; %entry
2118 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2119 ; GFX7-NEXT: s_mov_b32 m0, -1
2120 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2121 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2122 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2123 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2124 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2125 ; GFX7-NEXT: s_endpgm
2127 ; GFX10-WGP-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
2128 ; GFX10-WGP: ; %bb.0: ; %entry
2129 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2130 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2131 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2132 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2133 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2134 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2135 ; GFX10-WGP-NEXT: s_endpgm
2137 ; GFX10-CU-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
2138 ; GFX10-CU: ; %bb.0: ; %entry
2139 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2140 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2141 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2142 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2143 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2144 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2145 ; GFX10-CU-NEXT: s_endpgm
2147 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
2148 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2149 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2150 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2151 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2152 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2153 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2154 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2155 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2156 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2157 ; SKIP-CACHE-INV-NEXT: s_endpgm
2159 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
2160 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2161 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2162 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2163 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2164 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2165 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2166 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2167 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2169 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
2170 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2171 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2172 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2173 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2174 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2175 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2176 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2177 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2178 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2180 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2181 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") monotonic seq_cst
2185 define amdgpu_kernel void @local_singlethread_acquire_seq_cst_cmpxchg(
2186 ; GFX6-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
2187 ; GFX6: ; %bb.0: ; %entry
2188 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2189 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2190 ; GFX6-NEXT: s_mov_b32 m0, -1
2191 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2192 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2193 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2194 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2195 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2196 ; GFX6-NEXT: s_endpgm
2198 ; GFX7-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
2199 ; GFX7: ; %bb.0: ; %entry
2200 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2201 ; GFX7-NEXT: s_mov_b32 m0, -1
2202 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2203 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2204 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2205 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2206 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2207 ; GFX7-NEXT: s_endpgm
2209 ; GFX10-WGP-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
2210 ; GFX10-WGP: ; %bb.0: ; %entry
2211 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2212 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2213 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2214 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2215 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2216 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2217 ; GFX10-WGP-NEXT: s_endpgm
2219 ; GFX10-CU-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
2220 ; GFX10-CU: ; %bb.0: ; %entry
2221 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2222 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2223 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2224 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2225 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2226 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2227 ; GFX10-CU-NEXT: s_endpgm
2229 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
2230 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2231 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2232 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2233 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2234 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2235 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2236 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2237 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2238 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2239 ; SKIP-CACHE-INV-NEXT: s_endpgm
2241 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
2242 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2243 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2244 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2245 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2246 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2247 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2248 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2249 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2251 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
2252 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2253 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2254 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2255 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2256 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2257 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2258 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2259 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2260 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2262 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2263 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acquire seq_cst
2267 define amdgpu_kernel void @local_singlethread_release_seq_cst_cmpxchg(
2268 ; GFX6-LABEL: local_singlethread_release_seq_cst_cmpxchg:
2269 ; GFX6: ; %bb.0: ; %entry
2270 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2271 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2272 ; GFX6-NEXT: s_mov_b32 m0, -1
2273 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2274 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2275 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2276 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2277 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2278 ; GFX6-NEXT: s_endpgm
2280 ; GFX7-LABEL: local_singlethread_release_seq_cst_cmpxchg:
2281 ; GFX7: ; %bb.0: ; %entry
2282 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2283 ; GFX7-NEXT: s_mov_b32 m0, -1
2284 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2285 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2286 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2287 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2288 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2289 ; GFX7-NEXT: s_endpgm
2291 ; GFX10-WGP-LABEL: local_singlethread_release_seq_cst_cmpxchg:
2292 ; GFX10-WGP: ; %bb.0: ; %entry
2293 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2294 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2295 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2296 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2297 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2298 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2299 ; GFX10-WGP-NEXT: s_endpgm
2301 ; GFX10-CU-LABEL: local_singlethread_release_seq_cst_cmpxchg:
2302 ; GFX10-CU: ; %bb.0: ; %entry
2303 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2304 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2305 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2306 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2307 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2308 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2309 ; GFX10-CU-NEXT: s_endpgm
2311 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_seq_cst_cmpxchg:
2312 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2313 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2314 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2315 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2316 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2317 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2318 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2319 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2320 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2321 ; SKIP-CACHE-INV-NEXT: s_endpgm
2323 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_seq_cst_cmpxchg:
2324 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2325 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2326 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2327 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2328 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2329 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2330 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2331 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2333 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_seq_cst_cmpxchg:
2334 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2335 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2336 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2337 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2338 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2339 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2340 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2341 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2342 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2344 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2345 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") release seq_cst
2349 define amdgpu_kernel void @local_singlethread_acq_rel_seq_cst_cmpxchg(
2350 ; GFX6-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
2351 ; GFX6: ; %bb.0: ; %entry
2352 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2353 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2354 ; GFX6-NEXT: s_mov_b32 m0, -1
2355 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2356 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2357 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2358 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2359 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2360 ; GFX6-NEXT: s_endpgm
2362 ; GFX7-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
2363 ; GFX7: ; %bb.0: ; %entry
2364 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2365 ; GFX7-NEXT: s_mov_b32 m0, -1
2366 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2367 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2368 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2369 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2370 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2371 ; GFX7-NEXT: s_endpgm
2373 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
2374 ; GFX10-WGP: ; %bb.0: ; %entry
2375 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2376 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2377 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2378 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2379 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2380 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2381 ; GFX10-WGP-NEXT: s_endpgm
2383 ; GFX10-CU-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
2384 ; GFX10-CU: ; %bb.0: ; %entry
2385 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2386 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2387 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2388 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2389 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2390 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2391 ; GFX10-CU-NEXT: s_endpgm
2393 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
2394 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2395 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2396 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2397 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2398 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2399 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2400 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2401 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2402 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2403 ; SKIP-CACHE-INV-NEXT: s_endpgm
2405 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
2406 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2407 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2408 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2409 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2410 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2411 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2412 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2413 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2415 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
2416 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2417 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2418 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2419 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2420 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2421 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2422 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2423 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2424 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2426 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2427 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel seq_cst
2431 define amdgpu_kernel void @local_singlethread_seq_cst_seq_cst_cmpxchg(
2432 ; GFX6-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
2433 ; GFX6: ; %bb.0: ; %entry
2434 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2435 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2436 ; GFX6-NEXT: s_mov_b32 m0, -1
2437 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2438 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2439 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2440 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2441 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2442 ; GFX6-NEXT: s_endpgm
2444 ; GFX7-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
2445 ; GFX7: ; %bb.0: ; %entry
2446 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2447 ; GFX7-NEXT: s_mov_b32 m0, -1
2448 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2449 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2450 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2451 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2452 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2453 ; GFX7-NEXT: s_endpgm
2455 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
2456 ; GFX10-WGP: ; %bb.0: ; %entry
2457 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2458 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2459 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2460 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2461 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2462 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2463 ; GFX10-WGP-NEXT: s_endpgm
2465 ; GFX10-CU-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
2466 ; GFX10-CU: ; %bb.0: ; %entry
2467 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2468 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2469 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2470 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2471 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2472 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2473 ; GFX10-CU-NEXT: s_endpgm
2475 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
2476 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2477 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2478 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2479 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2480 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2481 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2482 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2483 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2484 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2485 ; SKIP-CACHE-INV-NEXT: s_endpgm
2487 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
2488 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2489 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2490 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2491 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2492 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2493 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2494 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2495 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2497 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
2498 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2499 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2500 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2501 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2502 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2503 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2504 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2505 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2506 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2508 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2509 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst seq_cst
2513 define amdgpu_kernel void @local_singlethread_monotonic_monotonic_ret_cmpxchg(
2514 ; GFX6-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
2515 ; GFX6: ; %bb.0: ; %entry
2516 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2517 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2518 ; GFX6-NEXT: s_mov_b32 m0, -1
2519 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2520 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2521 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2522 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2523 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2524 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2525 ; GFX6-NEXT: ds_write_b32 v0, v1
2526 ; GFX6-NEXT: s_endpgm
2528 ; GFX7-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
2529 ; GFX7: ; %bb.0: ; %entry
2530 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2531 ; GFX7-NEXT: s_mov_b32 m0, -1
2532 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2533 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2534 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2535 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2536 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2537 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2538 ; GFX7-NEXT: ds_write_b32 v0, v1
2539 ; GFX7-NEXT: s_endpgm
2541 ; GFX10-WGP-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
2542 ; GFX10-WGP: ; %bb.0: ; %entry
2543 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2544 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2545 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2546 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2547 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2548 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2549 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2550 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
2551 ; GFX10-WGP-NEXT: s_endpgm
2553 ; GFX10-CU-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
2554 ; GFX10-CU: ; %bb.0: ; %entry
2555 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2556 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2557 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2558 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2559 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2560 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2561 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2562 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
2563 ; GFX10-CU-NEXT: s_endpgm
2565 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
2566 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2567 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2568 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2569 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2570 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2571 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2572 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2573 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2574 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2575 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2576 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
2577 ; SKIP-CACHE-INV-NEXT: s_endpgm
2579 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
2580 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2581 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2582 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2583 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2584 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2585 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2586 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2587 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2588 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2589 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2591 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
2592 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2593 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2594 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2595 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2596 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2597 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2598 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2599 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2600 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
2601 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2602 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2604 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2605 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") monotonic monotonic
2606 %val0 = extractvalue { i32, i1 } %val, 0
2607 store i32 %val0, i32 addrspace(3)* %out, align 4
2611 define amdgpu_kernel void @local_singlethread_acquire_monotonic_ret_cmpxchg(
2612 ; GFX6-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
2613 ; GFX6: ; %bb.0: ; %entry
2614 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2615 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2616 ; GFX6-NEXT: s_mov_b32 m0, -1
2617 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2618 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2619 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2620 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2621 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2622 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2623 ; GFX6-NEXT: ds_write_b32 v0, v1
2624 ; GFX6-NEXT: s_endpgm
2626 ; GFX7-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
2627 ; GFX7: ; %bb.0: ; %entry
2628 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2629 ; GFX7-NEXT: s_mov_b32 m0, -1
2630 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2631 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2632 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2633 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2634 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2635 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2636 ; GFX7-NEXT: ds_write_b32 v0, v1
2637 ; GFX7-NEXT: s_endpgm
2639 ; GFX10-WGP-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
2640 ; GFX10-WGP: ; %bb.0: ; %entry
2641 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2642 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2643 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2644 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2645 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2646 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2647 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2648 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
2649 ; GFX10-WGP-NEXT: s_endpgm
2651 ; GFX10-CU-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
2652 ; GFX10-CU: ; %bb.0: ; %entry
2653 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2654 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2655 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2656 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2657 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2658 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2659 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2660 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
2661 ; GFX10-CU-NEXT: s_endpgm
2663 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
2664 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2665 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2666 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2667 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2668 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2669 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2670 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2671 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2672 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2673 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2674 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
2675 ; SKIP-CACHE-INV-NEXT: s_endpgm
2677 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
2678 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2679 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2680 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2681 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2682 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2683 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2684 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2685 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2686 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2687 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2689 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
2690 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2691 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2692 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2693 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2694 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2695 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2696 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2697 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2698 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
2699 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2700 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2702 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2703 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acquire monotonic
2704 %val0 = extractvalue { i32, i1 } %val, 0
2705 store i32 %val0, i32 addrspace(3)* %out, align 4
2709 define amdgpu_kernel void @local_singlethread_release_monotonic_ret_cmpxchg(
2710 ; GFX6-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
2711 ; GFX6: ; %bb.0: ; %entry
2712 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2713 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2714 ; GFX6-NEXT: s_mov_b32 m0, -1
2715 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2716 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2717 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2718 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2719 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2720 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2721 ; GFX6-NEXT: ds_write_b32 v0, v1
2722 ; GFX6-NEXT: s_endpgm
2724 ; GFX7-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
2725 ; GFX7: ; %bb.0: ; %entry
2726 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2727 ; GFX7-NEXT: s_mov_b32 m0, -1
2728 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2729 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2730 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2731 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2732 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2733 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2734 ; GFX7-NEXT: ds_write_b32 v0, v1
2735 ; GFX7-NEXT: s_endpgm
2737 ; GFX10-WGP-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
2738 ; GFX10-WGP: ; %bb.0: ; %entry
2739 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2740 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2741 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2742 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2743 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2744 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2745 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2746 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
2747 ; GFX10-WGP-NEXT: s_endpgm
2749 ; GFX10-CU-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
2750 ; GFX10-CU: ; %bb.0: ; %entry
2751 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2752 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2753 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2754 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2755 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2756 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2757 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2758 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
2759 ; GFX10-CU-NEXT: s_endpgm
2761 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
2762 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2763 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2764 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2765 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2766 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2767 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2768 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2769 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2770 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2771 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2772 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
2773 ; SKIP-CACHE-INV-NEXT: s_endpgm
2775 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
2776 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2777 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2778 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2779 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2780 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2781 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2782 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2783 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2784 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2785 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2787 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
2788 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2789 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2790 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2791 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2792 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2793 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2794 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2795 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2796 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
2797 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2798 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2800 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2801 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") release monotonic
2802 %val0 = extractvalue { i32, i1 } %val, 0
2803 store i32 %val0, i32 addrspace(3)* %out, align 4
2807 define amdgpu_kernel void @local_singlethread_acq_rel_monotonic_ret_cmpxchg(
2808 ; GFX6-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
2809 ; GFX6: ; %bb.0: ; %entry
2810 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2811 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2812 ; GFX6-NEXT: s_mov_b32 m0, -1
2813 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2814 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2815 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2816 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2817 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2818 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2819 ; GFX6-NEXT: ds_write_b32 v0, v1
2820 ; GFX6-NEXT: s_endpgm
2822 ; GFX7-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
2823 ; GFX7: ; %bb.0: ; %entry
2824 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2825 ; GFX7-NEXT: s_mov_b32 m0, -1
2826 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2827 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2828 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2829 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2830 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2831 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2832 ; GFX7-NEXT: ds_write_b32 v0, v1
2833 ; GFX7-NEXT: s_endpgm
2835 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
2836 ; GFX10-WGP: ; %bb.0: ; %entry
2837 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2838 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2839 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2840 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2841 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2842 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2843 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2844 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
2845 ; GFX10-WGP-NEXT: s_endpgm
2847 ; GFX10-CU-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
2848 ; GFX10-CU: ; %bb.0: ; %entry
2849 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2850 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2851 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2852 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2853 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2854 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2855 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2856 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
2857 ; GFX10-CU-NEXT: s_endpgm
2859 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
2860 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2861 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2862 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2863 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2864 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2865 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2866 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2867 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2868 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2869 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2870 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
2871 ; SKIP-CACHE-INV-NEXT: s_endpgm
2873 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
2874 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2875 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2876 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2877 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2878 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2879 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2880 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2881 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2882 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2883 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2885 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
2886 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2887 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2888 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2889 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2890 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2891 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2892 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2893 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2894 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
2895 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2896 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2898 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2899 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel monotonic
2900 %val0 = extractvalue { i32, i1 } %val, 0
2901 store i32 %val0, i32 addrspace(3)* %out, align 4
2905 define amdgpu_kernel void @local_singlethread_seq_cst_monotonic_ret_cmpxchg(
2906 ; GFX6-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
2907 ; GFX6: ; %bb.0: ; %entry
2908 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
2909 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
2910 ; GFX6-NEXT: s_mov_b32 m0, -1
2911 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2912 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2913 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
2914 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
2915 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2916 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2917 ; GFX6-NEXT: ds_write_b32 v0, v1
2918 ; GFX6-NEXT: s_endpgm
2920 ; GFX7-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
2921 ; GFX7: ; %bb.0: ; %entry
2922 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2923 ; GFX7-NEXT: s_mov_b32 m0, -1
2924 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2925 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2926 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
2927 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
2928 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2929 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2930 ; GFX7-NEXT: ds_write_b32 v0, v1
2931 ; GFX7-NEXT: s_endpgm
2933 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
2934 ; GFX10-WGP: ; %bb.0: ; %entry
2935 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2936 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2937 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2938 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2939 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
2940 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2941 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2942 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
2943 ; GFX10-WGP-NEXT: s_endpgm
2945 ; GFX10-CU-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
2946 ; GFX10-CU: ; %bb.0: ; %entry
2947 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2948 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2949 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2950 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2951 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
2952 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2953 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2954 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
2955 ; GFX10-CU-NEXT: s_endpgm
2957 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
2958 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2959 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
2960 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
2961 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2962 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2963 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2964 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
2965 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
2966 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2967 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2968 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
2969 ; SKIP-CACHE-INV-NEXT: s_endpgm
2971 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
2972 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2973 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2974 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2975 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2976 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2977 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2978 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2979 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2980 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2981 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2983 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
2984 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2985 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2986 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2987 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2988 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2989 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
2990 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
2991 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2992 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
2993 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2994 i32 addrspace(3)* %out, i32 %in, i32 %old) {
2996 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
2997 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst monotonic
2998 %val0 = extractvalue { i32, i1 } %val, 0
2999 store i32 %val0, i32 addrspace(3)* %out, align 4
3003 define amdgpu_kernel void @local_singlethread_monotonic_acquire_ret_cmpxchg(
3004 ; GFX6-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
3005 ; GFX6: ; %bb.0: ; %entry
3006 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3007 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3008 ; GFX6-NEXT: s_mov_b32 m0, -1
3009 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3010 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3011 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3012 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3013 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3014 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3015 ; GFX6-NEXT: ds_write_b32 v0, v1
3016 ; GFX6-NEXT: s_endpgm
3018 ; GFX7-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
3019 ; GFX7: ; %bb.0: ; %entry
3020 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3021 ; GFX7-NEXT: s_mov_b32 m0, -1
3022 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3023 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3024 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3025 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3026 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3027 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3028 ; GFX7-NEXT: ds_write_b32 v0, v1
3029 ; GFX7-NEXT: s_endpgm
3031 ; GFX10-WGP-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
3032 ; GFX10-WGP: ; %bb.0: ; %entry
3033 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3034 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3035 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3036 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3037 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3038 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3039 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3040 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3041 ; GFX10-WGP-NEXT: s_endpgm
3043 ; GFX10-CU-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
3044 ; GFX10-CU: ; %bb.0: ; %entry
3045 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3046 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3047 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3048 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3049 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3050 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3051 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3052 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3053 ; GFX10-CU-NEXT: s_endpgm
3055 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
3056 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3057 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3058 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3059 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3060 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3061 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3062 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3063 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3064 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3065 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3066 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3067 ; SKIP-CACHE-INV-NEXT: s_endpgm
3069 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
3070 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3071 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3072 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3073 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3074 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3075 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3076 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3077 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3078 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3079 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3081 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
3082 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3083 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3084 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3085 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3086 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3087 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3088 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3089 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3090 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3091 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3092 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3094 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3095 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") monotonic acquire
3096 %val0 = extractvalue { i32, i1 } %val, 0
3097 store i32 %val0, i32 addrspace(3)* %out, align 4
3101 define amdgpu_kernel void @local_singlethread_acquire_acquire_ret_cmpxchg(
3102 ; GFX6-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
3103 ; GFX6: ; %bb.0: ; %entry
3104 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3105 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3106 ; GFX6-NEXT: s_mov_b32 m0, -1
3107 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3108 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3109 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3110 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3111 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3112 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3113 ; GFX6-NEXT: ds_write_b32 v0, v1
3114 ; GFX6-NEXT: s_endpgm
3116 ; GFX7-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
3117 ; GFX7: ; %bb.0: ; %entry
3118 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3119 ; GFX7-NEXT: s_mov_b32 m0, -1
3120 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3121 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3122 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3123 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3124 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3125 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3126 ; GFX7-NEXT: ds_write_b32 v0, v1
3127 ; GFX7-NEXT: s_endpgm
3129 ; GFX10-WGP-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
3130 ; GFX10-WGP: ; %bb.0: ; %entry
3131 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3132 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3133 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3134 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3135 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3136 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3137 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3138 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3139 ; GFX10-WGP-NEXT: s_endpgm
3141 ; GFX10-CU-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
3142 ; GFX10-CU: ; %bb.0: ; %entry
3143 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3144 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3145 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3146 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3147 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3148 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3149 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3150 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3151 ; GFX10-CU-NEXT: s_endpgm
3153 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
3154 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3155 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3156 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3157 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3158 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3159 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3160 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3161 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3162 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3163 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3164 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3165 ; SKIP-CACHE-INV-NEXT: s_endpgm
3167 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
3168 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3169 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3170 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3171 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3172 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3173 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3174 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3175 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3176 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3177 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3179 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
3180 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3181 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3182 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3183 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3184 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3185 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3186 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3187 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3188 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3189 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3190 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3192 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3193 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acquire acquire
3194 %val0 = extractvalue { i32, i1 } %val, 0
3195 store i32 %val0, i32 addrspace(3)* %out, align 4
3199 define amdgpu_kernel void @local_singlethread_release_acquire_ret_cmpxchg(
3200 ; GFX6-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
3201 ; GFX6: ; %bb.0: ; %entry
3202 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3203 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3204 ; GFX6-NEXT: s_mov_b32 m0, -1
3205 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3206 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3207 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3208 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3209 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3210 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3211 ; GFX6-NEXT: ds_write_b32 v0, v1
3212 ; GFX6-NEXT: s_endpgm
3214 ; GFX7-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
3215 ; GFX7: ; %bb.0: ; %entry
3216 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3217 ; GFX7-NEXT: s_mov_b32 m0, -1
3218 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3219 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3220 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3221 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3222 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3223 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3224 ; GFX7-NEXT: ds_write_b32 v0, v1
3225 ; GFX7-NEXT: s_endpgm
3227 ; GFX10-WGP-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
3228 ; GFX10-WGP: ; %bb.0: ; %entry
3229 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3230 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3231 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3232 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3233 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3234 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3235 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3236 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3237 ; GFX10-WGP-NEXT: s_endpgm
3239 ; GFX10-CU-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
3240 ; GFX10-CU: ; %bb.0: ; %entry
3241 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3242 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3243 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3244 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3245 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3246 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3247 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3248 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3249 ; GFX10-CU-NEXT: s_endpgm
3251 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
3252 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3253 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3254 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3255 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3256 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3257 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3258 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3259 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3260 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3261 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3262 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3263 ; SKIP-CACHE-INV-NEXT: s_endpgm
3265 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
3266 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3267 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3268 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3269 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3270 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3271 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3272 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3273 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3274 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3275 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3277 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
3278 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3279 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3280 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3281 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3282 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3283 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3284 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3285 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3286 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3287 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3288 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3290 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3291 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") release acquire
3292 %val0 = extractvalue { i32, i1 } %val, 0
3293 store i32 %val0, i32 addrspace(3)* %out, align 4
3297 define amdgpu_kernel void @local_singlethread_acq_rel_acquire_ret_cmpxchg(
3298 ; GFX6-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
3299 ; GFX6: ; %bb.0: ; %entry
3300 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3301 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3302 ; GFX6-NEXT: s_mov_b32 m0, -1
3303 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3304 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3305 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3306 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3307 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3308 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3309 ; GFX6-NEXT: ds_write_b32 v0, v1
3310 ; GFX6-NEXT: s_endpgm
3312 ; GFX7-LABEL: local_singlethread_acq_rel_acquire_ret_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_rtn_b32 v1, v0, v1, v2 offset:16
3321 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3322 ; GFX7-NEXT: ds_write_b32 v0, v1
3323 ; GFX7-NEXT: s_endpgm
3325 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
3326 ; GFX10-WGP: ; %bb.0: ; %entry
3327 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3328 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3329 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3330 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3331 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3332 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3333 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3334 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3335 ; GFX10-WGP-NEXT: s_endpgm
3337 ; GFX10-CU-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
3338 ; GFX10-CU: ; %bb.0: ; %entry
3339 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3340 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3341 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3342 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3343 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3344 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3345 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3346 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3347 ; GFX10-CU-NEXT: s_endpgm
3349 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
3350 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3351 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3352 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3353 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3354 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3355 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3356 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3357 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3358 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3359 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3360 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3361 ; SKIP-CACHE-INV-NEXT: s_endpgm
3363 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
3364 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3365 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3366 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3367 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3368 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3369 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3370 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3371 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3372 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3373 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3375 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
3376 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3377 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3378 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3379 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3380 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3381 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3382 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3383 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3384 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3385 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3386 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3388 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3389 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel acquire
3390 %val0 = extractvalue { i32, i1 } %val, 0
3391 store i32 %val0, i32 addrspace(3)* %out, align 4
3395 define amdgpu_kernel void @local_singlethread_seq_cst_acquire_ret_cmpxchg(
3396 ; GFX6-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
3397 ; GFX6: ; %bb.0: ; %entry
3398 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3399 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3400 ; GFX6-NEXT: s_mov_b32 m0, -1
3401 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3402 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3403 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3404 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3405 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3406 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3407 ; GFX6-NEXT: ds_write_b32 v0, v1
3408 ; GFX6-NEXT: s_endpgm
3410 ; GFX7-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
3411 ; GFX7: ; %bb.0: ; %entry
3412 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3413 ; GFX7-NEXT: s_mov_b32 m0, -1
3414 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3415 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3416 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3417 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3418 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3419 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3420 ; GFX7-NEXT: ds_write_b32 v0, v1
3421 ; GFX7-NEXT: s_endpgm
3423 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
3424 ; GFX10-WGP: ; %bb.0: ; %entry
3425 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3426 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3427 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3428 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3429 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3430 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3431 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3432 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3433 ; GFX10-WGP-NEXT: s_endpgm
3435 ; GFX10-CU-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
3436 ; GFX10-CU: ; %bb.0: ; %entry
3437 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3438 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3439 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3440 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3441 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3442 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3443 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3444 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3445 ; GFX10-CU-NEXT: s_endpgm
3447 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
3448 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3449 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3450 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3451 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3452 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3453 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3454 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3455 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3456 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3457 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3458 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3459 ; SKIP-CACHE-INV-NEXT: s_endpgm
3461 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
3462 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3463 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3464 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3465 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3466 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3467 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3468 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3469 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3470 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3471 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3473 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
3474 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3475 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3476 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3477 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3478 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3479 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3480 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3481 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3482 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3483 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3484 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3486 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3487 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst acquire
3488 %val0 = extractvalue { i32, i1 } %val, 0
3489 store i32 %val0, i32 addrspace(3)* %out, align 4
3493 define amdgpu_kernel void @local_singlethread_monotonic_seq_cst_ret_cmpxchg(
3494 ; GFX6-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
3495 ; GFX6: ; %bb.0: ; %entry
3496 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3497 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3498 ; GFX6-NEXT: s_mov_b32 m0, -1
3499 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3500 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3501 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3502 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3503 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3504 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3505 ; GFX6-NEXT: ds_write_b32 v0, v1
3506 ; GFX6-NEXT: s_endpgm
3508 ; GFX7-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
3509 ; GFX7: ; %bb.0: ; %entry
3510 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3511 ; GFX7-NEXT: s_mov_b32 m0, -1
3512 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3513 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3514 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3515 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3516 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3517 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3518 ; GFX7-NEXT: ds_write_b32 v0, v1
3519 ; GFX7-NEXT: s_endpgm
3521 ; GFX10-WGP-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
3522 ; GFX10-WGP: ; %bb.0: ; %entry
3523 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3524 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3525 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3526 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3527 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3528 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3529 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3530 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3531 ; GFX10-WGP-NEXT: s_endpgm
3533 ; GFX10-CU-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
3534 ; GFX10-CU: ; %bb.0: ; %entry
3535 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3536 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3537 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3538 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3539 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3540 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3541 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3542 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3543 ; GFX10-CU-NEXT: s_endpgm
3545 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
3546 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3547 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3548 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3549 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3550 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3551 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3552 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3553 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3554 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3555 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3556 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3557 ; SKIP-CACHE-INV-NEXT: s_endpgm
3559 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
3560 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3561 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3562 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3563 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3564 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3565 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3566 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3567 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3568 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3569 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3571 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
3572 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3573 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3574 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3575 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3576 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3577 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3578 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3579 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3580 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3581 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3582 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3584 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3585 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") monotonic seq_cst
3586 %val0 = extractvalue { i32, i1 } %val, 0
3587 store i32 %val0, i32 addrspace(3)* %out, align 4
3591 define amdgpu_kernel void @local_singlethread_acquire_seq_cst_ret_cmpxchg(
3592 ; GFX6-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
3593 ; GFX6: ; %bb.0: ; %entry
3594 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3595 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3596 ; GFX6-NEXT: s_mov_b32 m0, -1
3597 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3598 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3599 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3600 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3601 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3602 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3603 ; GFX6-NEXT: ds_write_b32 v0, v1
3604 ; GFX6-NEXT: s_endpgm
3606 ; GFX7-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
3607 ; GFX7: ; %bb.0: ; %entry
3608 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3609 ; GFX7-NEXT: s_mov_b32 m0, -1
3610 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3611 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3612 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3613 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3614 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3615 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3616 ; GFX7-NEXT: ds_write_b32 v0, v1
3617 ; GFX7-NEXT: s_endpgm
3619 ; GFX10-WGP-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
3620 ; GFX10-WGP: ; %bb.0: ; %entry
3621 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3622 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3623 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3624 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3625 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3626 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3627 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3628 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3629 ; GFX10-WGP-NEXT: s_endpgm
3631 ; GFX10-CU-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
3632 ; GFX10-CU: ; %bb.0: ; %entry
3633 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3634 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3635 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3636 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3637 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3638 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3639 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3640 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3641 ; GFX10-CU-NEXT: s_endpgm
3643 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
3644 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3645 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3646 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3647 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3648 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3649 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3650 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3651 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3652 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3653 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3654 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3655 ; SKIP-CACHE-INV-NEXT: s_endpgm
3657 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
3658 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3659 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3660 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3661 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3662 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3663 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3664 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3665 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3666 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3667 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3669 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
3670 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3671 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3672 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3673 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3674 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3675 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3676 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3677 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3678 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3679 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3680 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3682 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3683 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acquire seq_cst
3684 %val0 = extractvalue { i32, i1 } %val, 0
3685 store i32 %val0, i32 addrspace(3)* %out, align 4
3689 define amdgpu_kernel void @local_singlethread_release_seq_cst_ret_cmpxchg(
3690 ; GFX6-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
3691 ; GFX6: ; %bb.0: ; %entry
3692 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3693 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3694 ; GFX6-NEXT: s_mov_b32 m0, -1
3695 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3696 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3697 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3698 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3699 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3700 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3701 ; GFX6-NEXT: ds_write_b32 v0, v1
3702 ; GFX6-NEXT: s_endpgm
3704 ; GFX7-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
3705 ; GFX7: ; %bb.0: ; %entry
3706 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3707 ; GFX7-NEXT: s_mov_b32 m0, -1
3708 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3709 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3710 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3711 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3712 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3713 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3714 ; GFX7-NEXT: ds_write_b32 v0, v1
3715 ; GFX7-NEXT: s_endpgm
3717 ; GFX10-WGP-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
3718 ; GFX10-WGP: ; %bb.0: ; %entry
3719 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3720 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3721 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3722 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3723 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3724 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3725 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3726 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3727 ; GFX10-WGP-NEXT: s_endpgm
3729 ; GFX10-CU-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
3730 ; GFX10-CU: ; %bb.0: ; %entry
3731 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3732 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3733 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3734 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3735 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3736 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3737 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3738 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3739 ; GFX10-CU-NEXT: s_endpgm
3741 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
3742 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3743 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3744 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3745 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3746 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3747 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3748 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3749 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3750 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3751 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3752 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3753 ; SKIP-CACHE-INV-NEXT: s_endpgm
3755 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
3756 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3757 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3758 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3759 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3760 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3761 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3762 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3763 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3764 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3765 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3767 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
3768 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3769 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3770 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3771 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3772 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3773 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3774 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3775 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3776 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3777 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3778 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3780 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3781 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") release seq_cst
3782 %val0 = extractvalue { i32, i1 } %val, 0
3783 store i32 %val0, i32 addrspace(3)* %out, align 4
3787 define amdgpu_kernel void @local_singlethread_acq_rel_seq_cst_ret_cmpxchg(
3788 ; GFX6-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
3789 ; GFX6: ; %bb.0: ; %entry
3790 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3791 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3792 ; GFX6-NEXT: s_mov_b32 m0, -1
3793 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3794 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3795 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3796 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3797 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3798 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3799 ; GFX6-NEXT: ds_write_b32 v0, v1
3800 ; GFX6-NEXT: s_endpgm
3802 ; GFX7-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
3803 ; GFX7: ; %bb.0: ; %entry
3804 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3805 ; GFX7-NEXT: s_mov_b32 m0, -1
3806 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3807 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3808 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3809 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3810 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3811 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3812 ; GFX7-NEXT: ds_write_b32 v0, v1
3813 ; GFX7-NEXT: s_endpgm
3815 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
3816 ; GFX10-WGP: ; %bb.0: ; %entry
3817 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3818 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3819 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3820 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3821 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3822 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3823 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3824 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3825 ; GFX10-WGP-NEXT: s_endpgm
3827 ; GFX10-CU-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
3828 ; GFX10-CU: ; %bb.0: ; %entry
3829 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3830 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3831 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3832 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3833 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3834 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3835 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3836 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3837 ; GFX10-CU-NEXT: s_endpgm
3839 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
3840 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3841 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3842 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3843 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3844 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3845 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3846 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3847 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3848 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3849 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3850 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3851 ; SKIP-CACHE-INV-NEXT: s_endpgm
3853 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
3854 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3855 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3856 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3857 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3858 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3859 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3860 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3861 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3862 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3863 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3865 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
3866 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3867 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3868 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3869 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3870 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3871 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3872 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3873 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3874 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3875 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3876 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3878 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3879 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel seq_cst
3880 %val0 = extractvalue { i32, i1 } %val, 0
3881 store i32 %val0, i32 addrspace(3)* %out, align 4
3885 define amdgpu_kernel void @local_singlethread_seq_cst_seq_cst_ret_cmpxchg(
3886 ; GFX6-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
3887 ; GFX6: ; %bb.0: ; %entry
3888 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
3889 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
3890 ; GFX6-NEXT: s_mov_b32 m0, -1
3891 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3892 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3893 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3894 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
3895 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3896 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3897 ; GFX6-NEXT: ds_write_b32 v0, v1
3898 ; GFX6-NEXT: s_endpgm
3900 ; GFX7-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
3901 ; GFX7: ; %bb.0: ; %entry
3902 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3903 ; GFX7-NEXT: s_mov_b32 m0, -1
3904 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3905 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3906 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
3907 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
3908 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3909 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3910 ; GFX7-NEXT: ds_write_b32 v0, v1
3911 ; GFX7-NEXT: s_endpgm
3913 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
3914 ; GFX10-WGP: ; %bb.0: ; %entry
3915 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3916 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3917 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3918 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
3919 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
3920 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3921 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3922 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
3923 ; GFX10-WGP-NEXT: s_endpgm
3925 ; GFX10-CU-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
3926 ; GFX10-CU: ; %bb.0: ; %entry
3927 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3928 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3929 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3930 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
3931 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
3932 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3933 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3934 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
3935 ; GFX10-CU-NEXT: s_endpgm
3937 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
3938 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3939 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
3940 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
3941 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3942 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3943 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3944 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
3945 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
3946 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3947 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3948 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
3949 ; SKIP-CACHE-INV-NEXT: s_endpgm
3951 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
3952 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3953 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3954 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3955 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3956 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3957 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3958 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3959 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3960 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
3961 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3963 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
3964 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3965 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3966 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3967 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
3968 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
3969 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
3970 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
3971 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3972 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
3973 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3974 i32 addrspace(3)* %out, i32 %in, i32 %old) {
3976 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
3977 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst seq_cst
3978 %val0 = extractvalue { i32, i1 } %val, 0
3979 store i32 %val0, i32 addrspace(3)* %out, align 4
3983 define amdgpu_kernel void @local_singlethread_one_as_unordered_load(
3984 ; GFX6-LABEL: local_singlethread_one_as_unordered_load:
3985 ; GFX6: ; %bb.0: ; %entry
3986 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
3987 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
3988 ; GFX6-NEXT: s_mov_b32 m0, -1
3989 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3990 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
3991 ; GFX6-NEXT: ds_read_b32 v0, v0
3992 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
3993 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3994 ; GFX6-NEXT: ds_write_b32 v1, v0
3995 ; GFX6-NEXT: s_endpgm
3997 ; GFX7-LABEL: local_singlethread_one_as_unordered_load:
3998 ; GFX7: ; %bb.0: ; %entry
3999 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4000 ; GFX7-NEXT: s_mov_b32 m0, -1
4001 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4002 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4003 ; GFX7-NEXT: ds_read_b32 v0, v0
4004 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4005 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4006 ; GFX7-NEXT: ds_write_b32 v1, v0
4007 ; GFX7-NEXT: s_endpgm
4009 ; GFX10-WGP-LABEL: local_singlethread_one_as_unordered_load:
4010 ; GFX10-WGP: ; %bb.0: ; %entry
4011 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4012 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4013 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4014 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4015 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
4016 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4017 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
4018 ; GFX10-WGP-NEXT: s_endpgm
4020 ; GFX10-CU-LABEL: local_singlethread_one_as_unordered_load:
4021 ; GFX10-CU: ; %bb.0: ; %entry
4022 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4023 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4024 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4025 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4026 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
4027 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4028 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
4029 ; GFX10-CU-NEXT: s_endpgm
4031 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_unordered_load:
4032 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4033 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4034 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4035 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4036 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4037 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
4038 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4039 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4040 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
4041 ; SKIP-CACHE-INV-NEXT: s_endpgm
4043 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_unordered_load:
4044 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4045 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4046 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4047 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4048 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
4049 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4050 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4051 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
4052 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4054 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_unordered_load:
4055 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4056 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4057 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4058 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4059 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
4060 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4061 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4062 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
4063 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4064 i32 addrspace(3)* %in, i32 addrspace(3)* %out) {
4066 %val = load atomic i32, i32 addrspace(3)* %in syncscope("singlethread-one-as") unordered, align 4
4067 store i32 %val, i32 addrspace(3)* %out
4071 define amdgpu_kernel void @local_singlethread_one_as_monotonic_load(
4072 ; GFX6-LABEL: local_singlethread_one_as_monotonic_load:
4073 ; GFX6: ; %bb.0: ; %entry
4074 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4075 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4076 ; GFX6-NEXT: s_mov_b32 m0, -1
4077 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4078 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
4079 ; GFX6-NEXT: ds_read_b32 v0, v0
4080 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4081 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4082 ; GFX6-NEXT: ds_write_b32 v1, v0
4083 ; GFX6-NEXT: s_endpgm
4085 ; GFX7-LABEL: local_singlethread_one_as_monotonic_load:
4086 ; GFX7: ; %bb.0: ; %entry
4087 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4088 ; GFX7-NEXT: s_mov_b32 m0, -1
4089 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4090 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4091 ; GFX7-NEXT: ds_read_b32 v0, v0
4092 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4093 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4094 ; GFX7-NEXT: ds_write_b32 v1, v0
4095 ; GFX7-NEXT: s_endpgm
4097 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_load:
4098 ; GFX10-WGP: ; %bb.0: ; %entry
4099 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4100 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4101 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4102 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4103 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
4104 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4105 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
4106 ; GFX10-WGP-NEXT: s_endpgm
4108 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_load:
4109 ; GFX10-CU: ; %bb.0: ; %entry
4110 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4111 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4112 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4113 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4114 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
4115 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4116 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
4117 ; GFX10-CU-NEXT: s_endpgm
4119 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_load:
4120 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4121 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4122 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4123 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4124 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4125 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
4126 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4127 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4128 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
4129 ; SKIP-CACHE-INV-NEXT: s_endpgm
4131 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_load:
4132 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4133 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4134 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4135 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4136 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
4137 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4138 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4139 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
4140 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4142 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_load:
4143 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4144 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4145 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4146 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4147 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
4148 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4149 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4150 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
4151 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4152 i32 addrspace(3)* %in, i32 addrspace(3)* %out) {
4154 %val = load atomic i32, i32 addrspace(3)* %in syncscope("singlethread-one-as") monotonic, align 4
4155 store i32 %val, i32 addrspace(3)* %out
4159 define amdgpu_kernel void @local_singlethread_one_as_acquire_load(
4160 ; GFX6-LABEL: local_singlethread_one_as_acquire_load:
4161 ; GFX6: ; %bb.0: ; %entry
4162 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4163 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4164 ; GFX6-NEXT: s_mov_b32 m0, -1
4165 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4166 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
4167 ; GFX6-NEXT: ds_read_b32 v0, v0
4168 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4169 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4170 ; GFX6-NEXT: ds_write_b32 v1, v0
4171 ; GFX6-NEXT: s_endpgm
4173 ; GFX7-LABEL: local_singlethread_one_as_acquire_load:
4174 ; GFX7: ; %bb.0: ; %entry
4175 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4176 ; GFX7-NEXT: s_mov_b32 m0, -1
4177 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4178 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4179 ; GFX7-NEXT: ds_read_b32 v0, v0
4180 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4181 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4182 ; GFX7-NEXT: ds_write_b32 v1, v0
4183 ; GFX7-NEXT: s_endpgm
4185 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_load:
4186 ; GFX10-WGP: ; %bb.0: ; %entry
4187 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4188 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4189 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4190 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4191 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
4192 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4193 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
4194 ; GFX10-WGP-NEXT: s_endpgm
4196 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_load:
4197 ; GFX10-CU: ; %bb.0: ; %entry
4198 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4199 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4200 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4201 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4202 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
4203 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4204 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
4205 ; GFX10-CU-NEXT: s_endpgm
4207 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_load:
4208 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4209 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4210 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4211 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4212 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4213 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
4214 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4215 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4216 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
4217 ; SKIP-CACHE-INV-NEXT: s_endpgm
4219 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_load:
4220 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4221 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4222 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4223 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4224 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
4225 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4226 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4227 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
4228 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4230 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_load:
4231 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4232 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4233 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4234 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4235 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
4236 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4237 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4238 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
4239 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4240 i32 addrspace(3)* %in, i32 addrspace(3)* %out) {
4242 %val = load atomic i32, i32 addrspace(3)* %in syncscope("singlethread-one-as") acquire, align 4
4243 store i32 %val, i32 addrspace(3)* %out
4247 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_load(
4248 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_load:
4249 ; GFX6: ; %bb.0: ; %entry
4250 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4251 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4252 ; GFX6-NEXT: s_mov_b32 m0, -1
4253 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4254 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
4255 ; GFX6-NEXT: ds_read_b32 v0, v0
4256 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4257 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4258 ; GFX6-NEXT: ds_write_b32 v1, v0
4259 ; GFX6-NEXT: s_endpgm
4261 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_load:
4262 ; GFX7: ; %bb.0: ; %entry
4263 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4264 ; GFX7-NEXT: s_mov_b32 m0, -1
4265 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4266 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4267 ; GFX7-NEXT: ds_read_b32 v0, v0
4268 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4269 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4270 ; GFX7-NEXT: ds_write_b32 v1, v0
4271 ; GFX7-NEXT: s_endpgm
4273 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_load:
4274 ; GFX10-WGP: ; %bb.0: ; %entry
4275 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4276 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4277 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4278 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4279 ; GFX10-WGP-NEXT: ds_read_b32 v0, v0
4280 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4281 ; GFX10-WGP-NEXT: ds_write_b32 v1, v0
4282 ; GFX10-WGP-NEXT: s_endpgm
4284 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_load:
4285 ; GFX10-CU: ; %bb.0: ; %entry
4286 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4287 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4288 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4289 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4290 ; GFX10-CU-NEXT: ds_read_b32 v0, v0
4291 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4292 ; GFX10-CU-NEXT: ds_write_b32 v1, v0
4293 ; GFX10-CU-NEXT: s_endpgm
4295 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_load:
4296 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4297 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4298 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4299 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4300 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4301 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v0, v0
4302 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4303 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4304 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v1, v0
4305 ; SKIP-CACHE-INV-NEXT: s_endpgm
4307 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_load:
4308 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4309 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4310 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4311 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4312 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v0, v0
4313 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4314 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4315 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v1, v0
4316 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4318 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_load:
4319 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4320 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4321 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4322 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4323 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v0, v0
4324 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4325 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4326 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v1, v0
4327 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4328 i32 addrspace(3)* %in, i32 addrspace(3)* %out) {
4330 %val = load atomic i32, i32 addrspace(3)* %in syncscope("singlethread-one-as") seq_cst, align 4
4331 store i32 %val, i32 addrspace(3)* %out
4335 define amdgpu_kernel void @local_singlethread_one_as_unordered_store(
4336 ; GFX6-LABEL: local_singlethread_one_as_unordered_store:
4337 ; GFX6: ; %bb.0: ; %entry
4338 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4339 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4340 ; GFX6-NEXT: s_mov_b32 m0, -1
4341 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4342 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
4343 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
4344 ; GFX6-NEXT: ds_write_b32 v0, v1
4345 ; GFX6-NEXT: s_endpgm
4347 ; GFX7-LABEL: local_singlethread_one_as_unordered_store:
4348 ; GFX7: ; %bb.0: ; %entry
4349 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4350 ; GFX7-NEXT: s_mov_b32 m0, -1
4351 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4352 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
4353 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
4354 ; GFX7-NEXT: ds_write_b32 v0, v1
4355 ; GFX7-NEXT: s_endpgm
4357 ; GFX10-WGP-LABEL: local_singlethread_one_as_unordered_store:
4358 ; GFX10-WGP: ; %bb.0: ; %entry
4359 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4360 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4361 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
4362 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
4363 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4364 ; GFX10-WGP-NEXT: s_endpgm
4366 ; GFX10-CU-LABEL: local_singlethread_one_as_unordered_store:
4367 ; GFX10-CU: ; %bb.0: ; %entry
4368 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4369 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4370 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
4371 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
4372 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4373 ; GFX10-CU-NEXT: s_endpgm
4375 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_unordered_store:
4376 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4377 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4378 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4379 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4380 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
4381 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
4382 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4383 ; SKIP-CACHE-INV-NEXT: s_endpgm
4385 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_unordered_store:
4386 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4387 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4388 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4389 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
4390 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
4391 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4392 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4394 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_unordered_store:
4395 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4396 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4397 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4398 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
4399 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
4400 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4401 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4402 i32 %in, i32 addrspace(3)* %out) {
4404 store atomic i32 %in, i32 addrspace(3)* %out syncscope("singlethread-one-as") unordered, align 4
4408 define amdgpu_kernel void @local_singlethread_one_as_monotonic_store(
4409 ; GFX6-LABEL: local_singlethread_one_as_monotonic_store:
4410 ; GFX6: ; %bb.0: ; %entry
4411 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4412 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4413 ; GFX6-NEXT: s_mov_b32 m0, -1
4414 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4415 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
4416 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
4417 ; GFX6-NEXT: ds_write_b32 v0, v1
4418 ; GFX6-NEXT: s_endpgm
4420 ; GFX7-LABEL: local_singlethread_one_as_monotonic_store:
4421 ; GFX7: ; %bb.0: ; %entry
4422 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4423 ; GFX7-NEXT: s_mov_b32 m0, -1
4424 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4425 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
4426 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
4427 ; GFX7-NEXT: ds_write_b32 v0, v1
4428 ; GFX7-NEXT: s_endpgm
4430 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_store:
4431 ; GFX10-WGP: ; %bb.0: ; %entry
4432 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4433 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4434 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
4435 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
4436 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4437 ; GFX10-WGP-NEXT: s_endpgm
4439 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_store:
4440 ; GFX10-CU: ; %bb.0: ; %entry
4441 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4442 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4443 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
4444 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
4445 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4446 ; GFX10-CU-NEXT: s_endpgm
4448 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_store:
4449 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4450 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4451 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4452 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4453 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
4454 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
4455 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4456 ; SKIP-CACHE-INV-NEXT: s_endpgm
4458 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_store:
4459 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4460 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4461 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4462 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
4463 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
4464 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4465 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4467 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_store:
4468 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4469 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4470 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4471 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
4472 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
4473 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4474 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4475 i32 %in, i32 addrspace(3)* %out) {
4477 store atomic i32 %in, i32 addrspace(3)* %out syncscope("singlethread-one-as") monotonic, align 4
4481 define amdgpu_kernel void @local_singlethread_one_as_release_store(
4482 ; GFX6-LABEL: local_singlethread_one_as_release_store:
4483 ; GFX6: ; %bb.0: ; %entry
4484 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4485 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4486 ; GFX6-NEXT: s_mov_b32 m0, -1
4487 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4488 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
4489 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
4490 ; GFX6-NEXT: ds_write_b32 v0, v1
4491 ; GFX6-NEXT: s_endpgm
4493 ; GFX7-LABEL: local_singlethread_one_as_release_store:
4494 ; GFX7: ; %bb.0: ; %entry
4495 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4496 ; GFX7-NEXT: s_mov_b32 m0, -1
4497 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4498 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
4499 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
4500 ; GFX7-NEXT: ds_write_b32 v0, v1
4501 ; GFX7-NEXT: s_endpgm
4503 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_store:
4504 ; GFX10-WGP: ; %bb.0: ; %entry
4505 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4506 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4507 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
4508 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
4509 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4510 ; GFX10-WGP-NEXT: s_endpgm
4512 ; GFX10-CU-LABEL: local_singlethread_one_as_release_store:
4513 ; GFX10-CU: ; %bb.0: ; %entry
4514 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4515 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4516 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
4517 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
4518 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4519 ; GFX10-CU-NEXT: s_endpgm
4521 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_store:
4522 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4523 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4524 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4525 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4526 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
4527 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
4528 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4529 ; SKIP-CACHE-INV-NEXT: s_endpgm
4531 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_store:
4532 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4533 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4534 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4535 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
4536 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
4537 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4538 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4540 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_store:
4541 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4542 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4543 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4544 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
4545 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
4546 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4547 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4548 i32 %in, i32 addrspace(3)* %out) {
4550 store atomic i32 %in, i32 addrspace(3)* %out syncscope("singlethread-one-as") release, align 4
4554 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_store(
4555 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_store:
4556 ; GFX6: ; %bb.0: ; %entry
4557 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4558 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4559 ; GFX6-NEXT: s_mov_b32 m0, -1
4560 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4561 ; GFX6-NEXT: v_mov_b32_e32 v1, s0
4562 ; GFX6-NEXT: v_mov_b32_e32 v0, s1
4563 ; GFX6-NEXT: ds_write_b32 v0, v1
4564 ; GFX6-NEXT: s_endpgm
4566 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_store:
4567 ; GFX7: ; %bb.0: ; %entry
4568 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4569 ; GFX7-NEXT: s_mov_b32 m0, -1
4570 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4571 ; GFX7-NEXT: v_mov_b32_e32 v0, s1
4572 ; GFX7-NEXT: v_mov_b32_e32 v1, s0
4573 ; GFX7-NEXT: ds_write_b32 v0, v1
4574 ; GFX7-NEXT: s_endpgm
4576 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_store:
4577 ; GFX10-WGP: ; %bb.0: ; %entry
4578 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4579 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4580 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s1
4581 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s0
4582 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
4583 ; GFX10-WGP-NEXT: s_endpgm
4585 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_store:
4586 ; GFX10-CU: ; %bb.0: ; %entry
4587 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4588 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4589 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s1
4590 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s0
4591 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
4592 ; GFX10-CU-NEXT: s_endpgm
4594 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_store:
4595 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4596 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4597 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4598 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4599 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
4600 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
4601 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
4602 ; SKIP-CACHE-INV-NEXT: s_endpgm
4604 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_store:
4605 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4606 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4607 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4608 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
4609 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
4610 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
4611 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4613 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_store:
4614 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4615 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4616 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4617 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
4618 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
4619 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
4620 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4621 i32 %in, i32 addrspace(3)* %out) {
4623 store atomic i32 %in, i32 addrspace(3)* %out syncscope("singlethread-one-as") seq_cst, align 4
4627 define amdgpu_kernel void @local_singlethread_one_as_monotonic_atomicrmw(
4628 ; GFX6-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
4629 ; GFX6: ; %bb.0: ; %entry
4630 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4631 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4632 ; GFX6-NEXT: s_mov_b32 m0, -1
4633 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4634 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
4635 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4636 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4637 ; GFX6-NEXT: s_endpgm
4639 ; GFX7-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
4640 ; GFX7: ; %bb.0: ; %entry
4641 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4642 ; GFX7-NEXT: s_mov_b32 m0, -1
4643 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4644 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4645 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4646 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4647 ; GFX7-NEXT: s_endpgm
4649 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
4650 ; GFX10-WGP: ; %bb.0: ; %entry
4651 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4652 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4653 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4654 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4655 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4656 ; GFX10-WGP-NEXT: s_endpgm
4658 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
4659 ; GFX10-CU: ; %bb.0: ; %entry
4660 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4661 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4662 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4663 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4664 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4665 ; GFX10-CU-NEXT: s_endpgm
4667 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
4668 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4669 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4670 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4671 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4672 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4673 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4674 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4675 ; SKIP-CACHE-INV-NEXT: s_endpgm
4677 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
4678 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4679 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4680 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4681 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4682 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4683 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4684 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4686 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
4687 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4688 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4689 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4690 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4691 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4692 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4693 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4694 i32 addrspace(3)* %out, i32 %in) {
4696 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread-one-as") monotonic
4700 define amdgpu_kernel void @local_singlethread_one_as_acquire_atomicrmw(
4701 ; GFX6-LABEL: local_singlethread_one_as_acquire_atomicrmw:
4702 ; GFX6: ; %bb.0: ; %entry
4703 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4704 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4705 ; GFX6-NEXT: s_mov_b32 m0, -1
4706 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4707 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
4708 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4709 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4710 ; GFX6-NEXT: s_endpgm
4712 ; GFX7-LABEL: local_singlethread_one_as_acquire_atomicrmw:
4713 ; GFX7: ; %bb.0: ; %entry
4714 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4715 ; GFX7-NEXT: s_mov_b32 m0, -1
4716 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4717 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4718 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4719 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4720 ; GFX7-NEXT: s_endpgm
4722 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_atomicrmw:
4723 ; GFX10-WGP: ; %bb.0: ; %entry
4724 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4725 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4726 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4727 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4728 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4729 ; GFX10-WGP-NEXT: s_endpgm
4731 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_atomicrmw:
4732 ; GFX10-CU: ; %bb.0: ; %entry
4733 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4734 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4735 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4736 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4737 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4738 ; GFX10-CU-NEXT: s_endpgm
4740 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_atomicrmw:
4741 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4742 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4743 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4744 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4745 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4746 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4747 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4748 ; SKIP-CACHE-INV-NEXT: s_endpgm
4750 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_atomicrmw:
4751 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4752 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4753 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4754 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4755 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4756 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4757 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4759 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_atomicrmw:
4760 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4761 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4762 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4763 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4764 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4765 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4766 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4767 i32 addrspace(3)* %out, i32 %in) {
4769 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread-one-as") acquire
4773 define amdgpu_kernel void @local_singlethread_one_as_release_atomicrmw(
4774 ; GFX6-LABEL: local_singlethread_one_as_release_atomicrmw:
4775 ; GFX6: ; %bb.0: ; %entry
4776 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4777 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4778 ; GFX6-NEXT: s_mov_b32 m0, -1
4779 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4780 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
4781 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4782 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4783 ; GFX6-NEXT: s_endpgm
4785 ; GFX7-LABEL: local_singlethread_one_as_release_atomicrmw:
4786 ; GFX7: ; %bb.0: ; %entry
4787 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4788 ; GFX7-NEXT: s_mov_b32 m0, -1
4789 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4790 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4791 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4792 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4793 ; GFX7-NEXT: s_endpgm
4795 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_atomicrmw:
4796 ; GFX10-WGP: ; %bb.0: ; %entry
4797 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4798 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4799 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4800 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4801 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4802 ; GFX10-WGP-NEXT: s_endpgm
4804 ; GFX10-CU-LABEL: local_singlethread_one_as_release_atomicrmw:
4805 ; GFX10-CU: ; %bb.0: ; %entry
4806 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4807 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4808 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4809 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4810 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4811 ; GFX10-CU-NEXT: s_endpgm
4813 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_atomicrmw:
4814 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4815 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4816 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4817 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4818 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4819 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4820 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4821 ; SKIP-CACHE-INV-NEXT: s_endpgm
4823 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_atomicrmw:
4824 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4825 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4826 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4827 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4828 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4829 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4830 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4832 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_atomicrmw:
4833 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4834 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4835 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4836 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4837 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4838 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4839 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4840 i32 addrspace(3)* %out, i32 %in) {
4842 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread-one-as") release
4846 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_atomicrmw(
4847 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
4848 ; GFX6: ; %bb.0: ; %entry
4849 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4850 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4851 ; GFX6-NEXT: s_mov_b32 m0, -1
4852 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4853 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
4854 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4855 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4856 ; GFX6-NEXT: s_endpgm
4858 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
4859 ; GFX7: ; %bb.0: ; %entry
4860 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4861 ; GFX7-NEXT: s_mov_b32 m0, -1
4862 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4863 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4864 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4865 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4866 ; GFX7-NEXT: s_endpgm
4868 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
4869 ; GFX10-WGP: ; %bb.0: ; %entry
4870 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4871 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4872 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4873 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4874 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4875 ; GFX10-WGP-NEXT: s_endpgm
4877 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
4878 ; GFX10-CU: ; %bb.0: ; %entry
4879 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4880 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4881 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4882 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4883 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4884 ; GFX10-CU-NEXT: s_endpgm
4886 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
4887 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4888 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4889 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4890 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4891 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4892 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4893 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4894 ; SKIP-CACHE-INV-NEXT: s_endpgm
4896 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
4897 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4898 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4899 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4900 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4901 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4902 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4903 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4905 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
4906 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4907 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4908 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4909 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4910 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4911 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4912 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4913 i32 addrspace(3)* %out, i32 %in) {
4915 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread-one-as") acq_rel
4919 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_atomicrmw(
4920 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
4921 ; GFX6: ; %bb.0: ; %entry
4922 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4923 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4924 ; GFX6-NEXT: s_mov_b32 m0, -1
4925 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4926 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
4927 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
4928 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4929 ; GFX6-NEXT: s_endpgm
4931 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
4932 ; GFX7: ; %bb.0: ; %entry
4933 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4934 ; GFX7-NEXT: s_mov_b32 m0, -1
4935 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4936 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4937 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4938 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4939 ; GFX7-NEXT: s_endpgm
4941 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
4942 ; GFX10-WGP: ; %bb.0: ; %entry
4943 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4944 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4945 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4946 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4947 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4948 ; GFX10-WGP-NEXT: s_endpgm
4950 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
4951 ; GFX10-CU: ; %bb.0: ; %entry
4952 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4953 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4954 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4955 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4956 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4957 ; GFX10-CU-NEXT: s_endpgm
4959 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
4960 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4961 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
4962 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4963 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4964 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4965 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4966 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4967 ; SKIP-CACHE-INV-NEXT: s_endpgm
4969 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
4970 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4971 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4972 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4973 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4974 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4975 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4976 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4978 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
4979 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4980 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
4981 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4982 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
4983 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4984 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
4985 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4986 i32 addrspace(3)* %out, i32 %in) {
4988 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread-one-as") seq_cst
4992 define amdgpu_kernel void @local_singlethread_one_as_acquire_ret_atomicrmw(
4993 ; GFX6-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
4994 ; GFX6: ; %bb.0: ; %entry
4995 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
4996 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
4997 ; GFX6-NEXT: s_mov_b32 m0, -1
4998 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4999 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
5000 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5001 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5002 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5003 ; GFX6-NEXT: ds_write_b32 v0, v1
5004 ; GFX6-NEXT: s_endpgm
5006 ; GFX7-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
5007 ; GFX7: ; %bb.0: ; %entry
5008 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5009 ; GFX7-NEXT: s_mov_b32 m0, -1
5010 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5011 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5012 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5013 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5014 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5015 ; GFX7-NEXT: ds_write_b32 v0, v1
5016 ; GFX7-NEXT: s_endpgm
5018 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
5019 ; GFX10-WGP: ; %bb.0: ; %entry
5020 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5021 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5022 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5023 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5024 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5025 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5026 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5027 ; GFX10-WGP-NEXT: s_endpgm
5029 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
5030 ; GFX10-CU: ; %bb.0: ; %entry
5031 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5032 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5033 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5034 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5035 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5036 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5037 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5038 ; GFX10-CU-NEXT: s_endpgm
5040 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
5041 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5042 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
5043 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5044 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5045 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5046 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5047 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5048 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5049 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5050 ; SKIP-CACHE-INV-NEXT: s_endpgm
5052 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
5053 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5054 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5055 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5056 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5057 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5058 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5059 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5060 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5061 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5063 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
5064 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5065 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5066 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5067 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5068 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5069 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5070 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5071 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5072 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5073 i32 addrspace(3)* %out, i32 %in) {
5075 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread-one-as") acquire
5076 store i32 %val, i32 addrspace(3)* %out, align 4
5080 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_ret_atomicrmw(
5081 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
5082 ; GFX6: ; %bb.0: ; %entry
5083 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
5084 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
5085 ; GFX6-NEXT: s_mov_b32 m0, -1
5086 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5087 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
5088 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5089 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5090 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5091 ; GFX6-NEXT: ds_write_b32 v0, v1
5092 ; GFX6-NEXT: s_endpgm
5094 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
5095 ; GFX7: ; %bb.0: ; %entry
5096 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5097 ; GFX7-NEXT: s_mov_b32 m0, -1
5098 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5099 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5100 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5101 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5102 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5103 ; GFX7-NEXT: ds_write_b32 v0, v1
5104 ; GFX7-NEXT: s_endpgm
5106 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
5107 ; GFX10-WGP: ; %bb.0: ; %entry
5108 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5109 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5110 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5111 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5112 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5113 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5114 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5115 ; GFX10-WGP-NEXT: s_endpgm
5117 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
5118 ; GFX10-CU: ; %bb.0: ; %entry
5119 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5120 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5121 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5122 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5123 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5124 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5125 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5126 ; GFX10-CU-NEXT: s_endpgm
5128 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
5129 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5130 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
5131 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5132 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5133 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5134 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5135 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5136 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5137 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5138 ; SKIP-CACHE-INV-NEXT: s_endpgm
5140 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
5141 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5142 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5143 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5144 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5145 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5146 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5147 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5148 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5149 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5151 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
5152 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5153 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5154 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5155 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5156 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5157 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5158 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5159 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5160 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5161 i32 addrspace(3)* %out, i32 %in) {
5163 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread-one-as") acq_rel
5164 store i32 %val, i32 addrspace(3)* %out, align 4
5168 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_ret_atomicrmw(
5169 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
5170 ; GFX6: ; %bb.0: ; %entry
5171 ; GFX6-NEXT: s_load_dword s0, s[4:5], 0x0
5172 ; GFX6-NEXT: s_load_dword s1, s[4:5], 0x1
5173 ; GFX6-NEXT: s_mov_b32 m0, -1
5174 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5175 ; GFX6-NEXT: v_mov_b32_e32 v0, s0
5176 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5177 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5178 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5179 ; GFX6-NEXT: ds_write_b32 v0, v1
5180 ; GFX6-NEXT: s_endpgm
5182 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
5183 ; GFX7: ; %bb.0: ; %entry
5184 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5185 ; GFX7-NEXT: s_mov_b32 m0, -1
5186 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5187 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5188 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5189 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5190 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5191 ; GFX7-NEXT: ds_write_b32 v0, v1
5192 ; GFX7-NEXT: s_endpgm
5194 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
5195 ; GFX10-WGP: ; %bb.0: ; %entry
5196 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5197 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5198 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5199 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5200 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5201 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5202 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5203 ; GFX10-WGP-NEXT: s_endpgm
5205 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
5206 ; GFX10-CU: ; %bb.0: ; %entry
5207 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5208 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5209 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5210 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5211 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5212 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5213 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5214 ; GFX10-CU-NEXT: s_endpgm
5216 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
5217 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5218 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
5219 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5220 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5221 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5222 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5223 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5224 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5225 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5226 ; SKIP-CACHE-INV-NEXT: s_endpgm
5228 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
5229 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5230 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5231 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5232 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5233 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5234 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5235 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5236 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5237 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5239 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
5240 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5241 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
5242 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5243 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5244 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5245 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
5246 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5247 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5248 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5249 i32 addrspace(3)* %out, i32 %in) {
5251 %val = atomicrmw volatile xchg i32 addrspace(3)* %out, i32 %in syncscope("singlethread-one-as") seq_cst
5252 store i32 %val, i32 addrspace(3)* %out, align 4
5256 define amdgpu_kernel void @local_singlethread_one_as_monotonic_monotonic_cmpxchg(
5257 ; GFX6-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
5258 ; GFX6: ; %bb.0: ; %entry
5259 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5260 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5261 ; GFX6-NEXT: s_mov_b32 m0, -1
5262 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5263 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5264 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5265 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5266 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5267 ; GFX6-NEXT: s_endpgm
5269 ; GFX7-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
5270 ; GFX7: ; %bb.0: ; %entry
5271 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5272 ; GFX7-NEXT: s_mov_b32 m0, -1
5273 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5274 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5275 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5276 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5277 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5278 ; GFX7-NEXT: s_endpgm
5280 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
5281 ; GFX10-WGP: ; %bb.0: ; %entry
5282 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5283 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5284 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5285 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5286 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5287 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5288 ; GFX10-WGP-NEXT: s_endpgm
5290 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
5291 ; GFX10-CU: ; %bb.0: ; %entry
5292 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5293 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5294 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5295 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5296 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5297 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5298 ; GFX10-CU-NEXT: s_endpgm
5300 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
5301 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5302 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
5303 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
5304 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5305 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5306 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5307 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
5308 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
5309 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5310 ; SKIP-CACHE-INV-NEXT: s_endpgm
5312 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
5313 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5314 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5315 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5316 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5317 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5318 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5319 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5320 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5322 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
5323 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5324 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5325 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5326 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5327 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5328 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5329 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5330 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5331 i32 addrspace(3)* %out, i32 %in, i32 %old) {
5333 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
5334 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic monotonic
5338 define amdgpu_kernel void @local_singlethread_one_as_acquire_monotonic_cmpxchg(
5339 ; GFX6-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
5340 ; GFX6: ; %bb.0: ; %entry
5341 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5342 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5343 ; GFX6-NEXT: s_mov_b32 m0, -1
5344 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5345 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5346 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5347 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5348 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5349 ; GFX6-NEXT: s_endpgm
5351 ; GFX7-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
5352 ; GFX7: ; %bb.0: ; %entry
5353 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5354 ; GFX7-NEXT: s_mov_b32 m0, -1
5355 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5356 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5357 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5358 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5359 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5360 ; GFX7-NEXT: s_endpgm
5362 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
5363 ; GFX10-WGP: ; %bb.0: ; %entry
5364 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5365 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5366 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5367 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5368 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5369 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5370 ; GFX10-WGP-NEXT: s_endpgm
5372 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
5373 ; GFX10-CU: ; %bb.0: ; %entry
5374 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5375 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5376 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5377 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5378 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5379 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5380 ; GFX10-CU-NEXT: s_endpgm
5382 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
5383 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5384 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
5385 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
5386 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5387 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5388 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5389 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
5390 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
5391 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5392 ; SKIP-CACHE-INV-NEXT: s_endpgm
5394 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
5395 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5396 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5397 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5398 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5399 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5400 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5401 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5402 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5404 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
5405 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5406 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5407 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5408 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5409 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5410 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5411 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5412 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5413 i32 addrspace(3)* %out, i32 %in, i32 %old) {
5415 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
5416 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire monotonic
5420 define amdgpu_kernel void @local_singlethread_one_as_release_monotonic_cmpxchg(
5421 ; GFX6-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
5422 ; GFX6: ; %bb.0: ; %entry
5423 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5424 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5425 ; GFX6-NEXT: s_mov_b32 m0, -1
5426 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5427 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5428 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5429 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5430 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5431 ; GFX6-NEXT: s_endpgm
5433 ; GFX7-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
5434 ; GFX7: ; %bb.0: ; %entry
5435 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5436 ; GFX7-NEXT: s_mov_b32 m0, -1
5437 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5438 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5439 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5440 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5441 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5442 ; GFX7-NEXT: s_endpgm
5444 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
5445 ; GFX10-WGP: ; %bb.0: ; %entry
5446 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5447 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5448 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5449 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5450 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5451 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5452 ; GFX10-WGP-NEXT: s_endpgm
5454 ; GFX10-CU-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
5455 ; GFX10-CU: ; %bb.0: ; %entry
5456 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5457 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5458 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5459 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5460 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5461 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5462 ; GFX10-CU-NEXT: s_endpgm
5464 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
5465 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5466 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
5467 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
5468 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5469 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5470 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5471 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
5472 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
5473 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5474 ; SKIP-CACHE-INV-NEXT: s_endpgm
5476 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
5477 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5478 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5479 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5480 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5481 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5482 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5483 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5484 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5486 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
5487 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5488 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5489 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5490 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5491 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5492 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5493 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5494 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5495 i32 addrspace(3)* %out, i32 %in, i32 %old) {
5497 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
5498 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release monotonic
5502 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_monotonic_cmpxchg(
5503 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
5504 ; GFX6: ; %bb.0: ; %entry
5505 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5506 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5507 ; GFX6-NEXT: s_mov_b32 m0, -1
5508 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5509 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5510 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5511 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5512 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5513 ; GFX6-NEXT: s_endpgm
5515 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
5516 ; GFX7: ; %bb.0: ; %entry
5517 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5518 ; GFX7-NEXT: s_mov_b32 m0, -1
5519 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5520 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5521 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5522 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5523 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5524 ; GFX7-NEXT: s_endpgm
5526 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
5527 ; GFX10-WGP: ; %bb.0: ; %entry
5528 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5529 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5530 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5531 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5532 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5533 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5534 ; GFX10-WGP-NEXT: s_endpgm
5536 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
5537 ; GFX10-CU: ; %bb.0: ; %entry
5538 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5539 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5540 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5541 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5542 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5543 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5544 ; GFX10-CU-NEXT: s_endpgm
5546 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
5547 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5548 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
5549 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
5550 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5551 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5552 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5553 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
5554 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
5555 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5556 ; SKIP-CACHE-INV-NEXT: s_endpgm
5558 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
5559 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5560 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5561 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5562 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5563 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5564 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5565 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5566 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5568 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
5569 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5570 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5571 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5572 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5573 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5574 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5575 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5576 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5577 i32 addrspace(3)* %out, i32 %in, i32 %old) {
5579 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
5580 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel monotonic
5584 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_monotonic_cmpxchg(
5585 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
5586 ; GFX6: ; %bb.0: ; %entry
5587 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5588 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5589 ; GFX6-NEXT: s_mov_b32 m0, -1
5590 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5591 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5592 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5593 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5594 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5595 ; GFX6-NEXT: s_endpgm
5597 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
5598 ; GFX7: ; %bb.0: ; %entry
5599 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5600 ; GFX7-NEXT: s_mov_b32 m0, -1
5601 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5602 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5603 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5604 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5605 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5606 ; GFX7-NEXT: s_endpgm
5608 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
5609 ; GFX10-WGP: ; %bb.0: ; %entry
5610 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5611 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5612 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5613 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5614 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5615 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5616 ; GFX10-WGP-NEXT: s_endpgm
5618 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
5619 ; GFX10-CU: ; %bb.0: ; %entry
5620 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5621 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5622 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5623 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5624 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5625 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5626 ; GFX10-CU-NEXT: s_endpgm
5628 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
5629 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5630 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
5631 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
5632 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5633 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5634 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5635 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
5636 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
5637 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5638 ; SKIP-CACHE-INV-NEXT: s_endpgm
5640 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
5641 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5642 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5643 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5644 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5645 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5646 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5647 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5648 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5650 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
5651 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5652 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5653 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5654 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5655 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5656 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5657 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5658 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5659 i32 addrspace(3)* %out, i32 %in, i32 %old) {
5661 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
5662 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst monotonic
5666 define amdgpu_kernel void @local_singlethread_one_as_monotonic_acquire_cmpxchg(
5667 ; GFX6-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
5668 ; GFX6: ; %bb.0: ; %entry
5669 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5670 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5671 ; GFX6-NEXT: s_mov_b32 m0, -1
5672 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5673 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5674 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5675 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5676 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5677 ; GFX6-NEXT: s_endpgm
5679 ; GFX7-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
5680 ; GFX7: ; %bb.0: ; %entry
5681 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5682 ; GFX7-NEXT: s_mov_b32 m0, -1
5683 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5684 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5685 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5686 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5687 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5688 ; GFX7-NEXT: s_endpgm
5690 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
5691 ; GFX10-WGP: ; %bb.0: ; %entry
5692 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5693 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5694 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5695 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5696 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5697 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5698 ; GFX10-WGP-NEXT: s_endpgm
5700 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
5701 ; GFX10-CU: ; %bb.0: ; %entry
5702 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5703 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5704 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5705 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5706 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5707 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5708 ; GFX10-CU-NEXT: s_endpgm
5710 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
5711 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5712 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
5713 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
5714 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5715 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5716 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5717 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
5718 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
5719 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5720 ; SKIP-CACHE-INV-NEXT: s_endpgm
5722 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
5723 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5724 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5725 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5726 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5727 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5728 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5729 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5730 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5732 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
5733 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5734 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5735 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5736 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5737 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5738 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5739 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5740 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5741 i32 addrspace(3)* %out, i32 %in, i32 %old) {
5743 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
5744 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic acquire
5748 define amdgpu_kernel void @local_singlethread_one_as_acquire_acquire_cmpxchg(
5749 ; GFX6-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
5750 ; GFX6: ; %bb.0: ; %entry
5751 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5752 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5753 ; GFX6-NEXT: s_mov_b32 m0, -1
5754 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5755 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5756 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5757 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5758 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5759 ; GFX6-NEXT: s_endpgm
5761 ; GFX7-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
5762 ; GFX7: ; %bb.0: ; %entry
5763 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5764 ; GFX7-NEXT: s_mov_b32 m0, -1
5765 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5766 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5767 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5768 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5769 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5770 ; GFX7-NEXT: s_endpgm
5772 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
5773 ; GFX10-WGP: ; %bb.0: ; %entry
5774 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5775 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5776 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5777 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5778 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5779 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5780 ; GFX10-WGP-NEXT: s_endpgm
5782 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
5783 ; GFX10-CU: ; %bb.0: ; %entry
5784 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5785 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5786 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5787 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5788 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5789 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5790 ; GFX10-CU-NEXT: s_endpgm
5792 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
5793 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5794 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
5795 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
5796 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5797 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5798 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5799 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
5800 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
5801 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5802 ; SKIP-CACHE-INV-NEXT: s_endpgm
5804 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
5805 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5806 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5807 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5808 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5809 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5810 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5811 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5812 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5814 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
5815 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5816 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5817 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5818 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5819 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5820 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5821 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5822 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5823 i32 addrspace(3)* %out, i32 %in, i32 %old) {
5825 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
5826 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire acquire
5830 define amdgpu_kernel void @local_singlethread_one_as_release_acquire_cmpxchg(
5831 ; GFX6-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
5832 ; GFX6: ; %bb.0: ; %entry
5833 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5834 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5835 ; GFX6-NEXT: s_mov_b32 m0, -1
5836 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5837 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5838 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5839 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5840 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5841 ; GFX6-NEXT: s_endpgm
5843 ; GFX7-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
5844 ; GFX7: ; %bb.0: ; %entry
5845 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5846 ; GFX7-NEXT: s_mov_b32 m0, -1
5847 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5848 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5849 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5850 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5851 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5852 ; GFX7-NEXT: s_endpgm
5854 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
5855 ; GFX10-WGP: ; %bb.0: ; %entry
5856 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5857 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5858 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5859 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5860 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5861 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5862 ; GFX10-WGP-NEXT: s_endpgm
5864 ; GFX10-CU-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
5865 ; GFX10-CU: ; %bb.0: ; %entry
5866 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5867 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5868 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5869 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5870 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5871 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5872 ; GFX10-CU-NEXT: s_endpgm
5874 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
5875 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5876 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
5877 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
5878 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5879 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5880 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5881 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
5882 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
5883 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5884 ; SKIP-CACHE-INV-NEXT: s_endpgm
5886 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
5887 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5888 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5889 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5890 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5891 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5892 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5893 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5894 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5896 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
5897 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5898 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5899 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5900 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5901 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5902 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5903 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5904 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5905 i32 addrspace(3)* %out, i32 %in, i32 %old) {
5907 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
5908 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release acquire
5912 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_acquire_cmpxchg(
5913 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
5914 ; GFX6: ; %bb.0: ; %entry
5915 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5916 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5917 ; GFX6-NEXT: s_mov_b32 m0, -1
5918 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5919 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5920 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
5921 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
5922 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5923 ; GFX6-NEXT: s_endpgm
5925 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
5926 ; GFX7: ; %bb.0: ; %entry
5927 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5928 ; GFX7-NEXT: s_mov_b32 m0, -1
5929 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5930 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5931 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
5932 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
5933 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5934 ; GFX7-NEXT: s_endpgm
5936 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
5937 ; GFX10-WGP: ; %bb.0: ; %entry
5938 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5939 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5940 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5941 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
5942 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
5943 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5944 ; GFX10-WGP-NEXT: s_endpgm
5946 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
5947 ; GFX10-CU: ; %bb.0: ; %entry
5948 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5949 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5950 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5951 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
5952 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
5953 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5954 ; GFX10-CU-NEXT: s_endpgm
5956 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
5957 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5958 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
5959 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
5960 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5961 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5962 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5963 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
5964 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
5965 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5966 ; SKIP-CACHE-INV-NEXT: s_endpgm
5968 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
5969 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5970 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5971 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5972 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5973 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5974 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5975 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5976 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5978 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
5979 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5980 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5981 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5982 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5983 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5984 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5985 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5986 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5987 i32 addrspace(3)* %out, i32 %in, i32 %old) {
5989 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
5990 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel acquire
5994 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_acquire_cmpxchg(
5995 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
5996 ; GFX6: ; %bb.0: ; %entry
5997 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
5998 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
5999 ; GFX6-NEXT: s_mov_b32 m0, -1
6000 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6001 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6002 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6003 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6004 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6005 ; GFX6-NEXT: s_endpgm
6007 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
6008 ; GFX7: ; %bb.0: ; %entry
6009 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6010 ; GFX7-NEXT: s_mov_b32 m0, -1
6011 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6012 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6013 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6014 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6015 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6016 ; GFX7-NEXT: s_endpgm
6018 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
6019 ; GFX10-WGP: ; %bb.0: ; %entry
6020 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6021 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6022 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6023 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6024 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6025 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6026 ; GFX10-WGP-NEXT: s_endpgm
6028 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
6029 ; GFX10-CU: ; %bb.0: ; %entry
6030 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6031 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6032 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6033 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6034 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6035 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6036 ; GFX10-CU-NEXT: s_endpgm
6038 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
6039 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6040 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6041 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6042 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6043 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6044 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6045 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6046 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6047 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6048 ; SKIP-CACHE-INV-NEXT: s_endpgm
6050 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
6051 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6052 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6053 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6054 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6055 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6056 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6057 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6058 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6060 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
6061 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6062 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6063 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6064 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6065 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6066 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6067 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6068 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6069 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6071 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6072 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst acquire
6076 define amdgpu_kernel void @local_singlethread_one_as_monotonic_seq_cst_cmpxchg(
6077 ; GFX6-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
6078 ; GFX6: ; %bb.0: ; %entry
6079 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6080 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6081 ; GFX6-NEXT: s_mov_b32 m0, -1
6082 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6083 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6084 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6085 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6086 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6087 ; GFX6-NEXT: s_endpgm
6089 ; GFX7-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
6090 ; GFX7: ; %bb.0: ; %entry
6091 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6092 ; GFX7-NEXT: s_mov_b32 m0, -1
6093 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6094 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6095 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6096 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6097 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6098 ; GFX7-NEXT: s_endpgm
6100 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
6101 ; GFX10-WGP: ; %bb.0: ; %entry
6102 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6103 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6104 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6105 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6106 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6107 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6108 ; GFX10-WGP-NEXT: s_endpgm
6110 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
6111 ; GFX10-CU: ; %bb.0: ; %entry
6112 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6113 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6114 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6115 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6116 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6117 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6118 ; GFX10-CU-NEXT: s_endpgm
6120 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
6121 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6122 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6123 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6124 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6125 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6126 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6127 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6128 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6129 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6130 ; SKIP-CACHE-INV-NEXT: s_endpgm
6132 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
6133 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6134 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6135 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6136 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6137 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6138 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6139 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6140 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6142 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
6143 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6144 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6145 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6146 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6147 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6148 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6149 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6150 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6151 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6153 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6154 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic seq_cst
6158 define amdgpu_kernel void @local_singlethread_one_as_acquire_seq_cst_cmpxchg(
6159 ; GFX6-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
6160 ; GFX6: ; %bb.0: ; %entry
6161 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6162 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6163 ; GFX6-NEXT: s_mov_b32 m0, -1
6164 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6165 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6166 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6167 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6168 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6169 ; GFX6-NEXT: s_endpgm
6171 ; GFX7-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
6172 ; GFX7: ; %bb.0: ; %entry
6173 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6174 ; GFX7-NEXT: s_mov_b32 m0, -1
6175 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6176 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6177 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6178 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6179 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6180 ; GFX7-NEXT: s_endpgm
6182 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
6183 ; GFX10-WGP: ; %bb.0: ; %entry
6184 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6185 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6186 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6187 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6188 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6189 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6190 ; GFX10-WGP-NEXT: s_endpgm
6192 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
6193 ; GFX10-CU: ; %bb.0: ; %entry
6194 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6195 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6196 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6197 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6198 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6199 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6200 ; GFX10-CU-NEXT: s_endpgm
6202 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
6203 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6204 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6205 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6206 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6207 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6208 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6209 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6210 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6211 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6212 ; SKIP-CACHE-INV-NEXT: s_endpgm
6214 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
6215 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6216 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6217 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6218 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6219 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6220 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6221 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6222 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6224 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
6225 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6226 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6227 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6228 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6229 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6230 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6231 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6232 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6233 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6235 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6236 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire seq_cst
6240 define amdgpu_kernel void @local_singlethread_one_as_release_seq_cst_cmpxchg(
6241 ; GFX6-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
6242 ; GFX6: ; %bb.0: ; %entry
6243 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6244 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6245 ; GFX6-NEXT: s_mov_b32 m0, -1
6246 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6247 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6248 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6249 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6250 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6251 ; GFX6-NEXT: s_endpgm
6253 ; GFX7-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
6254 ; GFX7: ; %bb.0: ; %entry
6255 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6256 ; GFX7-NEXT: s_mov_b32 m0, -1
6257 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6258 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6259 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6260 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6261 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6262 ; GFX7-NEXT: s_endpgm
6264 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
6265 ; GFX10-WGP: ; %bb.0: ; %entry
6266 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6267 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6268 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6269 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6270 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6271 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6272 ; GFX10-WGP-NEXT: s_endpgm
6274 ; GFX10-CU-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
6275 ; GFX10-CU: ; %bb.0: ; %entry
6276 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6277 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6278 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6279 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6280 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6281 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6282 ; GFX10-CU-NEXT: s_endpgm
6284 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
6285 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6286 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6287 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6288 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6289 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6290 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6291 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6292 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6293 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6294 ; SKIP-CACHE-INV-NEXT: s_endpgm
6296 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
6297 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6298 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6299 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6300 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6301 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6302 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6303 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6304 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6306 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
6307 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6308 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6309 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6310 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6311 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6312 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6313 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6314 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6315 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6317 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6318 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release seq_cst
6322 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_seq_cst_cmpxchg(
6323 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
6324 ; GFX6: ; %bb.0: ; %entry
6325 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6326 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6327 ; GFX6-NEXT: s_mov_b32 m0, -1
6328 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6329 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6330 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6331 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6332 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6333 ; GFX6-NEXT: s_endpgm
6335 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
6336 ; GFX7: ; %bb.0: ; %entry
6337 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6338 ; GFX7-NEXT: s_mov_b32 m0, -1
6339 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6340 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6341 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6342 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6343 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6344 ; GFX7-NEXT: s_endpgm
6346 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
6347 ; GFX10-WGP: ; %bb.0: ; %entry
6348 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6349 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6350 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6351 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6352 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6353 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6354 ; GFX10-WGP-NEXT: s_endpgm
6356 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
6357 ; GFX10-CU: ; %bb.0: ; %entry
6358 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6359 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6360 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6361 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6362 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6363 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6364 ; GFX10-CU-NEXT: s_endpgm
6366 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
6367 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6368 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6369 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6370 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6371 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6372 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6373 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6374 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6375 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6376 ; SKIP-CACHE-INV-NEXT: s_endpgm
6378 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
6379 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6380 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6381 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6382 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6383 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6384 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6385 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6386 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6388 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
6389 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6390 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6391 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6392 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6393 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6394 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6395 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6396 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6397 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6399 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6400 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel seq_cst
6404 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_seq_cst_cmpxchg(
6405 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
6406 ; GFX6: ; %bb.0: ; %entry
6407 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6408 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6409 ; GFX6-NEXT: s_mov_b32 m0, -1
6410 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6411 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6412 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6413 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6414 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6415 ; GFX6-NEXT: s_endpgm
6417 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
6418 ; GFX7: ; %bb.0: ; %entry
6419 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6420 ; GFX7-NEXT: s_mov_b32 m0, -1
6421 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6422 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6423 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6424 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6425 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6426 ; GFX7-NEXT: s_endpgm
6428 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
6429 ; GFX10-WGP: ; %bb.0: ; %entry
6430 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6431 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6432 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6433 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6434 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6435 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6436 ; GFX10-WGP-NEXT: s_endpgm
6438 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
6439 ; GFX10-CU: ; %bb.0: ; %entry
6440 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6441 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6442 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6443 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6444 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6445 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6446 ; GFX10-CU-NEXT: s_endpgm
6448 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
6449 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6450 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6451 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6452 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6453 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6454 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6455 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6456 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6457 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6458 ; SKIP-CACHE-INV-NEXT: s_endpgm
6460 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
6461 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6462 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6463 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6464 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6465 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6466 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6467 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6468 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6470 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
6471 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6472 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6473 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6474 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6475 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6476 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6477 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
6478 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6479 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6481 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6482 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst seq_cst
6486 define amdgpu_kernel void @local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg(
6487 ; GFX6-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
6488 ; GFX6: ; %bb.0: ; %entry
6489 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6490 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6491 ; GFX6-NEXT: s_mov_b32 m0, -1
6492 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6493 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6494 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6495 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6496 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6497 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6498 ; GFX6-NEXT: ds_write_b32 v0, v1
6499 ; GFX6-NEXT: s_endpgm
6501 ; GFX7-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
6502 ; GFX7: ; %bb.0: ; %entry
6503 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6504 ; GFX7-NEXT: s_mov_b32 m0, -1
6505 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6506 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6507 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6508 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6509 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6510 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6511 ; GFX7-NEXT: ds_write_b32 v0, v1
6512 ; GFX7-NEXT: s_endpgm
6514 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
6515 ; GFX10-WGP: ; %bb.0: ; %entry
6516 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6517 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6518 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6519 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6520 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6521 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6522 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6523 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6524 ; GFX10-WGP-NEXT: s_endpgm
6526 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
6527 ; GFX10-CU: ; %bb.0: ; %entry
6528 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6529 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6530 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6531 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6532 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6533 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6534 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6535 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6536 ; GFX10-CU-NEXT: s_endpgm
6538 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
6539 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6540 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6541 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6542 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6543 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6544 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6545 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6546 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6547 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6548 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6549 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6550 ; SKIP-CACHE-INV-NEXT: s_endpgm
6552 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
6553 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6554 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6555 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6556 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6557 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6558 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6559 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6560 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6561 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6562 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6564 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
6565 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6566 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6567 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6568 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6569 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6570 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6571 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6572 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6573 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6574 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6575 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6577 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6578 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic monotonic
6579 %val0 = extractvalue { i32, i1 } %val, 0
6580 store i32 %val0, i32 addrspace(3)* %out, align 4
6584 define amdgpu_kernel void @local_singlethread_one_as_acquire_monotonic_ret_cmpxchg(
6585 ; GFX6-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
6586 ; GFX6: ; %bb.0: ; %entry
6587 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6588 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6589 ; GFX6-NEXT: s_mov_b32 m0, -1
6590 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6591 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6592 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6593 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6594 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6595 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6596 ; GFX6-NEXT: ds_write_b32 v0, v1
6597 ; GFX6-NEXT: s_endpgm
6599 ; GFX7-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
6600 ; GFX7: ; %bb.0: ; %entry
6601 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6602 ; GFX7-NEXT: s_mov_b32 m0, -1
6603 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6604 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6605 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6606 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6607 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6608 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6609 ; GFX7-NEXT: ds_write_b32 v0, v1
6610 ; GFX7-NEXT: s_endpgm
6612 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
6613 ; GFX10-WGP: ; %bb.0: ; %entry
6614 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6615 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6616 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6617 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6618 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6619 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6620 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6621 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6622 ; GFX10-WGP-NEXT: s_endpgm
6624 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
6625 ; GFX10-CU: ; %bb.0: ; %entry
6626 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6627 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6628 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6629 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6630 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6631 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6632 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6633 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6634 ; GFX10-CU-NEXT: s_endpgm
6636 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
6637 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6638 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6639 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6640 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6641 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6642 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6643 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6644 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6645 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6646 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6647 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6648 ; SKIP-CACHE-INV-NEXT: s_endpgm
6650 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
6651 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6652 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6653 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6654 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6655 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6656 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6657 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6658 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6659 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6660 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6662 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
6663 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6664 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6665 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6666 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6667 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6668 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6669 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6670 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6671 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6672 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6673 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6675 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6676 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire monotonic
6677 %val0 = extractvalue { i32, i1 } %val, 0
6678 store i32 %val0, i32 addrspace(3)* %out, align 4
6682 define amdgpu_kernel void @local_singlethread_one_as_release_monotonic_ret_cmpxchg(
6683 ; GFX6-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
6684 ; GFX6: ; %bb.0: ; %entry
6685 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6686 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6687 ; GFX6-NEXT: s_mov_b32 m0, -1
6688 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6689 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6690 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6691 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6692 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6693 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6694 ; GFX6-NEXT: ds_write_b32 v0, v1
6695 ; GFX6-NEXT: s_endpgm
6697 ; GFX7-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
6698 ; GFX7: ; %bb.0: ; %entry
6699 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6700 ; GFX7-NEXT: s_mov_b32 m0, -1
6701 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6702 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6703 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6704 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6705 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6706 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6707 ; GFX7-NEXT: ds_write_b32 v0, v1
6708 ; GFX7-NEXT: s_endpgm
6710 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
6711 ; GFX10-WGP: ; %bb.0: ; %entry
6712 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6713 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6714 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6715 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6716 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6717 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6718 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6719 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6720 ; GFX10-WGP-NEXT: s_endpgm
6722 ; GFX10-CU-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
6723 ; GFX10-CU: ; %bb.0: ; %entry
6724 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6725 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6726 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6727 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6728 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6729 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6730 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6731 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6732 ; GFX10-CU-NEXT: s_endpgm
6734 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
6735 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6736 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6737 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6738 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6739 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6740 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6741 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6742 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6743 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6744 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6745 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6746 ; SKIP-CACHE-INV-NEXT: s_endpgm
6748 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
6749 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6750 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6751 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6752 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6753 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6754 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6755 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6756 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6757 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6758 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6760 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
6761 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6762 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6763 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6764 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6765 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6766 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6767 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6768 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6769 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6770 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6771 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6773 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6774 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release monotonic
6775 %val0 = extractvalue { i32, i1 } %val, 0
6776 store i32 %val0, i32 addrspace(3)* %out, align 4
6780 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg(
6781 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
6782 ; GFX6: ; %bb.0: ; %entry
6783 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6784 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6785 ; GFX6-NEXT: s_mov_b32 m0, -1
6786 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6787 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6788 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6789 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6790 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6791 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6792 ; GFX6-NEXT: ds_write_b32 v0, v1
6793 ; GFX6-NEXT: s_endpgm
6795 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
6796 ; GFX7: ; %bb.0: ; %entry
6797 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6798 ; GFX7-NEXT: s_mov_b32 m0, -1
6799 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6800 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6801 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6802 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6803 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6804 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6805 ; GFX7-NEXT: ds_write_b32 v0, v1
6806 ; GFX7-NEXT: s_endpgm
6808 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
6809 ; GFX10-WGP: ; %bb.0: ; %entry
6810 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6811 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6812 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6813 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6814 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6815 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6816 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6817 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6818 ; GFX10-WGP-NEXT: s_endpgm
6820 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
6821 ; GFX10-CU: ; %bb.0: ; %entry
6822 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6823 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6824 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6825 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6826 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6827 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6828 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6829 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6830 ; GFX10-CU-NEXT: s_endpgm
6832 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
6833 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6834 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6835 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6836 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6837 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6838 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6839 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6840 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6841 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6842 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6843 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6844 ; SKIP-CACHE-INV-NEXT: s_endpgm
6846 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
6847 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6848 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6849 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6850 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6851 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6852 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6853 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6854 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6855 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6856 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6858 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
6859 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6860 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6861 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6862 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6863 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6864 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6865 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6866 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6867 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6868 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6869 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6871 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6872 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel monotonic
6873 %val0 = extractvalue { i32, i1 } %val, 0
6874 store i32 %val0, i32 addrspace(3)* %out, align 4
6878 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg(
6879 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
6880 ; GFX6: ; %bb.0: ; %entry
6881 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6882 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6883 ; GFX6-NEXT: s_mov_b32 m0, -1
6884 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6885 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6886 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6887 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6888 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6889 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6890 ; GFX6-NEXT: ds_write_b32 v0, v1
6891 ; GFX6-NEXT: s_endpgm
6893 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
6894 ; GFX7: ; %bb.0: ; %entry
6895 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6896 ; GFX7-NEXT: s_mov_b32 m0, -1
6897 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6898 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6899 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6900 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6901 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6902 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6903 ; GFX7-NEXT: ds_write_b32 v0, v1
6904 ; GFX7-NEXT: s_endpgm
6906 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
6907 ; GFX10-WGP: ; %bb.0: ; %entry
6908 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6909 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6910 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6911 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6912 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
6913 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6914 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6915 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6916 ; GFX10-WGP-NEXT: s_endpgm
6918 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
6919 ; GFX10-CU: ; %bb.0: ; %entry
6920 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6921 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6922 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6923 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6924 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
6925 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6926 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6927 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6928 ; GFX10-CU-NEXT: s_endpgm
6930 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
6931 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6932 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
6933 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
6934 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6935 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6936 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6937 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
6938 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
6939 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6940 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6941 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6942 ; SKIP-CACHE-INV-NEXT: s_endpgm
6944 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
6945 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6946 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6947 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6948 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6949 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6950 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6951 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6952 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6953 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6954 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6956 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
6957 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6958 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6959 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6960 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6961 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6962 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6963 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6964 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6965 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6966 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6967 i32 addrspace(3)* %out, i32 %in, i32 %old) {
6969 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
6970 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst monotonic
6971 %val0 = extractvalue { i32, i1 } %val, 0
6972 store i32 %val0, i32 addrspace(3)* %out, align 4
6976 define amdgpu_kernel void @local_singlethread_one_as_monotonic_acquire_ret_cmpxchg(
6977 ; GFX6-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
6978 ; GFX6: ; %bb.0: ; %entry
6979 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
6980 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
6981 ; GFX6-NEXT: s_mov_b32 m0, -1
6982 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6983 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6984 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
6985 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
6986 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6987 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6988 ; GFX6-NEXT: ds_write_b32 v0, v1
6989 ; GFX6-NEXT: s_endpgm
6991 ; GFX7-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
6992 ; GFX7: ; %bb.0: ; %entry
6993 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6994 ; GFX7-NEXT: s_mov_b32 m0, -1
6995 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6996 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6997 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
6998 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
6999 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7000 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7001 ; GFX7-NEXT: ds_write_b32 v0, v1
7002 ; GFX7-NEXT: s_endpgm
7004 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
7005 ; GFX10-WGP: ; %bb.0: ; %entry
7006 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7007 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7008 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7009 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7010 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7011 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7012 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7013 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7014 ; GFX10-WGP-NEXT: s_endpgm
7016 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
7017 ; GFX10-CU: ; %bb.0: ; %entry
7018 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7019 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7020 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7021 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7022 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7023 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7024 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7025 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7026 ; GFX10-CU-NEXT: s_endpgm
7028 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
7029 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7030 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7031 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7032 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7033 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7034 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7035 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7036 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7037 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7038 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7039 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7040 ; SKIP-CACHE-INV-NEXT: s_endpgm
7042 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
7043 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7044 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7045 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7046 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7047 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7048 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7049 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7050 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7051 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7052 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7054 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
7055 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7056 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7057 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7058 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7059 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7060 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7061 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7062 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7063 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7064 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7065 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7067 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7068 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic acquire
7069 %val0 = extractvalue { i32, i1 } %val, 0
7070 store i32 %val0, i32 addrspace(3)* %out, align 4
7074 define amdgpu_kernel void @local_singlethread_one_as_acquire_acquire_ret_cmpxchg(
7075 ; GFX6-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
7076 ; GFX6: ; %bb.0: ; %entry
7077 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7078 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7079 ; GFX6-NEXT: s_mov_b32 m0, -1
7080 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7081 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7082 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7083 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7084 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7085 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7086 ; GFX6-NEXT: ds_write_b32 v0, v1
7087 ; GFX6-NEXT: s_endpgm
7089 ; GFX7-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
7090 ; GFX7: ; %bb.0: ; %entry
7091 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7092 ; GFX7-NEXT: s_mov_b32 m0, -1
7093 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7094 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7095 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7096 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7097 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7098 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7099 ; GFX7-NEXT: ds_write_b32 v0, v1
7100 ; GFX7-NEXT: s_endpgm
7102 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
7103 ; GFX10-WGP: ; %bb.0: ; %entry
7104 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7105 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7106 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7107 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7108 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7109 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7110 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7111 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7112 ; GFX10-WGP-NEXT: s_endpgm
7114 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
7115 ; GFX10-CU: ; %bb.0: ; %entry
7116 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7117 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7118 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7119 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7120 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7121 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7122 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7123 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7124 ; GFX10-CU-NEXT: s_endpgm
7126 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
7127 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7128 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7129 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7130 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7131 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7132 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7133 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7134 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7135 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7136 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7137 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7138 ; SKIP-CACHE-INV-NEXT: s_endpgm
7140 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
7141 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7142 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7143 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7144 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7145 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7146 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7147 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7148 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7149 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7150 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7152 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
7153 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7154 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7155 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7156 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7157 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7158 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7159 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7160 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7161 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7162 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7163 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7165 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7166 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire acquire
7167 %val0 = extractvalue { i32, i1 } %val, 0
7168 store i32 %val0, i32 addrspace(3)* %out, align 4
7172 define amdgpu_kernel void @local_singlethread_one_as_release_acquire_ret_cmpxchg(
7173 ; GFX6-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
7174 ; GFX6: ; %bb.0: ; %entry
7175 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7176 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7177 ; GFX6-NEXT: s_mov_b32 m0, -1
7178 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7179 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7180 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7181 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7182 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7183 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7184 ; GFX6-NEXT: ds_write_b32 v0, v1
7185 ; GFX6-NEXT: s_endpgm
7187 ; GFX7-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
7188 ; GFX7: ; %bb.0: ; %entry
7189 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7190 ; GFX7-NEXT: s_mov_b32 m0, -1
7191 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7192 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7193 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7194 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7195 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7196 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7197 ; GFX7-NEXT: ds_write_b32 v0, v1
7198 ; GFX7-NEXT: s_endpgm
7200 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
7201 ; GFX10-WGP: ; %bb.0: ; %entry
7202 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7203 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7204 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7205 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7206 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7207 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7208 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7209 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7210 ; GFX10-WGP-NEXT: s_endpgm
7212 ; GFX10-CU-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
7213 ; GFX10-CU: ; %bb.0: ; %entry
7214 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7215 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7216 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7217 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7218 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7219 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7220 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7221 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7222 ; GFX10-CU-NEXT: s_endpgm
7224 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
7225 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7226 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7227 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7228 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7229 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7230 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7231 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7232 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7233 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7234 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7235 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7236 ; SKIP-CACHE-INV-NEXT: s_endpgm
7238 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
7239 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7240 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7241 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7242 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7243 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7244 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7245 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7246 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7247 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7248 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7250 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
7251 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7252 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7253 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7254 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7255 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7256 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7257 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7258 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7259 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7260 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7261 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7263 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7264 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release acquire
7265 %val0 = extractvalue { i32, i1 } %val, 0
7266 store i32 %val0, i32 addrspace(3)* %out, align 4
7270 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg(
7271 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
7272 ; GFX6: ; %bb.0: ; %entry
7273 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7274 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7275 ; GFX6-NEXT: s_mov_b32 m0, -1
7276 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7277 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7278 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7279 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7280 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7281 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7282 ; GFX6-NEXT: ds_write_b32 v0, v1
7283 ; GFX6-NEXT: s_endpgm
7285 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
7286 ; GFX7: ; %bb.0: ; %entry
7287 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7288 ; GFX7-NEXT: s_mov_b32 m0, -1
7289 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7290 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7291 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7292 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7293 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7294 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7295 ; GFX7-NEXT: ds_write_b32 v0, v1
7296 ; GFX7-NEXT: s_endpgm
7298 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
7299 ; GFX10-WGP: ; %bb.0: ; %entry
7300 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7301 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7302 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7303 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7304 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7305 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7306 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7307 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7308 ; GFX10-WGP-NEXT: s_endpgm
7310 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
7311 ; GFX10-CU: ; %bb.0: ; %entry
7312 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7313 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7314 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7315 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7316 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7317 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7318 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7319 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7320 ; GFX10-CU-NEXT: s_endpgm
7322 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
7323 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7324 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7325 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7326 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7327 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7328 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7329 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7330 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7331 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7332 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7333 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7334 ; SKIP-CACHE-INV-NEXT: s_endpgm
7336 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
7337 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7338 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7339 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7340 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7341 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7342 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7343 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7344 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7345 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7346 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7348 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
7349 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7350 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7351 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7352 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7353 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7354 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7355 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7356 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7357 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7358 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7359 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7361 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7362 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel acquire
7363 %val0 = extractvalue { i32, i1 } %val, 0
7364 store i32 %val0, i32 addrspace(3)* %out, align 4
7368 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg(
7369 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
7370 ; GFX6: ; %bb.0: ; %entry
7371 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7372 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7373 ; GFX6-NEXT: s_mov_b32 m0, -1
7374 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7375 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7376 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7377 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7378 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7379 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7380 ; GFX6-NEXT: ds_write_b32 v0, v1
7381 ; GFX6-NEXT: s_endpgm
7383 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
7384 ; GFX7: ; %bb.0: ; %entry
7385 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7386 ; GFX7-NEXT: s_mov_b32 m0, -1
7387 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7388 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7389 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7390 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7391 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7392 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7393 ; GFX7-NEXT: ds_write_b32 v0, v1
7394 ; GFX7-NEXT: s_endpgm
7396 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
7397 ; GFX10-WGP: ; %bb.0: ; %entry
7398 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7399 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7400 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7401 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7402 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7403 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7404 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7405 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7406 ; GFX10-WGP-NEXT: s_endpgm
7408 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
7409 ; GFX10-CU: ; %bb.0: ; %entry
7410 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7411 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7412 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7413 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7414 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7415 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7416 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7417 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7418 ; GFX10-CU-NEXT: s_endpgm
7420 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
7421 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7422 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7423 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7424 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7425 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7426 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7427 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7428 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7429 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7430 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7431 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7432 ; SKIP-CACHE-INV-NEXT: s_endpgm
7434 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
7435 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7436 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7437 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7438 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7439 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7440 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7441 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7442 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7443 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7444 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7446 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
7447 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7448 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7449 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7450 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7451 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7452 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7453 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7454 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7455 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7456 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7457 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7459 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7460 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst acquire
7461 %val0 = extractvalue { i32, i1 } %val, 0
7462 store i32 %val0, i32 addrspace(3)* %out, align 4
7466 define amdgpu_kernel void @local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg(
7467 ; GFX6-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
7468 ; GFX6: ; %bb.0: ; %entry
7469 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7470 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7471 ; GFX6-NEXT: s_mov_b32 m0, -1
7472 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7473 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7474 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7475 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7476 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7477 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7478 ; GFX6-NEXT: ds_write_b32 v0, v1
7479 ; GFX6-NEXT: s_endpgm
7481 ; GFX7-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
7482 ; GFX7: ; %bb.0: ; %entry
7483 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7484 ; GFX7-NEXT: s_mov_b32 m0, -1
7485 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7486 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7487 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7488 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7489 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7490 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7491 ; GFX7-NEXT: ds_write_b32 v0, v1
7492 ; GFX7-NEXT: s_endpgm
7494 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
7495 ; GFX10-WGP: ; %bb.0: ; %entry
7496 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7497 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7498 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7499 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7500 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7501 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7502 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7503 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7504 ; GFX10-WGP-NEXT: s_endpgm
7506 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
7507 ; GFX10-CU: ; %bb.0: ; %entry
7508 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7509 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7510 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7511 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7512 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7513 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7514 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7515 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7516 ; GFX10-CU-NEXT: s_endpgm
7518 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
7519 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7520 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7521 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7522 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7523 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7524 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7525 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7526 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7527 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7528 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7529 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7530 ; SKIP-CACHE-INV-NEXT: s_endpgm
7532 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
7533 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7534 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7535 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7536 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7537 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7538 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7539 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7540 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7541 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7542 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7544 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
7545 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7546 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7547 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7548 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7549 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7550 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7551 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7552 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7553 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7554 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7555 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7557 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7558 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic seq_cst
7559 %val0 = extractvalue { i32, i1 } %val, 0
7560 store i32 %val0, i32 addrspace(3)* %out, align 4
7564 define amdgpu_kernel void @local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg(
7565 ; GFX6-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
7566 ; GFX6: ; %bb.0: ; %entry
7567 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7568 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7569 ; GFX6-NEXT: s_mov_b32 m0, -1
7570 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7571 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7572 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7573 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7574 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7575 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7576 ; GFX6-NEXT: ds_write_b32 v0, v1
7577 ; GFX6-NEXT: s_endpgm
7579 ; GFX7-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
7580 ; GFX7: ; %bb.0: ; %entry
7581 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7582 ; GFX7-NEXT: s_mov_b32 m0, -1
7583 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7584 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7585 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7586 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7587 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7588 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7589 ; GFX7-NEXT: ds_write_b32 v0, v1
7590 ; GFX7-NEXT: s_endpgm
7592 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
7593 ; GFX10-WGP: ; %bb.0: ; %entry
7594 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7595 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7596 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7597 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7598 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7599 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7600 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7601 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7602 ; GFX10-WGP-NEXT: s_endpgm
7604 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
7605 ; GFX10-CU: ; %bb.0: ; %entry
7606 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7607 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7608 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7609 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7610 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7611 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7612 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7613 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7614 ; GFX10-CU-NEXT: s_endpgm
7616 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
7617 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7618 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7619 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7620 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7621 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7622 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7623 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7624 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7625 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7626 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7627 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7628 ; SKIP-CACHE-INV-NEXT: s_endpgm
7630 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
7631 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7632 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7633 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7634 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7635 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7636 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7637 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7638 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7639 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7640 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7642 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
7643 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7644 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7645 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7646 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7647 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7648 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7649 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7650 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7651 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7652 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7653 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7655 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7656 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire seq_cst
7657 %val0 = extractvalue { i32, i1 } %val, 0
7658 store i32 %val0, i32 addrspace(3)* %out, align 4
7662 define amdgpu_kernel void @local_singlethread_one_as_release_seq_cst_ret_cmpxchg(
7663 ; GFX6-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
7664 ; GFX6: ; %bb.0: ; %entry
7665 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7666 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7667 ; GFX6-NEXT: s_mov_b32 m0, -1
7668 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7669 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7670 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7671 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7672 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7673 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7674 ; GFX6-NEXT: ds_write_b32 v0, v1
7675 ; GFX6-NEXT: s_endpgm
7677 ; GFX7-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
7678 ; GFX7: ; %bb.0: ; %entry
7679 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7680 ; GFX7-NEXT: s_mov_b32 m0, -1
7681 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7682 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7683 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7684 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7685 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7686 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7687 ; GFX7-NEXT: ds_write_b32 v0, v1
7688 ; GFX7-NEXT: s_endpgm
7690 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
7691 ; GFX10-WGP: ; %bb.0: ; %entry
7692 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7693 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7694 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7695 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7696 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7697 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7698 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7699 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7700 ; GFX10-WGP-NEXT: s_endpgm
7702 ; GFX10-CU-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
7703 ; GFX10-CU: ; %bb.0: ; %entry
7704 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7705 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7706 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7707 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7708 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7709 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7710 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7711 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7712 ; GFX10-CU-NEXT: s_endpgm
7714 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
7715 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7716 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7717 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7718 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7719 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7720 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7721 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7722 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7723 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7724 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7725 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7726 ; SKIP-CACHE-INV-NEXT: s_endpgm
7728 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
7729 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7730 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7731 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7732 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7733 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7734 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7735 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7736 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7737 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7738 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7740 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
7741 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7742 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7743 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7744 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7745 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7746 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7747 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7748 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7749 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7750 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7751 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7753 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7754 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release seq_cst
7755 %val0 = extractvalue { i32, i1 } %val, 0
7756 store i32 %val0, i32 addrspace(3)* %out, align 4
7760 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg(
7761 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
7762 ; GFX6: ; %bb.0: ; %entry
7763 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7764 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7765 ; GFX6-NEXT: s_mov_b32 m0, -1
7766 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7767 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7768 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7769 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7770 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7771 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7772 ; GFX6-NEXT: ds_write_b32 v0, v1
7773 ; GFX6-NEXT: s_endpgm
7775 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
7776 ; GFX7: ; %bb.0: ; %entry
7777 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7778 ; GFX7-NEXT: s_mov_b32 m0, -1
7779 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7780 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7781 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7782 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7783 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7784 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7785 ; GFX7-NEXT: ds_write_b32 v0, v1
7786 ; GFX7-NEXT: s_endpgm
7788 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
7789 ; GFX10-WGP: ; %bb.0: ; %entry
7790 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7791 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7792 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7793 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7794 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7795 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7796 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7797 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7798 ; GFX10-WGP-NEXT: s_endpgm
7800 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
7801 ; GFX10-CU: ; %bb.0: ; %entry
7802 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7803 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7804 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7805 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7806 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7807 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7808 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7809 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7810 ; GFX10-CU-NEXT: s_endpgm
7812 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
7813 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7814 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7815 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7816 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7817 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7818 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7819 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7820 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7821 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7822 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7823 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7824 ; SKIP-CACHE-INV-NEXT: s_endpgm
7826 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
7827 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7828 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7829 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7830 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7831 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7832 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7833 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7834 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7835 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7836 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7838 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
7839 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7840 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7841 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7842 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7843 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7844 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7845 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7846 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7847 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7848 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7849 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7851 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7852 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel seq_cst
7853 %val0 = extractvalue { i32, i1 } %val, 0
7854 store i32 %val0, i32 addrspace(3)* %out, align 4
7858 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg(
7859 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
7860 ; GFX6: ; %bb.0: ; %entry
7861 ; GFX6-NEXT: s_load_dword s2, s[4:5], 0x0
7862 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x1
7863 ; GFX6-NEXT: s_mov_b32 m0, -1
7864 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7865 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
7866 ; GFX6-NEXT: v_mov_b32_e32 v1, s1
7867 ; GFX6-NEXT: v_mov_b32_e32 v2, s0
7868 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7869 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7870 ; GFX6-NEXT: ds_write_b32 v0, v1
7871 ; GFX6-NEXT: s_endpgm
7873 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
7874 ; GFX7: ; %bb.0: ; %entry
7875 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7876 ; GFX7-NEXT: s_mov_b32 m0, -1
7877 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7878 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7879 ; GFX7-NEXT: v_mov_b32_e32 v1, s2
7880 ; GFX7-NEXT: v_mov_b32_e32 v2, s1
7881 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7882 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7883 ; GFX7-NEXT: ds_write_b32 v0, v1
7884 ; GFX7-NEXT: s_endpgm
7886 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
7887 ; GFX10-WGP: ; %bb.0: ; %entry
7888 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7889 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7890 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7891 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7892 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s1
7893 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7894 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7895 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7896 ; GFX10-WGP-NEXT: s_endpgm
7898 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
7899 ; GFX10-CU: ; %bb.0: ; %entry
7900 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7901 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7902 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7903 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7904 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s1
7905 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7906 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7907 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7908 ; GFX10-CU-NEXT: s_endpgm
7910 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
7911 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7912 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x9
7913 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0xb
7914 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7915 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7916 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7917 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
7918 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s3
7919 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7920 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7921 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7922 ; SKIP-CACHE-INV-NEXT: s_endpgm
7924 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
7925 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7926 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7927 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7928 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7929 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7930 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7931 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7932 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7933 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7934 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7936 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
7937 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7938 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7939 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7940 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7941 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7942 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7943 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7944 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7945 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7946 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7947 i32 addrspace(3)* %out, i32 %in, i32 %old) {
7949 %gep = getelementptr i32, i32 addrspace(3)* %out, i32 4
7950 %val = cmpxchg volatile i32 addrspace(3)* %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst seq_cst
7951 %val0 = extractvalue { i32, i1 } %val, 0
7952 store i32 %val0, i32 addrspace(3)* %out, align 4