1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx600 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX6 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX7 %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-WGP %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=+cumode -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-CU %s
6 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx700 -amdgcn-skip-cache-invalidations -verify-machineinstrs < %s | FileCheck --check-prefixes=SKIP-CACHE-INV %s
7 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX90A-NOTTGSPLIT %s
8 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -mattr=+tgsplit -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX90A-TGSPLIT %s
9 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX940-NOTTGSPLIT %s
10 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 -mattr=+tgsplit -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX940-TGSPLIT %s
11 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11-WGP %s
12 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=+cumode -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11-CU %s
14 define amdgpu_kernel void @global_singlethread_unordered_load(
15 ; GFX6-LABEL: global_singlethread_unordered_load:
16 ; GFX6: ; %bb.0: ; %entry
17 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
18 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
19 ; GFX6-NEXT: s_mov_b32 s6, -1
20 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
21 ; GFX6-NEXT: s_mov_b32 s4, s0
22 ; GFX6-NEXT: s_mov_b32 s5, s1
23 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0
24 ; GFX6-NEXT: s_mov_b32 s4, s2
25 ; GFX6-NEXT: s_mov_b32 s5, s3
26 ; GFX6-NEXT: s_waitcnt vmcnt(0)
27 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
30 ; GFX7-LABEL: global_singlethread_unordered_load:
31 ; GFX7: ; %bb.0: ; %entry
32 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
33 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
34 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
35 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
36 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
37 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
38 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
39 ; GFX7-NEXT: s_waitcnt vmcnt(0)
40 ; GFX7-NEXT: flat_store_dword v[0:1], v2
43 ; GFX10-WGP-LABEL: global_singlethread_unordered_load:
44 ; GFX10-WGP: ; %bb.0: ; %entry
45 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
46 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
47 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
48 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1]
49 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
50 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
51 ; GFX10-WGP-NEXT: s_endpgm
53 ; GFX10-CU-LABEL: global_singlethread_unordered_load:
54 ; GFX10-CU: ; %bb.0: ; %entry
55 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
56 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
57 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
58 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1]
59 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
60 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
61 ; GFX10-CU-NEXT: s_endpgm
63 ; SKIP-CACHE-INV-LABEL: global_singlethread_unordered_load:
64 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
65 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
66 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
67 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
68 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
69 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
70 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
71 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
72 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
73 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
74 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
75 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
76 ; SKIP-CACHE-INV-NEXT: s_endpgm
78 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_unordered_load:
79 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
80 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
81 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
82 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
83 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
84 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
85 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
86 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
88 ; GFX90A-TGSPLIT-LABEL: global_singlethread_unordered_load:
89 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
90 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
91 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
92 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
93 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
94 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
95 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
96 ; GFX90A-TGSPLIT-NEXT: s_endpgm
98 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_unordered_load:
99 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
100 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
101 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
102 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
103 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
104 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
105 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
106 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
108 ; GFX940-TGSPLIT-LABEL: global_singlethread_unordered_load:
109 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
110 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
111 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
112 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
113 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
114 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
115 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
116 ; GFX940-TGSPLIT-NEXT: s_endpgm
118 ; GFX11-WGP-LABEL: global_singlethread_unordered_load:
119 ; GFX11-WGP: ; %bb.0: ; %entry
120 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
121 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
122 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
123 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1]
124 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
125 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
126 ; GFX11-WGP-NEXT: s_nop 0
127 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
128 ; GFX11-WGP-NEXT: s_endpgm
130 ; GFX11-CU-LABEL: global_singlethread_unordered_load:
131 ; GFX11-CU: ; %bb.0: ; %entry
132 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
133 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
134 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
135 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
136 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
137 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
138 ; GFX11-CU-NEXT: s_nop 0
139 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
140 ; GFX11-CU-NEXT: s_endpgm
141 ptr addrspace(1) %in, ptr addrspace(1) %out) {
143 %val = load atomic i32, ptr addrspace(1) %in syncscope("singlethread") unordered, align 4
144 store i32 %val, ptr addrspace(1) %out
148 define amdgpu_kernel void @global_singlethread_monotonic_load(
149 ; GFX6-LABEL: global_singlethread_monotonic_load:
150 ; GFX6: ; %bb.0: ; %entry
151 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
152 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
153 ; GFX6-NEXT: s_mov_b32 s6, -1
154 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
155 ; GFX6-NEXT: s_mov_b32 s4, s0
156 ; GFX6-NEXT: s_mov_b32 s5, s1
157 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0
158 ; GFX6-NEXT: s_mov_b32 s4, s2
159 ; GFX6-NEXT: s_mov_b32 s5, s3
160 ; GFX6-NEXT: s_waitcnt vmcnt(0)
161 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
162 ; GFX6-NEXT: s_endpgm
164 ; GFX7-LABEL: global_singlethread_monotonic_load:
165 ; GFX7: ; %bb.0: ; %entry
166 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
167 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
168 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
169 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
170 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
171 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
172 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
173 ; GFX7-NEXT: s_waitcnt vmcnt(0)
174 ; GFX7-NEXT: flat_store_dword v[0:1], v2
175 ; GFX7-NEXT: s_endpgm
177 ; GFX10-WGP-LABEL: global_singlethread_monotonic_load:
178 ; GFX10-WGP: ; %bb.0: ; %entry
179 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
180 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
181 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
182 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1]
183 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
184 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
185 ; GFX10-WGP-NEXT: s_endpgm
187 ; GFX10-CU-LABEL: global_singlethread_monotonic_load:
188 ; GFX10-CU: ; %bb.0: ; %entry
189 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
190 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
191 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
192 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1]
193 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
194 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
195 ; GFX10-CU-NEXT: s_endpgm
197 ; SKIP-CACHE-INV-LABEL: global_singlethread_monotonic_load:
198 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
199 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
200 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
201 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
202 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
203 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
204 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
205 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
206 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
207 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
208 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
209 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
210 ; SKIP-CACHE-INV-NEXT: s_endpgm
212 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_monotonic_load:
213 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
214 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
215 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
216 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
217 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
218 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
219 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
220 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
222 ; GFX90A-TGSPLIT-LABEL: global_singlethread_monotonic_load:
223 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
224 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
225 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
226 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
227 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
228 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
229 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
230 ; GFX90A-TGSPLIT-NEXT: s_endpgm
232 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_monotonic_load:
233 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
234 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
235 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
236 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
237 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
238 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
239 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
240 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
242 ; GFX940-TGSPLIT-LABEL: global_singlethread_monotonic_load:
243 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
244 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
245 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
246 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
247 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
248 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
249 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
250 ; GFX940-TGSPLIT-NEXT: s_endpgm
252 ; GFX11-WGP-LABEL: global_singlethread_monotonic_load:
253 ; GFX11-WGP: ; %bb.0: ; %entry
254 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
255 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
256 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
257 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1]
258 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
259 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
260 ; GFX11-WGP-NEXT: s_nop 0
261 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
262 ; GFX11-WGP-NEXT: s_endpgm
264 ; GFX11-CU-LABEL: global_singlethread_monotonic_load:
265 ; GFX11-CU: ; %bb.0: ; %entry
266 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
267 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
268 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
269 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
270 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
271 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
272 ; GFX11-CU-NEXT: s_nop 0
273 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
274 ; GFX11-CU-NEXT: s_endpgm
275 ptr addrspace(1) %in, ptr addrspace(1) %out) {
277 %val = load atomic i32, ptr addrspace(1) %in syncscope("singlethread") monotonic, align 4
278 store i32 %val, ptr addrspace(1) %out
282 define amdgpu_kernel void @global_singlethread_acquire_load(
283 ; GFX6-LABEL: global_singlethread_acquire_load:
284 ; GFX6: ; %bb.0: ; %entry
285 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
286 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
287 ; GFX6-NEXT: s_mov_b32 s6, -1
288 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
289 ; GFX6-NEXT: s_mov_b32 s4, s0
290 ; GFX6-NEXT: s_mov_b32 s5, s1
291 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0
292 ; GFX6-NEXT: s_mov_b32 s4, s2
293 ; GFX6-NEXT: s_mov_b32 s5, s3
294 ; GFX6-NEXT: s_waitcnt vmcnt(0)
295 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
296 ; GFX6-NEXT: s_endpgm
298 ; GFX7-LABEL: global_singlethread_acquire_load:
299 ; GFX7: ; %bb.0: ; %entry
300 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
301 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
302 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
303 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
304 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
305 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
306 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
307 ; GFX7-NEXT: s_waitcnt vmcnt(0)
308 ; GFX7-NEXT: flat_store_dword v[0:1], v2
309 ; GFX7-NEXT: s_endpgm
311 ; GFX10-WGP-LABEL: global_singlethread_acquire_load:
312 ; GFX10-WGP: ; %bb.0: ; %entry
313 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
314 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
315 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
316 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1]
317 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
318 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
319 ; GFX10-WGP-NEXT: s_endpgm
321 ; GFX10-CU-LABEL: global_singlethread_acquire_load:
322 ; GFX10-CU: ; %bb.0: ; %entry
323 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
324 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
325 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
326 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1]
327 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
328 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
329 ; GFX10-CU-NEXT: s_endpgm
331 ; SKIP-CACHE-INV-LABEL: global_singlethread_acquire_load:
332 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
333 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
334 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
335 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
336 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
337 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
338 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
339 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
340 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
341 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
342 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
343 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
344 ; SKIP-CACHE-INV-NEXT: s_endpgm
346 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acquire_load:
347 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
348 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
349 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
350 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
351 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
352 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
353 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
354 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
356 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acquire_load:
357 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
358 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
359 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
360 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
361 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
362 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
363 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
364 ; GFX90A-TGSPLIT-NEXT: s_endpgm
366 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acquire_load:
367 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
368 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
369 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
370 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
371 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
372 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
373 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
374 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
376 ; GFX940-TGSPLIT-LABEL: global_singlethread_acquire_load:
377 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
378 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
379 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
380 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
381 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
382 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
383 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
384 ; GFX940-TGSPLIT-NEXT: s_endpgm
386 ; GFX11-WGP-LABEL: global_singlethread_acquire_load:
387 ; GFX11-WGP: ; %bb.0: ; %entry
388 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
389 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
390 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
391 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1]
392 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
393 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
394 ; GFX11-WGP-NEXT: s_nop 0
395 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
396 ; GFX11-WGP-NEXT: s_endpgm
398 ; GFX11-CU-LABEL: global_singlethread_acquire_load:
399 ; GFX11-CU: ; %bb.0: ; %entry
400 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
401 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
402 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
403 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
404 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
405 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
406 ; GFX11-CU-NEXT: s_nop 0
407 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
408 ; GFX11-CU-NEXT: s_endpgm
409 ptr addrspace(1) %in, ptr addrspace(1) %out) {
411 %val = load atomic i32, ptr addrspace(1) %in syncscope("singlethread") acquire, align 4
412 store i32 %val, ptr addrspace(1) %out
416 define amdgpu_kernel void @global_singlethread_seq_cst_load(
417 ; GFX6-LABEL: global_singlethread_seq_cst_load:
418 ; GFX6: ; %bb.0: ; %entry
419 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
420 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
421 ; GFX6-NEXT: s_mov_b32 s6, -1
422 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
423 ; GFX6-NEXT: s_mov_b32 s4, s0
424 ; GFX6-NEXT: s_mov_b32 s5, s1
425 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0
426 ; GFX6-NEXT: s_mov_b32 s4, s2
427 ; GFX6-NEXT: s_mov_b32 s5, s3
428 ; GFX6-NEXT: s_waitcnt vmcnt(0)
429 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
430 ; GFX6-NEXT: s_endpgm
432 ; GFX7-LABEL: global_singlethread_seq_cst_load:
433 ; GFX7: ; %bb.0: ; %entry
434 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
435 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
436 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
437 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
438 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
439 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
440 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
441 ; GFX7-NEXT: s_waitcnt vmcnt(0)
442 ; GFX7-NEXT: flat_store_dword v[0:1], v2
443 ; GFX7-NEXT: s_endpgm
445 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_load:
446 ; GFX10-WGP: ; %bb.0: ; %entry
447 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
448 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
449 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
450 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1]
451 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
452 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
453 ; GFX10-WGP-NEXT: s_endpgm
455 ; GFX10-CU-LABEL: global_singlethread_seq_cst_load:
456 ; GFX10-CU: ; %bb.0: ; %entry
457 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
458 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
459 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
460 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1]
461 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
462 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
463 ; GFX10-CU-NEXT: s_endpgm
465 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_load:
466 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
467 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
468 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
469 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
470 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
471 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
472 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
473 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
474 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
475 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
476 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
477 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
478 ; SKIP-CACHE-INV-NEXT: s_endpgm
480 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_load:
481 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
482 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
483 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
484 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
485 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
486 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
487 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
488 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
490 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_load:
491 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
492 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
493 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
494 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
495 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
496 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
497 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
498 ; GFX90A-TGSPLIT-NEXT: s_endpgm
500 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_load:
501 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
502 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
503 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
504 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
505 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
506 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
507 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
508 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
510 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_load:
511 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
512 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
513 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
514 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
515 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
516 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
517 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
518 ; GFX940-TGSPLIT-NEXT: s_endpgm
520 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_load:
521 ; GFX11-WGP: ; %bb.0: ; %entry
522 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
523 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
524 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
525 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1]
526 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
527 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
528 ; GFX11-WGP-NEXT: s_nop 0
529 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
530 ; GFX11-WGP-NEXT: s_endpgm
532 ; GFX11-CU-LABEL: global_singlethread_seq_cst_load:
533 ; GFX11-CU: ; %bb.0: ; %entry
534 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
535 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
536 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
537 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
538 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
539 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
540 ; GFX11-CU-NEXT: s_nop 0
541 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
542 ; GFX11-CU-NEXT: s_endpgm
543 ptr addrspace(1) %in, ptr addrspace(1) %out) {
545 %val = load atomic i32, ptr addrspace(1) %in syncscope("singlethread") seq_cst, align 4
546 store i32 %val, ptr addrspace(1) %out
550 define amdgpu_kernel void @global_singlethread_unordered_store(
551 ; GFX6-LABEL: global_singlethread_unordered_store:
552 ; GFX6: ; %bb.0: ; %entry
553 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
554 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
555 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
556 ; GFX6-NEXT: s_mov_b32 s2, -1
557 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
558 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
559 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
560 ; GFX6-NEXT: s_endpgm
562 ; GFX7-LABEL: global_singlethread_unordered_store:
563 ; GFX7: ; %bb.0: ; %entry
564 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
565 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
566 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
567 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
568 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
569 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
570 ; GFX7-NEXT: flat_store_dword v[0:1], v2
571 ; GFX7-NEXT: s_endpgm
573 ; GFX10-WGP-LABEL: global_singlethread_unordered_store:
574 ; GFX10-WGP: ; %bb.0: ; %entry
575 ; GFX10-WGP-NEXT: s_clause 0x1
576 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
577 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
578 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
579 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
580 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
581 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
582 ; GFX10-WGP-NEXT: s_endpgm
584 ; GFX10-CU-LABEL: global_singlethread_unordered_store:
585 ; GFX10-CU: ; %bb.0: ; %entry
586 ; GFX10-CU-NEXT: s_clause 0x1
587 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
588 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
589 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
590 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
591 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
592 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
593 ; GFX10-CU-NEXT: s_endpgm
595 ; SKIP-CACHE-INV-LABEL: global_singlethread_unordered_store:
596 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
597 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
598 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
599 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
600 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
601 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
602 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
603 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
604 ; SKIP-CACHE-INV-NEXT: s_endpgm
606 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_unordered_store:
607 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
608 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
609 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
610 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
611 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
612 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
613 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
614 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
616 ; GFX90A-TGSPLIT-LABEL: global_singlethread_unordered_store:
617 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
618 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
619 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
620 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
621 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
622 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
623 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
624 ; GFX90A-TGSPLIT-NEXT: s_endpgm
626 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_unordered_store:
627 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
628 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
629 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
630 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
631 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
632 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
633 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
634 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
636 ; GFX940-TGSPLIT-LABEL: global_singlethread_unordered_store:
637 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
638 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
639 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
640 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
641 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
642 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
643 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
644 ; GFX940-TGSPLIT-NEXT: s_endpgm
646 ; GFX11-WGP-LABEL: global_singlethread_unordered_store:
647 ; GFX11-WGP: ; %bb.0: ; %entry
648 ; GFX11-WGP-NEXT: s_clause 0x1
649 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
650 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
651 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
652 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
653 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
654 ; GFX11-WGP-NEXT: s_nop 0
655 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
656 ; GFX11-WGP-NEXT: s_endpgm
658 ; GFX11-CU-LABEL: global_singlethread_unordered_store:
659 ; GFX11-CU: ; %bb.0: ; %entry
660 ; GFX11-CU-NEXT: s_clause 0x1
661 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
662 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
663 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
664 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
665 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
666 ; GFX11-CU-NEXT: s_nop 0
667 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
668 ; GFX11-CU-NEXT: s_endpgm
669 i32 %in, ptr addrspace(1) %out) {
671 store atomic i32 %in, ptr addrspace(1) %out syncscope("singlethread") unordered, align 4
675 define amdgpu_kernel void @global_singlethread_monotonic_store(
676 ; GFX6-LABEL: global_singlethread_monotonic_store:
677 ; GFX6: ; %bb.0: ; %entry
678 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
679 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
680 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
681 ; GFX6-NEXT: s_mov_b32 s2, -1
682 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
683 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
684 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
685 ; GFX6-NEXT: s_endpgm
687 ; GFX7-LABEL: global_singlethread_monotonic_store:
688 ; GFX7: ; %bb.0: ; %entry
689 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
690 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
691 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
692 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
693 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
694 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
695 ; GFX7-NEXT: flat_store_dword v[0:1], v2
696 ; GFX7-NEXT: s_endpgm
698 ; GFX10-WGP-LABEL: global_singlethread_monotonic_store:
699 ; GFX10-WGP: ; %bb.0: ; %entry
700 ; GFX10-WGP-NEXT: s_clause 0x1
701 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
702 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
703 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
704 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
705 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
706 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
707 ; GFX10-WGP-NEXT: s_endpgm
709 ; GFX10-CU-LABEL: global_singlethread_monotonic_store:
710 ; GFX10-CU: ; %bb.0: ; %entry
711 ; GFX10-CU-NEXT: s_clause 0x1
712 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
713 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
714 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
715 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
716 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
717 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
718 ; GFX10-CU-NEXT: s_endpgm
720 ; SKIP-CACHE-INV-LABEL: global_singlethread_monotonic_store:
721 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
722 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
723 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
724 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
725 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
726 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
727 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
728 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
729 ; SKIP-CACHE-INV-NEXT: s_endpgm
731 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_monotonic_store:
732 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
733 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
734 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
735 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
736 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
737 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
738 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
739 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
741 ; GFX90A-TGSPLIT-LABEL: global_singlethread_monotonic_store:
742 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
743 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
744 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
745 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
746 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
747 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
748 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
749 ; GFX90A-TGSPLIT-NEXT: s_endpgm
751 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_monotonic_store:
752 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
753 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
754 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
755 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
756 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
757 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
758 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
759 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
761 ; GFX940-TGSPLIT-LABEL: global_singlethread_monotonic_store:
762 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
763 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
764 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
765 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
766 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
767 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
768 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
769 ; GFX940-TGSPLIT-NEXT: s_endpgm
771 ; GFX11-WGP-LABEL: global_singlethread_monotonic_store:
772 ; GFX11-WGP: ; %bb.0: ; %entry
773 ; GFX11-WGP-NEXT: s_clause 0x1
774 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
775 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
776 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
777 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
778 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
779 ; GFX11-WGP-NEXT: s_nop 0
780 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
781 ; GFX11-WGP-NEXT: s_endpgm
783 ; GFX11-CU-LABEL: global_singlethread_monotonic_store:
784 ; GFX11-CU: ; %bb.0: ; %entry
785 ; GFX11-CU-NEXT: s_clause 0x1
786 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
787 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
788 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
789 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
790 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
791 ; GFX11-CU-NEXT: s_nop 0
792 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
793 ; GFX11-CU-NEXT: s_endpgm
794 i32 %in, ptr addrspace(1) %out) {
796 store atomic i32 %in, ptr addrspace(1) %out syncscope("singlethread") monotonic, align 4
800 define amdgpu_kernel void @global_singlethread_release_store(
801 ; GFX6-LABEL: global_singlethread_release_store:
802 ; GFX6: ; %bb.0: ; %entry
803 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
804 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
805 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
806 ; GFX6-NEXT: s_mov_b32 s2, -1
807 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
808 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
809 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
810 ; GFX6-NEXT: s_endpgm
812 ; GFX7-LABEL: global_singlethread_release_store:
813 ; GFX7: ; %bb.0: ; %entry
814 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
815 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
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: v_mov_b32_e32 v2, s2
820 ; GFX7-NEXT: flat_store_dword v[0:1], v2
821 ; GFX7-NEXT: s_endpgm
823 ; GFX10-WGP-LABEL: global_singlethread_release_store:
824 ; GFX10-WGP: ; %bb.0: ; %entry
825 ; GFX10-WGP-NEXT: s_clause 0x1
826 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
827 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
828 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
829 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
830 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
831 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
832 ; GFX10-WGP-NEXT: s_endpgm
834 ; GFX10-CU-LABEL: global_singlethread_release_store:
835 ; GFX10-CU: ; %bb.0: ; %entry
836 ; GFX10-CU-NEXT: s_clause 0x1
837 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
838 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
839 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
840 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
841 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
842 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
843 ; GFX10-CU-NEXT: s_endpgm
845 ; SKIP-CACHE-INV-LABEL: global_singlethread_release_store:
846 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
847 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
848 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
849 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
850 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
851 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
852 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
853 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
854 ; SKIP-CACHE-INV-NEXT: s_endpgm
856 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_release_store:
857 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
858 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
859 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
860 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
861 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
862 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
863 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
864 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
866 ; GFX90A-TGSPLIT-LABEL: global_singlethread_release_store:
867 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
868 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
869 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
870 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
871 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
872 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
873 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
874 ; GFX90A-TGSPLIT-NEXT: s_endpgm
876 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_release_store:
877 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
878 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
879 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
880 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
881 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
882 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
883 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
884 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
886 ; GFX940-TGSPLIT-LABEL: global_singlethread_release_store:
887 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
888 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
889 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
890 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
891 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
892 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
893 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
894 ; GFX940-TGSPLIT-NEXT: s_endpgm
896 ; GFX11-WGP-LABEL: global_singlethread_release_store:
897 ; GFX11-WGP: ; %bb.0: ; %entry
898 ; GFX11-WGP-NEXT: s_clause 0x1
899 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
900 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
901 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
902 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
903 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
904 ; GFX11-WGP-NEXT: s_nop 0
905 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
906 ; GFX11-WGP-NEXT: s_endpgm
908 ; GFX11-CU-LABEL: global_singlethread_release_store:
909 ; GFX11-CU: ; %bb.0: ; %entry
910 ; GFX11-CU-NEXT: s_clause 0x1
911 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
912 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
913 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
914 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
915 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
916 ; GFX11-CU-NEXT: s_nop 0
917 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
918 ; GFX11-CU-NEXT: s_endpgm
919 i32 %in, ptr addrspace(1) %out) {
921 store atomic i32 %in, ptr addrspace(1) %out syncscope("singlethread") release, align 4
925 define amdgpu_kernel void @global_singlethread_seq_cst_store(
926 ; GFX6-LABEL: global_singlethread_seq_cst_store:
927 ; GFX6: ; %bb.0: ; %entry
928 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
929 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
930 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
931 ; GFX6-NEXT: s_mov_b32 s2, -1
932 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
933 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
934 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
935 ; GFX6-NEXT: s_endpgm
937 ; GFX7-LABEL: global_singlethread_seq_cst_store:
938 ; GFX7: ; %bb.0: ; %entry
939 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
940 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
941 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
942 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
943 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
944 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
945 ; GFX7-NEXT: flat_store_dword v[0:1], v2
946 ; GFX7-NEXT: s_endpgm
948 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_store:
949 ; GFX10-WGP: ; %bb.0: ; %entry
950 ; GFX10-WGP-NEXT: s_clause 0x1
951 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
952 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
953 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
954 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
955 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
956 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
957 ; GFX10-WGP-NEXT: s_endpgm
959 ; GFX10-CU-LABEL: global_singlethread_seq_cst_store:
960 ; GFX10-CU: ; %bb.0: ; %entry
961 ; GFX10-CU-NEXT: s_clause 0x1
962 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
963 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
964 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
965 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
966 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
967 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
968 ; GFX10-CU-NEXT: s_endpgm
970 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_store:
971 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
972 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
973 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
974 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
975 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
976 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
977 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
978 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
979 ; SKIP-CACHE-INV-NEXT: s_endpgm
981 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_store:
982 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
983 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
984 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
985 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
986 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
987 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
988 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
989 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
991 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_store:
992 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
993 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
994 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
995 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
996 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
997 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
998 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
999 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1001 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_store:
1002 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1003 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
1004 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
1005 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1006 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1007 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1008 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
1009 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1011 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_store:
1012 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1013 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
1014 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
1015 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1016 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1017 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1018 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
1019 ; GFX940-TGSPLIT-NEXT: s_endpgm
1021 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_store:
1022 ; GFX11-WGP: ; %bb.0: ; %entry
1023 ; GFX11-WGP-NEXT: s_clause 0x1
1024 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
1025 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1026 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1027 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1028 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
1029 ; GFX11-WGP-NEXT: s_nop 0
1030 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1031 ; GFX11-WGP-NEXT: s_endpgm
1033 ; GFX11-CU-LABEL: global_singlethread_seq_cst_store:
1034 ; GFX11-CU: ; %bb.0: ; %entry
1035 ; GFX11-CU-NEXT: s_clause 0x1
1036 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
1037 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1038 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1039 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1040 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
1041 ; GFX11-CU-NEXT: s_nop 0
1042 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1043 ; GFX11-CU-NEXT: s_endpgm
1044 i32 %in, ptr addrspace(1) %out) {
1046 store atomic i32 %in, ptr addrspace(1) %out syncscope("singlethread") seq_cst, align 4
1050 define amdgpu_kernel void @global_singlethread_monotonic_atomicrmw(
1051 ; GFX6-LABEL: global_singlethread_monotonic_atomicrmw:
1052 ; GFX6: ; %bb.0: ; %entry
1053 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1054 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1055 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1056 ; GFX6-NEXT: s_mov_b32 s2, -1
1057 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1058 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1059 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1060 ; GFX6-NEXT: s_endpgm
1062 ; GFX7-LABEL: global_singlethread_monotonic_atomicrmw:
1063 ; GFX7: ; %bb.0: ; %entry
1064 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1065 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1066 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1067 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1068 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1069 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1070 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1071 ; GFX7-NEXT: s_endpgm
1073 ; GFX10-WGP-LABEL: global_singlethread_monotonic_atomicrmw:
1074 ; GFX10-WGP: ; %bb.0: ; %entry
1075 ; GFX10-WGP-NEXT: s_clause 0x1
1076 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1077 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1078 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1079 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1080 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1081 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1082 ; GFX10-WGP-NEXT: s_endpgm
1084 ; GFX10-CU-LABEL: global_singlethread_monotonic_atomicrmw:
1085 ; GFX10-CU: ; %bb.0: ; %entry
1086 ; GFX10-CU-NEXT: s_clause 0x1
1087 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1088 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1089 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1090 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1091 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1092 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1093 ; GFX10-CU-NEXT: s_endpgm
1095 ; SKIP-CACHE-INV-LABEL: global_singlethread_monotonic_atomicrmw:
1096 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1097 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1098 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1099 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1100 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1101 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1102 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1103 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1104 ; SKIP-CACHE-INV-NEXT: s_endpgm
1106 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_monotonic_atomicrmw:
1107 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1108 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1109 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1110 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1111 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1112 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1113 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1114 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1116 ; GFX90A-TGSPLIT-LABEL: global_singlethread_monotonic_atomicrmw:
1117 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1118 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1119 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1120 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1121 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1122 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1123 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1124 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1126 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_monotonic_atomicrmw:
1127 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1128 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1129 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1130 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1131 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1132 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1133 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1134 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1136 ; GFX940-TGSPLIT-LABEL: global_singlethread_monotonic_atomicrmw:
1137 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1138 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1139 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1140 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1141 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1142 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1143 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1144 ; GFX940-TGSPLIT-NEXT: s_endpgm
1146 ; GFX11-WGP-LABEL: global_singlethread_monotonic_atomicrmw:
1147 ; GFX11-WGP: ; %bb.0: ; %entry
1148 ; GFX11-WGP-NEXT: s_clause 0x1
1149 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1150 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1151 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1152 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1153 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1154 ; GFX11-WGP-NEXT: s_nop 0
1155 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1156 ; GFX11-WGP-NEXT: s_endpgm
1158 ; GFX11-CU-LABEL: global_singlethread_monotonic_atomicrmw:
1159 ; GFX11-CU: ; %bb.0: ; %entry
1160 ; GFX11-CU-NEXT: s_clause 0x1
1161 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1162 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1163 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1164 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1165 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1166 ; GFX11-CU-NEXT: s_nop 0
1167 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1168 ; GFX11-CU-NEXT: s_endpgm
1169 ptr addrspace(1) %out, i32 %in) {
1171 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread") monotonic
1175 define amdgpu_kernel void @global_singlethread_acquire_atomicrmw(
1176 ; GFX6-LABEL: global_singlethread_acquire_atomicrmw:
1177 ; GFX6: ; %bb.0: ; %entry
1178 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1179 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1180 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1181 ; GFX6-NEXT: s_mov_b32 s2, -1
1182 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1183 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1184 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1185 ; GFX6-NEXT: s_endpgm
1187 ; GFX7-LABEL: global_singlethread_acquire_atomicrmw:
1188 ; GFX7: ; %bb.0: ; %entry
1189 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1190 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1191 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1192 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1193 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1194 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1195 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1196 ; GFX7-NEXT: s_endpgm
1198 ; GFX10-WGP-LABEL: global_singlethread_acquire_atomicrmw:
1199 ; GFX10-WGP: ; %bb.0: ; %entry
1200 ; GFX10-WGP-NEXT: s_clause 0x1
1201 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1202 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1203 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1204 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1205 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1206 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1207 ; GFX10-WGP-NEXT: s_endpgm
1209 ; GFX10-CU-LABEL: global_singlethread_acquire_atomicrmw:
1210 ; GFX10-CU: ; %bb.0: ; %entry
1211 ; GFX10-CU-NEXT: s_clause 0x1
1212 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1213 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1214 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1215 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1216 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1217 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1218 ; GFX10-CU-NEXT: s_endpgm
1220 ; SKIP-CACHE-INV-LABEL: global_singlethread_acquire_atomicrmw:
1221 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1222 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1223 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1224 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1225 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1226 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1227 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1228 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1229 ; SKIP-CACHE-INV-NEXT: s_endpgm
1231 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acquire_atomicrmw:
1232 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1233 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1234 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1235 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1236 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1237 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1238 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1239 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1241 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acquire_atomicrmw:
1242 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1243 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1244 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1245 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1246 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1247 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1248 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1249 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1251 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acquire_atomicrmw:
1252 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1253 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1254 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1255 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1256 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1257 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1258 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1259 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1261 ; GFX940-TGSPLIT-LABEL: global_singlethread_acquire_atomicrmw:
1262 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1263 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1264 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1265 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1266 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1267 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1268 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1269 ; GFX940-TGSPLIT-NEXT: s_endpgm
1271 ; GFX11-WGP-LABEL: global_singlethread_acquire_atomicrmw:
1272 ; GFX11-WGP: ; %bb.0: ; %entry
1273 ; GFX11-WGP-NEXT: s_clause 0x1
1274 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1275 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1276 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1277 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1278 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1279 ; GFX11-WGP-NEXT: s_nop 0
1280 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1281 ; GFX11-WGP-NEXT: s_endpgm
1283 ; GFX11-CU-LABEL: global_singlethread_acquire_atomicrmw:
1284 ; GFX11-CU: ; %bb.0: ; %entry
1285 ; GFX11-CU-NEXT: s_clause 0x1
1286 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1287 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1288 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1289 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1290 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1291 ; GFX11-CU-NEXT: s_nop 0
1292 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1293 ; GFX11-CU-NEXT: s_endpgm
1294 ptr addrspace(1) %out, i32 %in) {
1296 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread") acquire
1300 define amdgpu_kernel void @global_singlethread_release_atomicrmw(
1301 ; GFX6-LABEL: global_singlethread_release_atomicrmw:
1302 ; GFX6: ; %bb.0: ; %entry
1303 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1304 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1305 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1306 ; GFX6-NEXT: s_mov_b32 s2, -1
1307 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1308 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1309 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1310 ; GFX6-NEXT: s_endpgm
1312 ; GFX7-LABEL: global_singlethread_release_atomicrmw:
1313 ; GFX7: ; %bb.0: ; %entry
1314 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1315 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1316 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1317 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1318 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1319 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1320 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1321 ; GFX7-NEXT: s_endpgm
1323 ; GFX10-WGP-LABEL: global_singlethread_release_atomicrmw:
1324 ; GFX10-WGP: ; %bb.0: ; %entry
1325 ; GFX10-WGP-NEXT: s_clause 0x1
1326 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1327 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1328 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1329 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1330 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1331 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1332 ; GFX10-WGP-NEXT: s_endpgm
1334 ; GFX10-CU-LABEL: global_singlethread_release_atomicrmw:
1335 ; GFX10-CU: ; %bb.0: ; %entry
1336 ; GFX10-CU-NEXT: s_clause 0x1
1337 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1338 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1339 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1340 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1341 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1342 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1343 ; GFX10-CU-NEXT: s_endpgm
1345 ; SKIP-CACHE-INV-LABEL: global_singlethread_release_atomicrmw:
1346 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1347 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1348 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1349 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1350 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1351 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1352 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1353 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1354 ; SKIP-CACHE-INV-NEXT: s_endpgm
1356 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_release_atomicrmw:
1357 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1358 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1359 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1360 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1361 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1362 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1363 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1364 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1366 ; GFX90A-TGSPLIT-LABEL: global_singlethread_release_atomicrmw:
1367 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1368 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1369 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1370 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1371 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1372 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1373 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1374 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1376 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_release_atomicrmw:
1377 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1378 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1379 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1380 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1381 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1382 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1383 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1384 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1386 ; GFX940-TGSPLIT-LABEL: global_singlethread_release_atomicrmw:
1387 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1388 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1389 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1390 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1391 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1392 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1393 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1394 ; GFX940-TGSPLIT-NEXT: s_endpgm
1396 ; GFX11-WGP-LABEL: global_singlethread_release_atomicrmw:
1397 ; GFX11-WGP: ; %bb.0: ; %entry
1398 ; GFX11-WGP-NEXT: s_clause 0x1
1399 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1400 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1401 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1402 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1403 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1404 ; GFX11-WGP-NEXT: s_nop 0
1405 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1406 ; GFX11-WGP-NEXT: s_endpgm
1408 ; GFX11-CU-LABEL: global_singlethread_release_atomicrmw:
1409 ; GFX11-CU: ; %bb.0: ; %entry
1410 ; GFX11-CU-NEXT: s_clause 0x1
1411 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1412 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1413 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1414 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1415 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1416 ; GFX11-CU-NEXT: s_nop 0
1417 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1418 ; GFX11-CU-NEXT: s_endpgm
1419 ptr addrspace(1) %out, i32 %in) {
1421 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread") release
1425 define amdgpu_kernel void @global_singlethread_acq_rel_atomicrmw(
1426 ; GFX6-LABEL: global_singlethread_acq_rel_atomicrmw:
1427 ; GFX6: ; %bb.0: ; %entry
1428 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1429 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1430 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1431 ; GFX6-NEXT: s_mov_b32 s2, -1
1432 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1433 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1434 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1435 ; GFX6-NEXT: s_endpgm
1437 ; GFX7-LABEL: global_singlethread_acq_rel_atomicrmw:
1438 ; GFX7: ; %bb.0: ; %entry
1439 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1440 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1441 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1442 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1443 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1444 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1445 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1446 ; GFX7-NEXT: s_endpgm
1448 ; GFX10-WGP-LABEL: global_singlethread_acq_rel_atomicrmw:
1449 ; GFX10-WGP: ; %bb.0: ; %entry
1450 ; GFX10-WGP-NEXT: s_clause 0x1
1451 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1452 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1453 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1454 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1455 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1456 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1457 ; GFX10-WGP-NEXT: s_endpgm
1459 ; GFX10-CU-LABEL: global_singlethread_acq_rel_atomicrmw:
1460 ; GFX10-CU: ; %bb.0: ; %entry
1461 ; GFX10-CU-NEXT: s_clause 0x1
1462 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1463 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1464 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1465 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1466 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1467 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1468 ; GFX10-CU-NEXT: s_endpgm
1470 ; SKIP-CACHE-INV-LABEL: global_singlethread_acq_rel_atomicrmw:
1471 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1472 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1473 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1474 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1475 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1476 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1477 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1478 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1479 ; SKIP-CACHE-INV-NEXT: s_endpgm
1481 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_atomicrmw:
1482 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1483 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1484 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1485 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1486 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1487 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1488 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1489 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1491 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acq_rel_atomicrmw:
1492 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1493 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1494 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1495 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1496 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1497 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1498 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1499 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1501 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_atomicrmw:
1502 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1503 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1504 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1505 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1506 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1507 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1508 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1509 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1511 ; GFX940-TGSPLIT-LABEL: global_singlethread_acq_rel_atomicrmw:
1512 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1513 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1514 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1515 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1516 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1517 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1518 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1519 ; GFX940-TGSPLIT-NEXT: s_endpgm
1521 ; GFX11-WGP-LABEL: global_singlethread_acq_rel_atomicrmw:
1522 ; GFX11-WGP: ; %bb.0: ; %entry
1523 ; GFX11-WGP-NEXT: s_clause 0x1
1524 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1525 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1526 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1527 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1528 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1529 ; GFX11-WGP-NEXT: s_nop 0
1530 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1531 ; GFX11-WGP-NEXT: s_endpgm
1533 ; GFX11-CU-LABEL: global_singlethread_acq_rel_atomicrmw:
1534 ; GFX11-CU: ; %bb.0: ; %entry
1535 ; GFX11-CU-NEXT: s_clause 0x1
1536 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1537 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1538 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1539 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1540 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1541 ; GFX11-CU-NEXT: s_nop 0
1542 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1543 ; GFX11-CU-NEXT: s_endpgm
1544 ptr addrspace(1) %out, i32 %in) {
1546 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread") acq_rel
1550 define amdgpu_kernel void @global_singlethread_seq_cst_atomicrmw(
1551 ; GFX6-LABEL: global_singlethread_seq_cst_atomicrmw:
1552 ; GFX6: ; %bb.0: ; %entry
1553 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1554 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1555 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1556 ; GFX6-NEXT: s_mov_b32 s2, -1
1557 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1558 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1559 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1560 ; GFX6-NEXT: s_endpgm
1562 ; GFX7-LABEL: global_singlethread_seq_cst_atomicrmw:
1563 ; GFX7: ; %bb.0: ; %entry
1564 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1565 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1566 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1567 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1568 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1569 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1570 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1571 ; GFX7-NEXT: s_endpgm
1573 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_atomicrmw:
1574 ; GFX10-WGP: ; %bb.0: ; %entry
1575 ; GFX10-WGP-NEXT: s_clause 0x1
1576 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1577 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1578 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1579 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1580 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1581 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1582 ; GFX10-WGP-NEXT: s_endpgm
1584 ; GFX10-CU-LABEL: global_singlethread_seq_cst_atomicrmw:
1585 ; GFX10-CU: ; %bb.0: ; %entry
1586 ; GFX10-CU-NEXT: s_clause 0x1
1587 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1588 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1589 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1590 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1591 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1592 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1593 ; GFX10-CU-NEXT: s_endpgm
1595 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_atomicrmw:
1596 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1597 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1598 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1599 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1600 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1601 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1602 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1603 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1604 ; SKIP-CACHE-INV-NEXT: s_endpgm
1606 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_atomicrmw:
1607 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1608 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1609 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1610 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1611 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1612 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1613 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1614 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1616 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_atomicrmw:
1617 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1618 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1619 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1620 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1621 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1622 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1623 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1624 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1626 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_atomicrmw:
1627 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1628 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1629 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1630 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1631 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1632 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1633 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1634 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1636 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_atomicrmw:
1637 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1638 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1639 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1640 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1641 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1642 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1643 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
1644 ; GFX940-TGSPLIT-NEXT: s_endpgm
1646 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_atomicrmw:
1647 ; GFX11-WGP: ; %bb.0: ; %entry
1648 ; GFX11-WGP-NEXT: s_clause 0x1
1649 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1650 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1651 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1652 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1653 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1654 ; GFX11-WGP-NEXT: s_nop 0
1655 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1656 ; GFX11-WGP-NEXT: s_endpgm
1658 ; GFX11-CU-LABEL: global_singlethread_seq_cst_atomicrmw:
1659 ; GFX11-CU: ; %bb.0: ; %entry
1660 ; GFX11-CU-NEXT: s_clause 0x1
1661 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1662 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1663 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1664 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1665 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1666 ; GFX11-CU-NEXT: s_nop 0
1667 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1668 ; GFX11-CU-NEXT: s_endpgm
1669 ptr addrspace(1) %out, i32 %in) {
1671 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread") seq_cst
1675 define amdgpu_kernel void @global_singlethread_acquire_ret_atomicrmw(
1676 ; GFX6-LABEL: global_singlethread_acquire_ret_atomicrmw:
1677 ; GFX6: ; %bb.0: ; %entry
1678 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1679 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1680 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1681 ; GFX6-NEXT: s_mov_b32 s2, -1
1682 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1683 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1684 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
1685 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1686 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
1687 ; GFX6-NEXT: s_endpgm
1689 ; GFX7-LABEL: global_singlethread_acquire_ret_atomicrmw:
1690 ; GFX7: ; %bb.0: ; %entry
1691 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1692 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1693 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1694 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1695 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1696 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1697 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1698 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1699 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1700 ; GFX7-NEXT: s_endpgm
1702 ; GFX10-WGP-LABEL: global_singlethread_acquire_ret_atomicrmw:
1703 ; GFX10-WGP: ; %bb.0: ; %entry
1704 ; GFX10-WGP-NEXT: s_clause 0x1
1705 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1706 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1707 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1708 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1709 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1710 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1711 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
1712 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
1713 ; GFX10-WGP-NEXT: s_endpgm
1715 ; GFX10-CU-LABEL: global_singlethread_acquire_ret_atomicrmw:
1716 ; GFX10-CU: ; %bb.0: ; %entry
1717 ; GFX10-CU-NEXT: s_clause 0x1
1718 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1719 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1720 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1721 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1722 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1723 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1724 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
1725 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
1726 ; GFX10-CU-NEXT: s_endpgm
1728 ; SKIP-CACHE-INV-LABEL: global_singlethread_acquire_ret_atomicrmw:
1729 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1730 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1731 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1732 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1733 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1734 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1735 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1736 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
1737 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
1738 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
1739 ; SKIP-CACHE-INV-NEXT: s_endpgm
1741 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acquire_ret_atomicrmw:
1742 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1743 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1744 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1745 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1746 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1747 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1748 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1749 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1750 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
1751 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1753 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acquire_ret_atomicrmw:
1754 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1755 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1756 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1757 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1758 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1759 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1760 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1761 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1762 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
1763 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1765 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acquire_ret_atomicrmw:
1766 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1767 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1768 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1769 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1770 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1771 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1772 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
1773 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1774 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
1775 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1777 ; GFX940-TGSPLIT-LABEL: global_singlethread_acquire_ret_atomicrmw:
1778 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1779 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1780 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1781 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1782 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1783 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1784 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
1785 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1786 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
1787 ; GFX940-TGSPLIT-NEXT: s_endpgm
1789 ; GFX11-WGP-LABEL: global_singlethread_acquire_ret_atomicrmw:
1790 ; GFX11-WGP: ; %bb.0: ; %entry
1791 ; GFX11-WGP-NEXT: s_clause 0x1
1792 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1793 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1794 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1795 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1796 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
1797 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
1798 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
1799 ; GFX11-WGP-NEXT: s_nop 0
1800 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1801 ; GFX11-WGP-NEXT: s_endpgm
1803 ; GFX11-CU-LABEL: global_singlethread_acquire_ret_atomicrmw:
1804 ; GFX11-CU: ; %bb.0: ; %entry
1805 ; GFX11-CU-NEXT: s_clause 0x1
1806 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1807 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1808 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1809 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1810 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
1811 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
1812 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
1813 ; GFX11-CU-NEXT: s_nop 0
1814 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1815 ; GFX11-CU-NEXT: s_endpgm
1816 ptr addrspace(1) %out, i32 %in) {
1818 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread") acquire
1819 store i32 %val, ptr addrspace(1) %out, align 4
1823 define amdgpu_kernel void @global_singlethread_acq_rel_ret_atomicrmw(
1824 ; GFX6-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1825 ; GFX6: ; %bb.0: ; %entry
1826 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1827 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1828 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1829 ; GFX6-NEXT: s_mov_b32 s2, -1
1830 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1831 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1832 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
1833 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1834 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
1835 ; GFX6-NEXT: s_endpgm
1837 ; GFX7-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1838 ; GFX7: ; %bb.0: ; %entry
1839 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1840 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1841 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1842 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1843 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1844 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1845 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1846 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1847 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1848 ; GFX7-NEXT: s_endpgm
1850 ; GFX10-WGP-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1851 ; GFX10-WGP: ; %bb.0: ; %entry
1852 ; GFX10-WGP-NEXT: s_clause 0x1
1853 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1854 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1855 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1856 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1857 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1858 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1859 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
1860 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
1861 ; GFX10-WGP-NEXT: s_endpgm
1863 ; GFX10-CU-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1864 ; GFX10-CU: ; %bb.0: ; %entry
1865 ; GFX10-CU-NEXT: s_clause 0x1
1866 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1867 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1868 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1869 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1870 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1871 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1872 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
1873 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
1874 ; GFX10-CU-NEXT: s_endpgm
1876 ; SKIP-CACHE-INV-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1877 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1878 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1879 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1880 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1881 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1882 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1883 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1884 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
1885 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
1886 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
1887 ; SKIP-CACHE-INV-NEXT: s_endpgm
1889 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1890 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1891 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1892 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1893 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1894 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1895 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1896 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1897 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1898 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
1899 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1901 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1902 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1903 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1904 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1905 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1906 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1907 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1908 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1909 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1910 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
1911 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1913 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1914 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1915 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1916 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1917 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1918 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1919 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1920 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
1921 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1922 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
1923 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1925 ; GFX940-TGSPLIT-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1926 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1927 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1928 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1929 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1930 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1931 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1932 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
1933 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1934 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
1935 ; GFX940-TGSPLIT-NEXT: s_endpgm
1937 ; GFX11-WGP-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1938 ; GFX11-WGP: ; %bb.0: ; %entry
1939 ; GFX11-WGP-NEXT: s_clause 0x1
1940 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1941 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1942 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1943 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1944 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
1945 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
1946 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
1947 ; GFX11-WGP-NEXT: s_nop 0
1948 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1949 ; GFX11-WGP-NEXT: s_endpgm
1951 ; GFX11-CU-LABEL: global_singlethread_acq_rel_ret_atomicrmw:
1952 ; GFX11-CU: ; %bb.0: ; %entry
1953 ; GFX11-CU-NEXT: s_clause 0x1
1954 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1955 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1956 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1957 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1958 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
1959 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
1960 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
1961 ; GFX11-CU-NEXT: s_nop 0
1962 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1963 ; GFX11-CU-NEXT: s_endpgm
1964 ptr addrspace(1) %out, i32 %in) {
1966 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread") acq_rel
1967 store i32 %val, ptr addrspace(1) %out, align 4
1971 define amdgpu_kernel void @global_singlethread_seq_cst_ret_atomicrmw(
1972 ; GFX6-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
1973 ; GFX6: ; %bb.0: ; %entry
1974 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1975 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1976 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1977 ; GFX6-NEXT: s_mov_b32 s2, -1
1978 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1979 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1980 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
1981 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1982 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
1983 ; GFX6-NEXT: s_endpgm
1985 ; GFX7-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
1986 ; GFX7: ; %bb.0: ; %entry
1987 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1988 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1989 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1990 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1991 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1992 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1993 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1994 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1995 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1996 ; GFX7-NEXT: s_endpgm
1998 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
1999 ; GFX10-WGP: ; %bb.0: ; %entry
2000 ; GFX10-WGP-NEXT: s_clause 0x1
2001 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
2002 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2003 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
2004 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2005 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2006 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2007 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
2008 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
2009 ; GFX10-WGP-NEXT: s_endpgm
2011 ; GFX10-CU-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
2012 ; GFX10-CU: ; %bb.0: ; %entry
2013 ; GFX10-CU-NEXT: s_clause 0x1
2014 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
2015 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2016 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
2017 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2018 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2019 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2020 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
2021 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
2022 ; GFX10-CU-NEXT: s_endpgm
2024 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
2025 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2026 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
2027 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
2028 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
2029 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
2030 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2031 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
2032 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
2033 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
2034 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
2035 ; SKIP-CACHE-INV-NEXT: s_endpgm
2037 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
2038 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2039 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2040 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2041 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2042 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2043 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2044 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2045 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2046 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
2047 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2049 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
2050 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2051 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2052 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2053 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2054 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2055 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2056 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2057 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2058 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
2059 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2061 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
2062 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2063 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2064 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2065 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2066 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2067 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
2068 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
2069 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2070 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
2071 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2073 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
2074 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2075 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2076 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2077 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2078 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2079 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
2080 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
2081 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2082 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
2083 ; GFX940-TGSPLIT-NEXT: s_endpgm
2085 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
2086 ; GFX11-WGP: ; %bb.0: ; %entry
2087 ; GFX11-WGP-NEXT: s_clause 0x1
2088 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
2089 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
2090 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2091 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
2092 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2093 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
2094 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
2095 ; GFX11-WGP-NEXT: s_nop 0
2096 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2097 ; GFX11-WGP-NEXT: s_endpgm
2099 ; GFX11-CU-LABEL: global_singlethread_seq_cst_ret_atomicrmw:
2100 ; GFX11-CU: ; %bb.0: ; %entry
2101 ; GFX11-CU-NEXT: s_clause 0x1
2102 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
2103 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
2104 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2105 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
2106 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2107 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
2108 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
2109 ; GFX11-CU-NEXT: s_nop 0
2110 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2111 ; GFX11-CU-NEXT: s_endpgm
2112 ptr addrspace(1) %out, i32 %in) {
2114 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread") seq_cst
2115 store i32 %val, ptr addrspace(1) %out, align 4
2119 define amdgpu_kernel void @global_singlethread_monotonic_monotonic_cmpxchg(
2120 ; GFX6-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2121 ; GFX6: ; %bb.0: ; %entry
2122 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2123 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2124 ; GFX6-NEXT: s_mov_b32 s6, -1
2125 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2126 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2127 ; GFX6-NEXT: s_mov_b32 s4, s0
2128 ; GFX6-NEXT: s_mov_b32 s5, s1
2129 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2130 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2131 ; GFX6-NEXT: s_endpgm
2133 ; GFX7-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2134 ; GFX7: ; %bb.0: ; %entry
2135 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2136 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2137 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2138 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2139 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2140 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2141 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2142 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2143 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2144 ; GFX7-NEXT: s_endpgm
2146 ; GFX10-WGP-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2147 ; GFX10-WGP: ; %bb.0: ; %entry
2148 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2149 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2150 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2151 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2152 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2153 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2154 ; GFX10-WGP-NEXT: s_endpgm
2156 ; GFX10-CU-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2157 ; GFX10-CU: ; %bb.0: ; %entry
2158 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2159 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2160 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2161 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2162 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2163 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2164 ; GFX10-CU-NEXT: s_endpgm
2166 ; SKIP-CACHE-INV-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2167 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2168 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2169 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2170 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2171 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2172 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2173 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2174 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2175 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2176 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2177 ; SKIP-CACHE-INV-NEXT: s_endpgm
2179 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2180 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2181 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2182 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2183 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2184 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2185 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2186 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2188 ; GFX90A-TGSPLIT-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2189 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2190 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2191 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2192 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2193 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2194 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2195 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2197 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2198 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2199 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2200 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2201 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2202 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2203 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2204 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2206 ; GFX940-TGSPLIT-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2207 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2208 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2209 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2210 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2211 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2212 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2213 ; GFX940-TGSPLIT-NEXT: s_endpgm
2215 ; GFX11-WGP-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2216 ; GFX11-WGP: ; %bb.0: ; %entry
2217 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2218 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2219 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2220 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2221 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2222 ; GFX11-WGP-NEXT: s_nop 0
2223 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2224 ; GFX11-WGP-NEXT: s_endpgm
2226 ; GFX11-CU-LABEL: global_singlethread_monotonic_monotonic_cmpxchg:
2227 ; GFX11-CU: ; %bb.0: ; %entry
2228 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2229 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2230 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2231 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2232 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2233 ; GFX11-CU-NEXT: s_nop 0
2234 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2235 ; GFX11-CU-NEXT: s_endpgm
2236 ptr addrspace(1) %out, i32 %in, i32 %old) {
2238 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
2239 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic monotonic
2243 define amdgpu_kernel void @global_singlethread_acquire_monotonic_cmpxchg(
2244 ; GFX6-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2245 ; GFX6: ; %bb.0: ; %entry
2246 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2247 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2248 ; GFX6-NEXT: s_mov_b32 s6, -1
2249 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2250 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2251 ; GFX6-NEXT: s_mov_b32 s4, s0
2252 ; GFX6-NEXT: s_mov_b32 s5, s1
2253 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2254 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2255 ; GFX6-NEXT: s_endpgm
2257 ; GFX7-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2258 ; GFX7: ; %bb.0: ; %entry
2259 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2260 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2261 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2262 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2263 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2264 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2265 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2266 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2267 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2268 ; GFX7-NEXT: s_endpgm
2270 ; GFX10-WGP-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2271 ; GFX10-WGP: ; %bb.0: ; %entry
2272 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2273 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2274 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2275 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2276 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2277 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2278 ; GFX10-WGP-NEXT: s_endpgm
2280 ; GFX10-CU-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2281 ; GFX10-CU: ; %bb.0: ; %entry
2282 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2283 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2284 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2285 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2286 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2287 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2288 ; GFX10-CU-NEXT: s_endpgm
2290 ; SKIP-CACHE-INV-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2291 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2292 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2293 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2294 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2295 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2296 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2297 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2298 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2299 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2300 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2301 ; SKIP-CACHE-INV-NEXT: s_endpgm
2303 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2304 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2305 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2306 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2307 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2308 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2309 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2310 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2312 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2313 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2314 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2315 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2316 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2317 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2318 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2319 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2321 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2322 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2323 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2324 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2325 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2326 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2327 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2328 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2330 ; GFX940-TGSPLIT-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2331 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2332 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2333 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2334 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2335 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2336 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2337 ; GFX940-TGSPLIT-NEXT: s_endpgm
2339 ; GFX11-WGP-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2340 ; GFX11-WGP: ; %bb.0: ; %entry
2341 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2342 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2343 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2344 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2345 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2346 ; GFX11-WGP-NEXT: s_nop 0
2347 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2348 ; GFX11-WGP-NEXT: s_endpgm
2350 ; GFX11-CU-LABEL: global_singlethread_acquire_monotonic_cmpxchg:
2351 ; GFX11-CU: ; %bb.0: ; %entry
2352 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2353 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2354 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2355 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2356 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2357 ; GFX11-CU-NEXT: s_nop 0
2358 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2359 ; GFX11-CU-NEXT: s_endpgm
2360 ptr addrspace(1) %out, i32 %in, i32 %old) {
2362 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
2363 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acquire monotonic
2367 define amdgpu_kernel void @global_singlethread_release_monotonic_cmpxchg(
2368 ; GFX6-LABEL: global_singlethread_release_monotonic_cmpxchg:
2369 ; GFX6: ; %bb.0: ; %entry
2370 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2371 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2372 ; GFX6-NEXT: s_mov_b32 s6, -1
2373 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2374 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2375 ; GFX6-NEXT: s_mov_b32 s4, s0
2376 ; GFX6-NEXT: s_mov_b32 s5, s1
2377 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2378 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2379 ; GFX6-NEXT: s_endpgm
2381 ; GFX7-LABEL: global_singlethread_release_monotonic_cmpxchg:
2382 ; GFX7: ; %bb.0: ; %entry
2383 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2384 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2385 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2386 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2387 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2388 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2389 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2390 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2391 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2392 ; GFX7-NEXT: s_endpgm
2394 ; GFX10-WGP-LABEL: global_singlethread_release_monotonic_cmpxchg:
2395 ; GFX10-WGP: ; %bb.0: ; %entry
2396 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2397 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2398 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2399 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2400 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2401 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2402 ; GFX10-WGP-NEXT: s_endpgm
2404 ; GFX10-CU-LABEL: global_singlethread_release_monotonic_cmpxchg:
2405 ; GFX10-CU: ; %bb.0: ; %entry
2406 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2407 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2408 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2409 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2410 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2411 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2412 ; GFX10-CU-NEXT: s_endpgm
2414 ; SKIP-CACHE-INV-LABEL: global_singlethread_release_monotonic_cmpxchg:
2415 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2416 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2417 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2418 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2419 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2420 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2421 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2422 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2423 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2424 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2425 ; SKIP-CACHE-INV-NEXT: s_endpgm
2427 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_release_monotonic_cmpxchg:
2428 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2429 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2430 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2431 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2432 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2433 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2434 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2436 ; GFX90A-TGSPLIT-LABEL: global_singlethread_release_monotonic_cmpxchg:
2437 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2438 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2439 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2440 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2441 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2442 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2443 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2445 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_release_monotonic_cmpxchg:
2446 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2447 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2448 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2449 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2450 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2451 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2452 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2454 ; GFX940-TGSPLIT-LABEL: global_singlethread_release_monotonic_cmpxchg:
2455 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2456 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2457 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2458 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2459 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2460 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2461 ; GFX940-TGSPLIT-NEXT: s_endpgm
2463 ; GFX11-WGP-LABEL: global_singlethread_release_monotonic_cmpxchg:
2464 ; GFX11-WGP: ; %bb.0: ; %entry
2465 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2466 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2467 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2468 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2469 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2470 ; GFX11-WGP-NEXT: s_nop 0
2471 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2472 ; GFX11-WGP-NEXT: s_endpgm
2474 ; GFX11-CU-LABEL: global_singlethread_release_monotonic_cmpxchg:
2475 ; GFX11-CU: ; %bb.0: ; %entry
2476 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2477 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2478 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2479 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2480 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2481 ; GFX11-CU-NEXT: s_nop 0
2482 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2483 ; GFX11-CU-NEXT: s_endpgm
2484 ptr addrspace(1) %out, i32 %in, i32 %old) {
2486 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
2487 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") release monotonic
2491 define amdgpu_kernel void @global_singlethread_acq_rel_monotonic_cmpxchg(
2492 ; GFX6-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2493 ; GFX6: ; %bb.0: ; %entry
2494 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2495 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2496 ; GFX6-NEXT: s_mov_b32 s6, -1
2497 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2498 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2499 ; GFX6-NEXT: s_mov_b32 s4, s0
2500 ; GFX6-NEXT: s_mov_b32 s5, s1
2501 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2502 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2503 ; GFX6-NEXT: s_endpgm
2505 ; GFX7-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2506 ; GFX7: ; %bb.0: ; %entry
2507 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2508 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2509 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2510 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2511 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2512 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2513 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2514 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2515 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2516 ; GFX7-NEXT: s_endpgm
2518 ; GFX10-WGP-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2519 ; GFX10-WGP: ; %bb.0: ; %entry
2520 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2521 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2522 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2523 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2524 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2525 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2526 ; GFX10-WGP-NEXT: s_endpgm
2528 ; GFX10-CU-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2529 ; GFX10-CU: ; %bb.0: ; %entry
2530 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2531 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2532 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2533 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2534 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2535 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2536 ; GFX10-CU-NEXT: s_endpgm
2538 ; SKIP-CACHE-INV-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2539 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2540 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2541 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2542 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2543 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2544 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2545 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2546 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2547 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2548 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2549 ; SKIP-CACHE-INV-NEXT: s_endpgm
2551 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2552 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2553 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2554 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2555 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2556 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2557 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2558 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2560 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2561 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2562 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2563 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2564 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2565 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2566 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2567 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2569 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2570 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2571 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2572 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2573 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2574 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2575 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2576 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2578 ; GFX940-TGSPLIT-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2579 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2580 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2581 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2582 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2583 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2584 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2585 ; GFX940-TGSPLIT-NEXT: s_endpgm
2587 ; GFX11-WGP-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2588 ; GFX11-WGP: ; %bb.0: ; %entry
2589 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2590 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2591 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2592 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2593 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2594 ; GFX11-WGP-NEXT: s_nop 0
2595 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2596 ; GFX11-WGP-NEXT: s_endpgm
2598 ; GFX11-CU-LABEL: global_singlethread_acq_rel_monotonic_cmpxchg:
2599 ; GFX11-CU: ; %bb.0: ; %entry
2600 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2601 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2602 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2603 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2604 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2605 ; GFX11-CU-NEXT: s_nop 0
2606 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2607 ; GFX11-CU-NEXT: s_endpgm
2608 ptr addrspace(1) %out, i32 %in, i32 %old) {
2610 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
2611 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel monotonic
2615 define amdgpu_kernel void @global_singlethread_seq_cst_monotonic_cmpxchg(
2616 ; GFX6-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2617 ; GFX6: ; %bb.0: ; %entry
2618 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2619 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2620 ; GFX6-NEXT: s_mov_b32 s6, -1
2621 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2622 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2623 ; GFX6-NEXT: s_mov_b32 s4, s0
2624 ; GFX6-NEXT: s_mov_b32 s5, s1
2625 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2626 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2627 ; GFX6-NEXT: s_endpgm
2629 ; GFX7-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2630 ; GFX7: ; %bb.0: ; %entry
2631 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2632 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2633 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2634 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2635 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2636 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2637 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2638 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2639 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2640 ; GFX7-NEXT: s_endpgm
2642 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2643 ; GFX10-WGP: ; %bb.0: ; %entry
2644 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2645 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2646 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2647 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2648 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2649 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2650 ; GFX10-WGP-NEXT: s_endpgm
2652 ; GFX10-CU-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2653 ; GFX10-CU: ; %bb.0: ; %entry
2654 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2655 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2656 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2657 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2658 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2659 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2660 ; GFX10-CU-NEXT: s_endpgm
2662 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2663 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2664 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2665 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2666 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2667 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2668 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2669 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2670 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2671 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2672 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2673 ; SKIP-CACHE-INV-NEXT: s_endpgm
2675 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2676 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2677 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2678 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2679 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2680 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2681 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2682 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2684 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2685 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2686 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2687 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2688 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2689 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2690 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2691 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2693 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2694 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2695 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2696 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2697 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2698 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2699 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2700 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2702 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2703 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2704 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2705 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2706 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2707 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2708 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2709 ; GFX940-TGSPLIT-NEXT: s_endpgm
2711 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2712 ; GFX11-WGP: ; %bb.0: ; %entry
2713 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2714 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2715 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2716 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2717 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2718 ; GFX11-WGP-NEXT: s_nop 0
2719 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2720 ; GFX11-WGP-NEXT: s_endpgm
2722 ; GFX11-CU-LABEL: global_singlethread_seq_cst_monotonic_cmpxchg:
2723 ; GFX11-CU: ; %bb.0: ; %entry
2724 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2725 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2726 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2727 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2728 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2729 ; GFX11-CU-NEXT: s_nop 0
2730 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2731 ; GFX11-CU-NEXT: s_endpgm
2732 ptr addrspace(1) %out, i32 %in, i32 %old) {
2734 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
2735 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst monotonic
2739 define amdgpu_kernel void @global_singlethread_monotonic_acquire_cmpxchg(
2740 ; GFX6-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2741 ; GFX6: ; %bb.0: ; %entry
2742 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2743 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2744 ; GFX6-NEXT: s_mov_b32 s6, -1
2745 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2746 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2747 ; GFX6-NEXT: s_mov_b32 s4, s0
2748 ; GFX6-NEXT: s_mov_b32 s5, s1
2749 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2750 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2751 ; GFX6-NEXT: s_endpgm
2753 ; GFX7-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2754 ; GFX7: ; %bb.0: ; %entry
2755 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2756 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2757 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2758 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2759 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2760 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2761 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2762 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2763 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2764 ; GFX7-NEXT: s_endpgm
2766 ; GFX10-WGP-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2767 ; GFX10-WGP: ; %bb.0: ; %entry
2768 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2769 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2770 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2771 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2772 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2773 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2774 ; GFX10-WGP-NEXT: s_endpgm
2776 ; GFX10-CU-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2777 ; GFX10-CU: ; %bb.0: ; %entry
2778 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2779 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2780 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2781 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2782 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2783 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2784 ; GFX10-CU-NEXT: s_endpgm
2786 ; SKIP-CACHE-INV-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2787 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2788 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2789 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2790 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2791 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2792 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2793 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2794 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2795 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2796 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2797 ; SKIP-CACHE-INV-NEXT: s_endpgm
2799 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2800 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2801 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2802 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2803 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2804 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2805 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2806 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2808 ; GFX90A-TGSPLIT-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2809 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2810 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2811 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2812 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2813 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2814 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2815 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2817 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2818 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2819 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2820 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2821 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2822 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2823 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2824 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2826 ; GFX940-TGSPLIT-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2827 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2828 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2829 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2830 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2831 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2832 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2833 ; GFX940-TGSPLIT-NEXT: s_endpgm
2835 ; GFX11-WGP-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2836 ; GFX11-WGP: ; %bb.0: ; %entry
2837 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2838 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2839 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2840 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2841 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2842 ; GFX11-WGP-NEXT: s_nop 0
2843 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2844 ; GFX11-WGP-NEXT: s_endpgm
2846 ; GFX11-CU-LABEL: global_singlethread_monotonic_acquire_cmpxchg:
2847 ; GFX11-CU: ; %bb.0: ; %entry
2848 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2849 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2850 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2851 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2852 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2853 ; GFX11-CU-NEXT: s_nop 0
2854 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2855 ; GFX11-CU-NEXT: s_endpgm
2856 ptr addrspace(1) %out, i32 %in, i32 %old) {
2858 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
2859 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic acquire
2863 define amdgpu_kernel void @global_singlethread_acquire_acquire_cmpxchg(
2864 ; GFX6-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2865 ; GFX6: ; %bb.0: ; %entry
2866 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2867 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2868 ; GFX6-NEXT: s_mov_b32 s6, -1
2869 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2870 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2871 ; GFX6-NEXT: s_mov_b32 s4, s0
2872 ; GFX6-NEXT: s_mov_b32 s5, s1
2873 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2874 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2875 ; GFX6-NEXT: s_endpgm
2877 ; GFX7-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2878 ; GFX7: ; %bb.0: ; %entry
2879 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2880 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2881 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2882 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2883 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2884 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2885 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2886 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2887 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2888 ; GFX7-NEXT: s_endpgm
2890 ; GFX10-WGP-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2891 ; GFX10-WGP: ; %bb.0: ; %entry
2892 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2893 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2894 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2895 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2896 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2897 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2898 ; GFX10-WGP-NEXT: s_endpgm
2900 ; GFX10-CU-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2901 ; GFX10-CU: ; %bb.0: ; %entry
2902 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2903 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2904 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2905 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2906 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2907 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2908 ; GFX10-CU-NEXT: s_endpgm
2910 ; SKIP-CACHE-INV-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2911 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2912 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2913 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2914 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2915 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2916 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2917 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2918 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2919 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2920 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2921 ; SKIP-CACHE-INV-NEXT: s_endpgm
2923 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2924 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2925 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2926 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2927 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2928 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2929 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2930 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2932 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2933 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2934 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2935 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2936 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2937 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2938 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2939 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2941 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2942 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2943 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2944 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2945 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2946 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2947 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2948 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2950 ; GFX940-TGSPLIT-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2951 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2952 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2953 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2954 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2955 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2956 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2957 ; GFX940-TGSPLIT-NEXT: s_endpgm
2959 ; GFX11-WGP-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2960 ; GFX11-WGP: ; %bb.0: ; %entry
2961 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2962 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2963 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2964 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2965 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2966 ; GFX11-WGP-NEXT: s_nop 0
2967 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2968 ; GFX11-WGP-NEXT: s_endpgm
2970 ; GFX11-CU-LABEL: global_singlethread_acquire_acquire_cmpxchg:
2971 ; GFX11-CU: ; %bb.0: ; %entry
2972 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2973 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2974 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2975 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2976 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2977 ; GFX11-CU-NEXT: s_nop 0
2978 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2979 ; GFX11-CU-NEXT: s_endpgm
2980 ptr addrspace(1) %out, i32 %in, i32 %old) {
2982 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
2983 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acquire acquire
2987 define amdgpu_kernel void @global_singlethread_release_acquire_cmpxchg(
2988 ; GFX6-LABEL: global_singlethread_release_acquire_cmpxchg:
2989 ; GFX6: ; %bb.0: ; %entry
2990 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2991 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2992 ; GFX6-NEXT: s_mov_b32 s6, -1
2993 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2994 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2995 ; GFX6-NEXT: s_mov_b32 s4, s0
2996 ; GFX6-NEXT: s_mov_b32 s5, s1
2997 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2998 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2999 ; GFX6-NEXT: s_endpgm
3001 ; GFX7-LABEL: global_singlethread_release_acquire_cmpxchg:
3002 ; GFX7: ; %bb.0: ; %entry
3003 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3004 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3005 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3006 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3007 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3008 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3009 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3010 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3011 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3012 ; GFX7-NEXT: s_endpgm
3014 ; GFX10-WGP-LABEL: global_singlethread_release_acquire_cmpxchg:
3015 ; GFX10-WGP: ; %bb.0: ; %entry
3016 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3017 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3018 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3019 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3020 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3021 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3022 ; GFX10-WGP-NEXT: s_endpgm
3024 ; GFX10-CU-LABEL: global_singlethread_release_acquire_cmpxchg:
3025 ; GFX10-CU: ; %bb.0: ; %entry
3026 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3027 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3028 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3029 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3030 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3031 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3032 ; GFX10-CU-NEXT: s_endpgm
3034 ; SKIP-CACHE-INV-LABEL: global_singlethread_release_acquire_cmpxchg:
3035 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3036 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3037 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3038 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3039 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3040 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3041 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3042 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3043 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3044 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3045 ; SKIP-CACHE-INV-NEXT: s_endpgm
3047 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_release_acquire_cmpxchg:
3048 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3049 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3050 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3051 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3052 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3053 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3054 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3056 ; GFX90A-TGSPLIT-LABEL: global_singlethread_release_acquire_cmpxchg:
3057 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3058 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3059 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3060 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3061 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3062 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3063 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3065 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_release_acquire_cmpxchg:
3066 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3067 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3068 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3069 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3070 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3071 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3072 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3074 ; GFX940-TGSPLIT-LABEL: global_singlethread_release_acquire_cmpxchg:
3075 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3076 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3077 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3078 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3079 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3080 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3081 ; GFX940-TGSPLIT-NEXT: s_endpgm
3083 ; GFX11-WGP-LABEL: global_singlethread_release_acquire_cmpxchg:
3084 ; GFX11-WGP: ; %bb.0: ; %entry
3085 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3086 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3087 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3088 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3089 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3090 ; GFX11-WGP-NEXT: s_nop 0
3091 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3092 ; GFX11-WGP-NEXT: s_endpgm
3094 ; GFX11-CU-LABEL: global_singlethread_release_acquire_cmpxchg:
3095 ; GFX11-CU: ; %bb.0: ; %entry
3096 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3097 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3098 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3099 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3100 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3101 ; GFX11-CU-NEXT: s_nop 0
3102 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3103 ; GFX11-CU-NEXT: s_endpgm
3104 ptr addrspace(1) %out, i32 %in, i32 %old) {
3106 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3107 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") release acquire
3111 define amdgpu_kernel void @global_singlethread_acq_rel_acquire_cmpxchg(
3112 ; GFX6-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3113 ; GFX6: ; %bb.0: ; %entry
3114 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3115 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3116 ; GFX6-NEXT: s_mov_b32 s6, -1
3117 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3118 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3119 ; GFX6-NEXT: s_mov_b32 s4, s0
3120 ; GFX6-NEXT: s_mov_b32 s5, s1
3121 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3122 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3123 ; GFX6-NEXT: s_endpgm
3125 ; GFX7-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3126 ; GFX7: ; %bb.0: ; %entry
3127 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3128 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3129 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3130 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3131 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3132 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3133 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3134 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3135 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3136 ; GFX7-NEXT: s_endpgm
3138 ; GFX10-WGP-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3139 ; GFX10-WGP: ; %bb.0: ; %entry
3140 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3141 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3142 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3143 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3144 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3145 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3146 ; GFX10-WGP-NEXT: s_endpgm
3148 ; GFX10-CU-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3149 ; GFX10-CU: ; %bb.0: ; %entry
3150 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3151 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3152 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3153 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3154 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3155 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3156 ; GFX10-CU-NEXT: s_endpgm
3158 ; SKIP-CACHE-INV-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3159 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3160 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3161 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3162 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3163 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3164 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3165 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3166 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3167 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3168 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3169 ; SKIP-CACHE-INV-NEXT: s_endpgm
3171 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3172 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3173 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3174 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3175 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3176 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3177 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3178 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3180 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3181 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3182 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3183 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3184 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3185 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3186 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3187 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3189 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3190 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3191 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3192 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3193 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3194 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3195 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3196 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3198 ; GFX940-TGSPLIT-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3199 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3200 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3201 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3202 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3203 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3204 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3205 ; GFX940-TGSPLIT-NEXT: s_endpgm
3207 ; GFX11-WGP-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3208 ; GFX11-WGP: ; %bb.0: ; %entry
3209 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3210 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3211 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3212 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3213 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3214 ; GFX11-WGP-NEXT: s_nop 0
3215 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3216 ; GFX11-WGP-NEXT: s_endpgm
3218 ; GFX11-CU-LABEL: global_singlethread_acq_rel_acquire_cmpxchg:
3219 ; GFX11-CU: ; %bb.0: ; %entry
3220 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3221 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3222 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3223 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3224 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3225 ; GFX11-CU-NEXT: s_nop 0
3226 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3227 ; GFX11-CU-NEXT: s_endpgm
3228 ptr addrspace(1) %out, i32 %in, i32 %old) {
3230 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3231 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel acquire
3235 define amdgpu_kernel void @global_singlethread_seq_cst_acquire_cmpxchg(
3236 ; GFX6-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3237 ; GFX6: ; %bb.0: ; %entry
3238 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3239 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3240 ; GFX6-NEXT: s_mov_b32 s6, -1
3241 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3242 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3243 ; GFX6-NEXT: s_mov_b32 s4, s0
3244 ; GFX6-NEXT: s_mov_b32 s5, s1
3245 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3246 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3247 ; GFX6-NEXT: s_endpgm
3249 ; GFX7-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3250 ; GFX7: ; %bb.0: ; %entry
3251 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3252 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3253 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3254 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3255 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3256 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3257 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3258 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3259 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3260 ; GFX7-NEXT: s_endpgm
3262 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3263 ; GFX10-WGP: ; %bb.0: ; %entry
3264 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3265 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3266 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3267 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3268 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3269 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3270 ; GFX10-WGP-NEXT: s_endpgm
3272 ; GFX10-CU-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3273 ; GFX10-CU: ; %bb.0: ; %entry
3274 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3275 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3276 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3277 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3278 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3279 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3280 ; GFX10-CU-NEXT: s_endpgm
3282 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3283 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3284 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3285 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3286 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3287 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3288 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3289 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3290 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3291 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3292 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3293 ; SKIP-CACHE-INV-NEXT: s_endpgm
3295 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3296 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3297 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3298 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3299 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3300 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3301 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3302 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3304 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3305 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3306 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3307 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3308 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3309 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3310 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3311 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3313 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3314 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3315 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3316 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3317 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3318 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3319 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3320 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3322 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3323 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3324 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3325 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3326 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3327 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3328 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3329 ; GFX940-TGSPLIT-NEXT: s_endpgm
3331 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3332 ; GFX11-WGP: ; %bb.0: ; %entry
3333 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3334 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3335 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3336 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3337 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3338 ; GFX11-WGP-NEXT: s_nop 0
3339 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3340 ; GFX11-WGP-NEXT: s_endpgm
3342 ; GFX11-CU-LABEL: global_singlethread_seq_cst_acquire_cmpxchg:
3343 ; GFX11-CU: ; %bb.0: ; %entry
3344 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3345 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3346 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3347 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3348 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3349 ; GFX11-CU-NEXT: s_nop 0
3350 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3351 ; GFX11-CU-NEXT: s_endpgm
3352 ptr addrspace(1) %out, i32 %in, i32 %old) {
3354 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3355 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst acquire
3359 define amdgpu_kernel void @global_singlethread_monotonic_seq_cst_cmpxchg(
3360 ; GFX6-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3361 ; GFX6: ; %bb.0: ; %entry
3362 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3363 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3364 ; GFX6-NEXT: s_mov_b32 s6, -1
3365 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3366 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3367 ; GFX6-NEXT: s_mov_b32 s4, s0
3368 ; GFX6-NEXT: s_mov_b32 s5, s1
3369 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3370 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3371 ; GFX6-NEXT: s_endpgm
3373 ; GFX7-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3374 ; GFX7: ; %bb.0: ; %entry
3375 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3376 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3377 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3378 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3379 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3380 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3381 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3382 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3383 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3384 ; GFX7-NEXT: s_endpgm
3386 ; GFX10-WGP-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3387 ; GFX10-WGP: ; %bb.0: ; %entry
3388 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3389 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3390 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3391 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3392 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3393 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3394 ; GFX10-WGP-NEXT: s_endpgm
3396 ; GFX10-CU-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3397 ; GFX10-CU: ; %bb.0: ; %entry
3398 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3399 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3400 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3401 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3402 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3403 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3404 ; GFX10-CU-NEXT: s_endpgm
3406 ; SKIP-CACHE-INV-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3407 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3408 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3409 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3410 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3411 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3412 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3413 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3414 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3415 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3416 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3417 ; SKIP-CACHE-INV-NEXT: s_endpgm
3419 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3420 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3421 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3422 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3423 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3424 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3425 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3426 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3428 ; GFX90A-TGSPLIT-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3429 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3430 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3431 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3432 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3433 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3434 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3435 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3437 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3438 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3439 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3440 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3441 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3442 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3443 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3444 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3446 ; GFX940-TGSPLIT-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3447 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3448 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3449 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3450 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3451 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3452 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3453 ; GFX940-TGSPLIT-NEXT: s_endpgm
3455 ; GFX11-WGP-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3456 ; GFX11-WGP: ; %bb.0: ; %entry
3457 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3458 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3459 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3460 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3461 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3462 ; GFX11-WGP-NEXT: s_nop 0
3463 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3464 ; GFX11-WGP-NEXT: s_endpgm
3466 ; GFX11-CU-LABEL: global_singlethread_monotonic_seq_cst_cmpxchg:
3467 ; GFX11-CU: ; %bb.0: ; %entry
3468 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3469 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3470 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3471 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3472 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3473 ; GFX11-CU-NEXT: s_nop 0
3474 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3475 ; GFX11-CU-NEXT: s_endpgm
3476 ptr addrspace(1) %out, i32 %in, i32 %old) {
3478 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3479 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic seq_cst
3483 define amdgpu_kernel void @global_singlethread_acquire_seq_cst_cmpxchg(
3484 ; GFX6-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3485 ; GFX6: ; %bb.0: ; %entry
3486 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3487 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3488 ; GFX6-NEXT: s_mov_b32 s6, -1
3489 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3490 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3491 ; GFX6-NEXT: s_mov_b32 s4, s0
3492 ; GFX6-NEXT: s_mov_b32 s5, s1
3493 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3494 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3495 ; GFX6-NEXT: s_endpgm
3497 ; GFX7-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3498 ; GFX7: ; %bb.0: ; %entry
3499 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3500 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3501 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3502 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3503 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3504 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3505 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3506 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3507 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3508 ; GFX7-NEXT: s_endpgm
3510 ; GFX10-WGP-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3511 ; GFX10-WGP: ; %bb.0: ; %entry
3512 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3513 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3514 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3515 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3516 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3517 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3518 ; GFX10-WGP-NEXT: s_endpgm
3520 ; GFX10-CU-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3521 ; GFX10-CU: ; %bb.0: ; %entry
3522 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3523 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3524 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3525 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3526 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3527 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3528 ; GFX10-CU-NEXT: s_endpgm
3530 ; SKIP-CACHE-INV-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3531 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3532 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3533 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3534 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3535 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3536 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3537 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3538 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3539 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3540 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3541 ; SKIP-CACHE-INV-NEXT: s_endpgm
3543 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3544 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3545 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3546 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3547 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3548 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3549 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3550 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3552 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3553 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3554 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3555 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3556 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3557 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3558 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3559 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3561 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3562 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3563 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3564 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3565 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3566 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3567 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3568 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3570 ; GFX940-TGSPLIT-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3571 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3572 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3573 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3574 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3575 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3576 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3577 ; GFX940-TGSPLIT-NEXT: s_endpgm
3579 ; GFX11-WGP-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3580 ; GFX11-WGP: ; %bb.0: ; %entry
3581 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3582 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3583 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3584 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3585 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3586 ; GFX11-WGP-NEXT: s_nop 0
3587 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3588 ; GFX11-WGP-NEXT: s_endpgm
3590 ; GFX11-CU-LABEL: global_singlethread_acquire_seq_cst_cmpxchg:
3591 ; GFX11-CU: ; %bb.0: ; %entry
3592 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3593 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3594 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3595 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3596 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3597 ; GFX11-CU-NEXT: s_nop 0
3598 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3599 ; GFX11-CU-NEXT: s_endpgm
3600 ptr addrspace(1) %out, i32 %in, i32 %old) {
3602 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3603 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acquire seq_cst
3607 define amdgpu_kernel void @global_singlethread_release_seq_cst_cmpxchg(
3608 ; GFX6-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3609 ; GFX6: ; %bb.0: ; %entry
3610 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3611 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3612 ; GFX6-NEXT: s_mov_b32 s6, -1
3613 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3614 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3615 ; GFX6-NEXT: s_mov_b32 s4, s0
3616 ; GFX6-NEXT: s_mov_b32 s5, s1
3617 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3618 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3619 ; GFX6-NEXT: s_endpgm
3621 ; GFX7-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3622 ; GFX7: ; %bb.0: ; %entry
3623 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3624 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3625 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3626 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3627 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3628 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3629 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3630 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3631 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3632 ; GFX7-NEXT: s_endpgm
3634 ; GFX10-WGP-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3635 ; GFX10-WGP: ; %bb.0: ; %entry
3636 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3637 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3638 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3639 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3640 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3641 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3642 ; GFX10-WGP-NEXT: s_endpgm
3644 ; GFX10-CU-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3645 ; GFX10-CU: ; %bb.0: ; %entry
3646 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3647 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3648 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3649 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3650 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3651 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3652 ; GFX10-CU-NEXT: s_endpgm
3654 ; SKIP-CACHE-INV-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3655 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3656 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3657 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3658 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3659 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3660 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3661 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3662 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3663 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3664 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3665 ; SKIP-CACHE-INV-NEXT: s_endpgm
3667 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3668 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3669 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3670 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3671 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3672 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3673 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3674 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3676 ; GFX90A-TGSPLIT-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3677 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3678 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3679 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3680 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3681 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3682 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3683 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3685 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3686 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3687 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3688 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3689 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3690 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3691 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3692 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3694 ; GFX940-TGSPLIT-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3695 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3696 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3697 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3698 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3699 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3700 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3701 ; GFX940-TGSPLIT-NEXT: s_endpgm
3703 ; GFX11-WGP-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3704 ; GFX11-WGP: ; %bb.0: ; %entry
3705 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3706 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3707 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3708 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3709 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3710 ; GFX11-WGP-NEXT: s_nop 0
3711 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3712 ; GFX11-WGP-NEXT: s_endpgm
3714 ; GFX11-CU-LABEL: global_singlethread_release_seq_cst_cmpxchg:
3715 ; GFX11-CU: ; %bb.0: ; %entry
3716 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3717 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3718 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3719 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3720 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3721 ; GFX11-CU-NEXT: s_nop 0
3722 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3723 ; GFX11-CU-NEXT: s_endpgm
3724 ptr addrspace(1) %out, i32 %in, i32 %old) {
3726 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3727 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") release seq_cst
3731 define amdgpu_kernel void @global_singlethread_acq_rel_seq_cst_cmpxchg(
3732 ; GFX6-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3733 ; GFX6: ; %bb.0: ; %entry
3734 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3735 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3736 ; GFX6-NEXT: s_mov_b32 s6, -1
3737 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3738 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3739 ; GFX6-NEXT: s_mov_b32 s4, s0
3740 ; GFX6-NEXT: s_mov_b32 s5, s1
3741 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3742 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3743 ; GFX6-NEXT: s_endpgm
3745 ; GFX7-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3746 ; GFX7: ; %bb.0: ; %entry
3747 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3748 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3749 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3750 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3751 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3752 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3753 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3754 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3755 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3756 ; GFX7-NEXT: s_endpgm
3758 ; GFX10-WGP-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3759 ; GFX10-WGP: ; %bb.0: ; %entry
3760 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3761 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3762 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3763 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3764 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3765 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3766 ; GFX10-WGP-NEXT: s_endpgm
3768 ; GFX10-CU-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3769 ; GFX10-CU: ; %bb.0: ; %entry
3770 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3771 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3772 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3773 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3774 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3775 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3776 ; GFX10-CU-NEXT: s_endpgm
3778 ; SKIP-CACHE-INV-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3779 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3780 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3781 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3782 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3783 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3784 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3785 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3786 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3787 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3788 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3789 ; SKIP-CACHE-INV-NEXT: s_endpgm
3791 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3792 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3793 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3794 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3795 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3796 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3797 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3798 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3800 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3801 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3802 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3803 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3804 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3805 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3806 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3807 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3809 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3810 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3811 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3812 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3813 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3814 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3815 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3816 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3818 ; GFX940-TGSPLIT-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3819 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3820 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3821 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3822 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3823 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3824 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3825 ; GFX940-TGSPLIT-NEXT: s_endpgm
3827 ; GFX11-WGP-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3828 ; GFX11-WGP: ; %bb.0: ; %entry
3829 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3830 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3831 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3832 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3833 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3834 ; GFX11-WGP-NEXT: s_nop 0
3835 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3836 ; GFX11-WGP-NEXT: s_endpgm
3838 ; GFX11-CU-LABEL: global_singlethread_acq_rel_seq_cst_cmpxchg:
3839 ; GFX11-CU: ; %bb.0: ; %entry
3840 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3841 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3842 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3843 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3844 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3845 ; GFX11-CU-NEXT: s_nop 0
3846 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3847 ; GFX11-CU-NEXT: s_endpgm
3848 ptr addrspace(1) %out, i32 %in, i32 %old) {
3850 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3851 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel seq_cst
3855 define amdgpu_kernel void @global_singlethread_seq_cst_seq_cst_cmpxchg(
3856 ; GFX6-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3857 ; GFX6: ; %bb.0: ; %entry
3858 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3859 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3860 ; GFX6-NEXT: s_mov_b32 s6, -1
3861 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3862 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3863 ; GFX6-NEXT: s_mov_b32 s4, s0
3864 ; GFX6-NEXT: s_mov_b32 s5, s1
3865 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3866 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3867 ; GFX6-NEXT: s_endpgm
3869 ; GFX7-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3870 ; GFX7: ; %bb.0: ; %entry
3871 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3872 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3873 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3874 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3875 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3876 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3877 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3878 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3879 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3880 ; GFX7-NEXT: s_endpgm
3882 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3883 ; GFX10-WGP: ; %bb.0: ; %entry
3884 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3885 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3886 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3887 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3888 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3889 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3890 ; GFX10-WGP-NEXT: s_endpgm
3892 ; GFX10-CU-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3893 ; GFX10-CU: ; %bb.0: ; %entry
3894 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3895 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3896 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3897 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3898 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3899 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3900 ; GFX10-CU-NEXT: s_endpgm
3902 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3903 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3904 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3905 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3906 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3907 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3908 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3909 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3910 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3911 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3912 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3913 ; SKIP-CACHE-INV-NEXT: s_endpgm
3915 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3916 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3917 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3918 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3919 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3920 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3921 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3922 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3924 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3925 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3926 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3927 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3928 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3929 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3930 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3931 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3933 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3934 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3935 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3936 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3937 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3938 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3939 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3940 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3942 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3943 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3944 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3945 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3946 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3947 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3948 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3949 ; GFX940-TGSPLIT-NEXT: s_endpgm
3951 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3952 ; GFX11-WGP: ; %bb.0: ; %entry
3953 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3954 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3955 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3956 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3957 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3958 ; GFX11-WGP-NEXT: s_nop 0
3959 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3960 ; GFX11-WGP-NEXT: s_endpgm
3962 ; GFX11-CU-LABEL: global_singlethread_seq_cst_seq_cst_cmpxchg:
3963 ; GFX11-CU: ; %bb.0: ; %entry
3964 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3965 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3966 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3967 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3968 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3969 ; GFX11-CU-NEXT: s_nop 0
3970 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
3971 ; GFX11-CU-NEXT: s_endpgm
3972 ptr addrspace(1) %out, i32 %in, i32 %old) {
3974 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
3975 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst seq_cst
3979 define amdgpu_kernel void @global_singlethread_monotonic_monotonic_ret_cmpxchg(
3980 ; GFX6-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
3981 ; GFX6: ; %bb.0: ; %entry
3982 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3983 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3984 ; GFX6-NEXT: s_mov_b32 s6, -1
3985 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3986 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3987 ; GFX6-NEXT: s_mov_b32 s4, s0
3988 ; GFX6-NEXT: s_mov_b32 s5, s1
3989 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3990 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
3991 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3992 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
3993 ; GFX6-NEXT: s_endpgm
3995 ; GFX7-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
3996 ; GFX7: ; %bb.0: ; %entry
3997 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3998 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3999 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4000 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4001 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4002 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4003 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4004 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4005 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4006 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4007 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4008 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4009 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4010 ; GFX7-NEXT: s_endpgm
4012 ; GFX10-WGP-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
4013 ; GFX10-WGP: ; %bb.0: ; %entry
4014 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4015 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4016 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4017 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4018 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4019 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4020 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4021 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4022 ; GFX10-WGP-NEXT: s_endpgm
4024 ; GFX10-CU-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
4025 ; GFX10-CU: ; %bb.0: ; %entry
4026 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4027 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4028 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4029 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4030 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4031 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4032 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4033 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4034 ; GFX10-CU-NEXT: s_endpgm
4036 ; SKIP-CACHE-INV-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
4037 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4038 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4039 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4040 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4041 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4042 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4043 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4044 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4045 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4046 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4047 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4048 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4049 ; SKIP-CACHE-INV-NEXT: s_endpgm
4051 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
4052 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4053 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4054 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4055 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4056 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4057 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4058 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4059 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4060 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4062 ; GFX90A-TGSPLIT-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
4063 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4064 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4065 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4066 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4067 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4068 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4069 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4070 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4071 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4073 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
4074 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4075 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4076 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4077 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4078 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4079 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4080 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4081 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4082 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4084 ; GFX940-TGSPLIT-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
4085 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4086 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4087 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4088 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4089 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4090 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4091 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4092 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4093 ; GFX940-TGSPLIT-NEXT: s_endpgm
4095 ; GFX11-WGP-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
4096 ; GFX11-WGP: ; %bb.0: ; %entry
4097 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4098 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4099 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4100 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4101 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4102 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4103 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4104 ; GFX11-WGP-NEXT: s_nop 0
4105 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4106 ; GFX11-WGP-NEXT: s_endpgm
4108 ; GFX11-CU-LABEL: global_singlethread_monotonic_monotonic_ret_cmpxchg:
4109 ; GFX11-CU: ; %bb.0: ; %entry
4110 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4111 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4112 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4113 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4114 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4115 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4116 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4117 ; GFX11-CU-NEXT: s_nop 0
4118 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4119 ; GFX11-CU-NEXT: s_endpgm
4120 ptr addrspace(1) %out, i32 %in, i32 %old) {
4122 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
4123 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic monotonic
4124 %val0 = extractvalue { i32, i1 } %val, 0
4125 store i32 %val0, ptr addrspace(1) %out, align 4
4129 define amdgpu_kernel void @global_singlethread_acquire_monotonic_ret_cmpxchg(
4130 ; GFX6-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4131 ; GFX6: ; %bb.0: ; %entry
4132 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4133 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4134 ; GFX6-NEXT: s_mov_b32 s6, -1
4135 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4136 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4137 ; GFX6-NEXT: s_mov_b32 s4, s0
4138 ; GFX6-NEXT: s_mov_b32 s5, s1
4139 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4140 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4141 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4142 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4143 ; GFX6-NEXT: s_endpgm
4145 ; GFX7-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4146 ; GFX7: ; %bb.0: ; %entry
4147 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4148 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4149 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4150 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4151 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4152 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4153 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4154 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4155 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4156 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4157 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4158 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4159 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4160 ; GFX7-NEXT: s_endpgm
4162 ; GFX10-WGP-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4163 ; GFX10-WGP: ; %bb.0: ; %entry
4164 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4165 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4166 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4167 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4168 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4169 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4170 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4171 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4172 ; GFX10-WGP-NEXT: s_endpgm
4174 ; GFX10-CU-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4175 ; GFX10-CU: ; %bb.0: ; %entry
4176 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4177 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4178 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4179 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4180 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4181 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4182 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4183 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4184 ; GFX10-CU-NEXT: s_endpgm
4186 ; SKIP-CACHE-INV-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4187 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4188 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4189 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4190 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4191 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4192 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4193 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4194 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4195 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4196 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4197 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4198 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4199 ; SKIP-CACHE-INV-NEXT: s_endpgm
4201 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4202 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4203 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4204 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4205 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4206 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4207 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4208 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4209 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4210 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4212 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4213 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4214 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4215 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4216 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4217 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4218 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4219 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4220 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4221 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4223 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4224 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4225 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4226 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4227 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4228 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4229 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4230 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4231 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4232 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4234 ; GFX940-TGSPLIT-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4235 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4236 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4237 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4238 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4239 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4240 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4241 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4242 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4243 ; GFX940-TGSPLIT-NEXT: s_endpgm
4245 ; GFX11-WGP-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4246 ; GFX11-WGP: ; %bb.0: ; %entry
4247 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4248 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4249 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4250 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4251 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4252 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4253 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4254 ; GFX11-WGP-NEXT: s_nop 0
4255 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4256 ; GFX11-WGP-NEXT: s_endpgm
4258 ; GFX11-CU-LABEL: global_singlethread_acquire_monotonic_ret_cmpxchg:
4259 ; GFX11-CU: ; %bb.0: ; %entry
4260 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4261 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4262 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4263 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4264 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4265 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4266 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4267 ; GFX11-CU-NEXT: s_nop 0
4268 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4269 ; GFX11-CU-NEXT: s_endpgm
4270 ptr addrspace(1) %out, i32 %in, i32 %old) {
4272 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
4273 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acquire monotonic
4274 %val0 = extractvalue { i32, i1 } %val, 0
4275 store i32 %val0, ptr addrspace(1) %out, align 4
4279 define amdgpu_kernel void @global_singlethread_release_monotonic_ret_cmpxchg(
4280 ; GFX6-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4281 ; GFX6: ; %bb.0: ; %entry
4282 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4283 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4284 ; GFX6-NEXT: s_mov_b32 s6, -1
4285 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4286 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4287 ; GFX6-NEXT: s_mov_b32 s4, s0
4288 ; GFX6-NEXT: s_mov_b32 s5, s1
4289 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4290 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4291 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4292 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4293 ; GFX6-NEXT: s_endpgm
4295 ; GFX7-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4296 ; GFX7: ; %bb.0: ; %entry
4297 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4298 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4299 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4300 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4301 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4302 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4303 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4304 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4305 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4306 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4307 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4308 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4309 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4310 ; GFX7-NEXT: s_endpgm
4312 ; GFX10-WGP-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4313 ; GFX10-WGP: ; %bb.0: ; %entry
4314 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4315 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4316 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4317 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4318 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4319 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4320 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4321 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4322 ; GFX10-WGP-NEXT: s_endpgm
4324 ; GFX10-CU-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4325 ; GFX10-CU: ; %bb.0: ; %entry
4326 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4327 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4328 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4329 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4330 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4331 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4332 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4333 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4334 ; GFX10-CU-NEXT: s_endpgm
4336 ; SKIP-CACHE-INV-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4337 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4338 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4339 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4340 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4341 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4342 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4343 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4344 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4345 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4346 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4347 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4348 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4349 ; SKIP-CACHE-INV-NEXT: s_endpgm
4351 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4352 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4353 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4354 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4355 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4356 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4357 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4358 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4359 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4360 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4362 ; GFX90A-TGSPLIT-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4363 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4364 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4365 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4366 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4367 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4368 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4369 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4370 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4371 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4373 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4374 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4375 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4376 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4377 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4378 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4379 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4380 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4381 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4382 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4384 ; GFX940-TGSPLIT-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4385 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4386 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4387 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4388 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4389 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4390 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4391 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4392 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4393 ; GFX940-TGSPLIT-NEXT: s_endpgm
4395 ; GFX11-WGP-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4396 ; GFX11-WGP: ; %bb.0: ; %entry
4397 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4398 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4399 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4400 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4401 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4402 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4403 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4404 ; GFX11-WGP-NEXT: s_nop 0
4405 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4406 ; GFX11-WGP-NEXT: s_endpgm
4408 ; GFX11-CU-LABEL: global_singlethread_release_monotonic_ret_cmpxchg:
4409 ; GFX11-CU: ; %bb.0: ; %entry
4410 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4411 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4412 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4413 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4414 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4415 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4416 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4417 ; GFX11-CU-NEXT: s_nop 0
4418 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4419 ; GFX11-CU-NEXT: s_endpgm
4420 ptr addrspace(1) %out, i32 %in, i32 %old) {
4422 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
4423 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") release monotonic
4424 %val0 = extractvalue { i32, i1 } %val, 0
4425 store i32 %val0, ptr addrspace(1) %out, align 4
4429 define amdgpu_kernel void @global_singlethread_acq_rel_monotonic_ret_cmpxchg(
4430 ; GFX6-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4431 ; GFX6: ; %bb.0: ; %entry
4432 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4433 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4434 ; GFX6-NEXT: s_mov_b32 s6, -1
4435 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4436 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4437 ; GFX6-NEXT: s_mov_b32 s4, s0
4438 ; GFX6-NEXT: s_mov_b32 s5, s1
4439 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4440 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4441 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4442 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4443 ; GFX6-NEXT: s_endpgm
4445 ; GFX7-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4446 ; GFX7: ; %bb.0: ; %entry
4447 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4448 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4449 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4450 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4451 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4452 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4453 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4454 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4455 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4456 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4457 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4458 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4459 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4460 ; GFX7-NEXT: s_endpgm
4462 ; GFX10-WGP-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4463 ; GFX10-WGP: ; %bb.0: ; %entry
4464 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4465 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4466 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4467 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4468 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4469 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4470 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4471 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4472 ; GFX10-WGP-NEXT: s_endpgm
4474 ; GFX10-CU-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4475 ; GFX10-CU: ; %bb.0: ; %entry
4476 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4477 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4478 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4479 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4480 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4481 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4482 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4483 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4484 ; GFX10-CU-NEXT: s_endpgm
4486 ; SKIP-CACHE-INV-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4487 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4488 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4489 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4490 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4491 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4492 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4493 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4494 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4495 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4496 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4497 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4498 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4499 ; SKIP-CACHE-INV-NEXT: s_endpgm
4501 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4502 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4503 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4504 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4505 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4506 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4507 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4508 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4509 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4510 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4512 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4513 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4514 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4515 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4516 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4517 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4518 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4519 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4520 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4521 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4523 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4524 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4525 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4526 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4527 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4528 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4529 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4530 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4531 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4532 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4534 ; GFX940-TGSPLIT-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4535 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4536 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4537 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4538 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4539 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4540 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4541 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4542 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4543 ; GFX940-TGSPLIT-NEXT: s_endpgm
4545 ; GFX11-WGP-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4546 ; GFX11-WGP: ; %bb.0: ; %entry
4547 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4548 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4549 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4550 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4551 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4552 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4553 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4554 ; GFX11-WGP-NEXT: s_nop 0
4555 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4556 ; GFX11-WGP-NEXT: s_endpgm
4558 ; GFX11-CU-LABEL: global_singlethread_acq_rel_monotonic_ret_cmpxchg:
4559 ; GFX11-CU: ; %bb.0: ; %entry
4560 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4561 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4562 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4563 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4564 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4565 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4566 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4567 ; GFX11-CU-NEXT: s_nop 0
4568 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4569 ; GFX11-CU-NEXT: s_endpgm
4570 ptr addrspace(1) %out, i32 %in, i32 %old) {
4572 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
4573 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel monotonic
4574 %val0 = extractvalue { i32, i1 } %val, 0
4575 store i32 %val0, ptr addrspace(1) %out, align 4
4579 define amdgpu_kernel void @global_singlethread_seq_cst_monotonic_ret_cmpxchg(
4580 ; GFX6-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4581 ; GFX6: ; %bb.0: ; %entry
4582 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4583 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4584 ; GFX6-NEXT: s_mov_b32 s6, -1
4585 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4586 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4587 ; GFX6-NEXT: s_mov_b32 s4, s0
4588 ; GFX6-NEXT: s_mov_b32 s5, s1
4589 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4590 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4591 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4592 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4593 ; GFX6-NEXT: s_endpgm
4595 ; GFX7-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4596 ; GFX7: ; %bb.0: ; %entry
4597 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4598 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4599 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4600 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4601 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4602 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4603 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4604 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4605 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4606 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4607 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4608 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4609 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4610 ; GFX7-NEXT: s_endpgm
4612 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4613 ; GFX10-WGP: ; %bb.0: ; %entry
4614 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4615 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4616 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4617 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4618 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4619 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4620 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4621 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4622 ; GFX10-WGP-NEXT: s_endpgm
4624 ; GFX10-CU-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4625 ; GFX10-CU: ; %bb.0: ; %entry
4626 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4627 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4628 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4629 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4630 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4631 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4632 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4633 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4634 ; GFX10-CU-NEXT: s_endpgm
4636 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4637 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4638 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4639 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4640 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4641 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4642 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4643 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4644 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4645 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4646 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4647 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4648 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4649 ; SKIP-CACHE-INV-NEXT: s_endpgm
4651 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4652 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4653 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4654 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4655 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4656 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4657 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4658 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4659 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4660 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4662 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4663 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4664 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4665 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4666 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4667 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4668 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4669 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4670 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4671 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4673 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4674 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4675 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4676 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4677 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4678 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4679 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4680 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4681 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4682 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4684 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4685 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4686 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4687 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4688 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4689 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4690 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4691 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4692 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4693 ; GFX940-TGSPLIT-NEXT: s_endpgm
4695 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4696 ; GFX11-WGP: ; %bb.0: ; %entry
4697 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4698 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4699 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4700 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4701 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4702 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4703 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4704 ; GFX11-WGP-NEXT: s_nop 0
4705 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4706 ; GFX11-WGP-NEXT: s_endpgm
4708 ; GFX11-CU-LABEL: global_singlethread_seq_cst_monotonic_ret_cmpxchg:
4709 ; GFX11-CU: ; %bb.0: ; %entry
4710 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4711 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4712 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4713 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4714 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4715 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4716 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4717 ; GFX11-CU-NEXT: s_nop 0
4718 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4719 ; GFX11-CU-NEXT: s_endpgm
4720 ptr addrspace(1) %out, i32 %in, i32 %old) {
4722 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
4723 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst monotonic
4724 %val0 = extractvalue { i32, i1 } %val, 0
4725 store i32 %val0, ptr addrspace(1) %out, align 4
4729 define amdgpu_kernel void @global_singlethread_monotonic_acquire_ret_cmpxchg(
4730 ; GFX6-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4731 ; GFX6: ; %bb.0: ; %entry
4732 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4733 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4734 ; GFX6-NEXT: s_mov_b32 s6, -1
4735 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4736 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4737 ; GFX6-NEXT: s_mov_b32 s4, s0
4738 ; GFX6-NEXT: s_mov_b32 s5, s1
4739 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4740 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4741 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4742 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4743 ; GFX6-NEXT: s_endpgm
4745 ; GFX7-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4746 ; GFX7: ; %bb.0: ; %entry
4747 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4748 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4749 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4750 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4751 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4752 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4753 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4754 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4755 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4756 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4757 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4758 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4759 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4760 ; GFX7-NEXT: s_endpgm
4762 ; GFX10-WGP-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4763 ; GFX10-WGP: ; %bb.0: ; %entry
4764 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4765 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4766 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4767 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4768 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4769 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4770 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4771 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4772 ; GFX10-WGP-NEXT: s_endpgm
4774 ; GFX10-CU-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4775 ; GFX10-CU: ; %bb.0: ; %entry
4776 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4777 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4778 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4779 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4780 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4781 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4782 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4783 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4784 ; GFX10-CU-NEXT: s_endpgm
4786 ; SKIP-CACHE-INV-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4787 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4788 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4789 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4790 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4791 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4792 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4793 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4794 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4795 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4796 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4797 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4798 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4799 ; SKIP-CACHE-INV-NEXT: s_endpgm
4801 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4802 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4803 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4804 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4805 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4806 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4807 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4808 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4809 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4810 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4812 ; GFX90A-TGSPLIT-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4813 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4814 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4815 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4816 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4817 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4818 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4819 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4820 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4821 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4823 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4824 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4825 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4826 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4827 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4828 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4829 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4830 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4831 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4832 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4834 ; GFX940-TGSPLIT-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4835 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4836 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4837 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4838 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4839 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4840 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4841 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4842 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4843 ; GFX940-TGSPLIT-NEXT: s_endpgm
4845 ; GFX11-WGP-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4846 ; GFX11-WGP: ; %bb.0: ; %entry
4847 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4848 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4849 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4850 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4851 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4852 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4853 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4854 ; GFX11-WGP-NEXT: s_nop 0
4855 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4856 ; GFX11-WGP-NEXT: s_endpgm
4858 ; GFX11-CU-LABEL: global_singlethread_monotonic_acquire_ret_cmpxchg:
4859 ; GFX11-CU: ; %bb.0: ; %entry
4860 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4861 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4862 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4863 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4864 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4865 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4866 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4867 ; GFX11-CU-NEXT: s_nop 0
4868 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4869 ; GFX11-CU-NEXT: s_endpgm
4870 ptr addrspace(1) %out, i32 %in, i32 %old) {
4872 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
4873 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic acquire
4874 %val0 = extractvalue { i32, i1 } %val, 0
4875 store i32 %val0, ptr addrspace(1) %out, align 4
4879 define amdgpu_kernel void @global_singlethread_acquire_acquire_ret_cmpxchg(
4880 ; GFX6-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4881 ; GFX6: ; %bb.0: ; %entry
4882 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4883 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4884 ; GFX6-NEXT: s_mov_b32 s6, -1
4885 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4886 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4887 ; GFX6-NEXT: s_mov_b32 s4, s0
4888 ; GFX6-NEXT: s_mov_b32 s5, s1
4889 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4890 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4891 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4892 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4893 ; GFX6-NEXT: s_endpgm
4895 ; GFX7-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4896 ; GFX7: ; %bb.0: ; %entry
4897 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4898 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4899 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4900 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4901 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4902 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4903 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4904 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4905 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4906 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4907 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4908 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4909 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4910 ; GFX7-NEXT: s_endpgm
4912 ; GFX10-WGP-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4913 ; GFX10-WGP: ; %bb.0: ; %entry
4914 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4915 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4916 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4917 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4918 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4919 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4920 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4921 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4922 ; GFX10-WGP-NEXT: s_endpgm
4924 ; GFX10-CU-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4925 ; GFX10-CU: ; %bb.0: ; %entry
4926 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4927 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4928 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4929 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4930 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4931 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4932 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4933 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4934 ; GFX10-CU-NEXT: s_endpgm
4936 ; SKIP-CACHE-INV-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4937 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4938 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4939 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4940 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4941 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4942 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4943 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4944 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4945 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4946 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4947 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4948 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4949 ; SKIP-CACHE-INV-NEXT: s_endpgm
4951 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4952 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4953 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4954 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4955 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4956 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4957 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4958 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4959 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4960 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4962 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4963 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4964 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4965 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4966 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4967 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4968 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4969 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4970 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4971 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4973 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4974 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4975 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4976 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4977 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4978 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4979 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4980 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4981 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4982 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4984 ; GFX940-TGSPLIT-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4985 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4986 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4987 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4988 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4989 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4990 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
4991 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4992 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
4993 ; GFX940-TGSPLIT-NEXT: s_endpgm
4995 ; GFX11-WGP-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
4996 ; GFX11-WGP: ; %bb.0: ; %entry
4997 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4998 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4999 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5000 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5001 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5002 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5003 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5004 ; GFX11-WGP-NEXT: s_nop 0
5005 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5006 ; GFX11-WGP-NEXT: s_endpgm
5008 ; GFX11-CU-LABEL: global_singlethread_acquire_acquire_ret_cmpxchg:
5009 ; GFX11-CU: ; %bb.0: ; %entry
5010 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5011 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5012 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5013 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5014 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5015 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5016 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5017 ; GFX11-CU-NEXT: s_nop 0
5018 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5019 ; GFX11-CU-NEXT: s_endpgm
5020 ptr addrspace(1) %out, i32 %in, i32 %old) {
5022 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5023 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acquire acquire
5024 %val0 = extractvalue { i32, i1 } %val, 0
5025 store i32 %val0, ptr addrspace(1) %out, align 4
5029 define amdgpu_kernel void @global_singlethread_release_acquire_ret_cmpxchg(
5030 ; GFX6-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5031 ; GFX6: ; %bb.0: ; %entry
5032 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5033 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5034 ; GFX6-NEXT: s_mov_b32 s6, -1
5035 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5036 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5037 ; GFX6-NEXT: s_mov_b32 s4, s0
5038 ; GFX6-NEXT: s_mov_b32 s5, s1
5039 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5040 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5041 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5042 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5043 ; GFX6-NEXT: s_endpgm
5045 ; GFX7-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5046 ; GFX7: ; %bb.0: ; %entry
5047 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5048 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5049 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5050 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5051 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5052 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5053 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5054 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5055 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5056 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5057 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5058 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5059 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5060 ; GFX7-NEXT: s_endpgm
5062 ; GFX10-WGP-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5063 ; GFX10-WGP: ; %bb.0: ; %entry
5064 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5065 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5066 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5067 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5068 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5069 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5070 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5071 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5072 ; GFX10-WGP-NEXT: s_endpgm
5074 ; GFX10-CU-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5075 ; GFX10-CU: ; %bb.0: ; %entry
5076 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5077 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5078 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5079 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5080 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5081 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5082 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5083 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5084 ; GFX10-CU-NEXT: s_endpgm
5086 ; SKIP-CACHE-INV-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5087 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5088 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5089 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5090 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5091 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5092 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5093 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5094 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5095 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5096 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5097 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5098 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5099 ; SKIP-CACHE-INV-NEXT: s_endpgm
5101 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5102 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5103 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5104 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5105 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5106 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5107 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5108 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5109 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5110 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5112 ; GFX90A-TGSPLIT-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5113 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5114 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5115 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5116 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5117 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5118 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5119 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5120 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5121 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5123 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5124 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5125 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5126 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5127 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5128 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5129 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5130 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5131 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5132 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5134 ; GFX940-TGSPLIT-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5135 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5136 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5137 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5138 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5139 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5140 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5141 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5142 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5143 ; GFX940-TGSPLIT-NEXT: s_endpgm
5145 ; GFX11-WGP-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5146 ; GFX11-WGP: ; %bb.0: ; %entry
5147 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5148 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5149 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5150 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5151 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5152 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5153 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5154 ; GFX11-WGP-NEXT: s_nop 0
5155 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5156 ; GFX11-WGP-NEXT: s_endpgm
5158 ; GFX11-CU-LABEL: global_singlethread_release_acquire_ret_cmpxchg:
5159 ; GFX11-CU: ; %bb.0: ; %entry
5160 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5161 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5162 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5163 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5164 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5165 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5166 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5167 ; GFX11-CU-NEXT: s_nop 0
5168 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5169 ; GFX11-CU-NEXT: s_endpgm
5170 ptr addrspace(1) %out, i32 %in, i32 %old) {
5172 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5173 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") release acquire
5174 %val0 = extractvalue { i32, i1 } %val, 0
5175 store i32 %val0, ptr addrspace(1) %out, align 4
5179 define amdgpu_kernel void @global_singlethread_acq_rel_acquire_ret_cmpxchg(
5180 ; GFX6-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5181 ; GFX6: ; %bb.0: ; %entry
5182 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5183 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5184 ; GFX6-NEXT: s_mov_b32 s6, -1
5185 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5186 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5187 ; GFX6-NEXT: s_mov_b32 s4, s0
5188 ; GFX6-NEXT: s_mov_b32 s5, s1
5189 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5190 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5191 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5192 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5193 ; GFX6-NEXT: s_endpgm
5195 ; GFX7-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5196 ; GFX7: ; %bb.0: ; %entry
5197 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5198 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5199 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5200 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5201 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5202 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5203 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5204 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5205 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5206 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5207 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5208 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5209 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5210 ; GFX7-NEXT: s_endpgm
5212 ; GFX10-WGP-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5213 ; GFX10-WGP: ; %bb.0: ; %entry
5214 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5215 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5216 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5217 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5218 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5219 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5220 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5221 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5222 ; GFX10-WGP-NEXT: s_endpgm
5224 ; GFX10-CU-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5225 ; GFX10-CU: ; %bb.0: ; %entry
5226 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5227 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5228 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5229 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5230 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5231 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5232 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5233 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5234 ; GFX10-CU-NEXT: s_endpgm
5236 ; SKIP-CACHE-INV-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5237 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5238 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5239 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5240 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5241 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5242 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5243 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5244 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5245 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5246 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5247 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5248 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5249 ; SKIP-CACHE-INV-NEXT: s_endpgm
5251 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5252 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5253 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5254 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5255 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5256 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5257 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5258 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5259 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5260 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5262 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5263 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5264 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5265 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5266 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5267 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5268 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5269 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5270 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5271 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5273 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5274 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5275 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5276 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5277 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5278 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5279 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5280 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5281 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5282 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5284 ; GFX940-TGSPLIT-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5285 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5286 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5287 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5288 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5289 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5290 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5291 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5292 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5293 ; GFX940-TGSPLIT-NEXT: s_endpgm
5295 ; GFX11-WGP-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5296 ; GFX11-WGP: ; %bb.0: ; %entry
5297 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5298 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5299 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5300 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5301 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5302 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5303 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5304 ; GFX11-WGP-NEXT: s_nop 0
5305 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5306 ; GFX11-WGP-NEXT: s_endpgm
5308 ; GFX11-CU-LABEL: global_singlethread_acq_rel_acquire_ret_cmpxchg:
5309 ; GFX11-CU: ; %bb.0: ; %entry
5310 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5311 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5312 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5313 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5314 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5315 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5316 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5317 ; GFX11-CU-NEXT: s_nop 0
5318 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5319 ; GFX11-CU-NEXT: s_endpgm
5320 ptr addrspace(1) %out, i32 %in, i32 %old) {
5322 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5323 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel acquire
5324 %val0 = extractvalue { i32, i1 } %val, 0
5325 store i32 %val0, ptr addrspace(1) %out, align 4
5329 define amdgpu_kernel void @global_singlethread_seq_cst_acquire_ret_cmpxchg(
5330 ; GFX6-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5331 ; GFX6: ; %bb.0: ; %entry
5332 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5333 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5334 ; GFX6-NEXT: s_mov_b32 s6, -1
5335 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5336 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5337 ; GFX6-NEXT: s_mov_b32 s4, s0
5338 ; GFX6-NEXT: s_mov_b32 s5, s1
5339 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5340 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5341 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5342 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5343 ; GFX6-NEXT: s_endpgm
5345 ; GFX7-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5346 ; GFX7: ; %bb.0: ; %entry
5347 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5348 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5349 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5350 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5351 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5352 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5353 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5354 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5355 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5356 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5357 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5358 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5359 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5360 ; GFX7-NEXT: s_endpgm
5362 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_acquire_ret_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: v_mov_b32_e32 v2, 0
5366 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5367 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5368 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5369 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5370 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5371 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5372 ; GFX10-WGP-NEXT: s_endpgm
5374 ; GFX10-CU-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5375 ; GFX10-CU: ; %bb.0: ; %entry
5376 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5377 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5378 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5379 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5380 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5381 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5382 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5383 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5384 ; GFX10-CU-NEXT: s_endpgm
5386 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5387 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5388 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5389 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5390 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5391 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5392 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5393 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5394 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5395 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5396 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5397 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5398 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5399 ; SKIP-CACHE-INV-NEXT: s_endpgm
5401 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5402 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5403 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5404 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5405 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5406 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5407 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5408 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5409 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5410 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5412 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5413 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5414 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5415 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5416 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5417 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5418 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5419 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5420 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5421 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5423 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5424 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5425 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5426 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5427 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5428 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5429 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5430 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5431 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5432 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5434 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5435 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5436 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5437 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5438 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5439 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5440 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5441 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5442 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5443 ; GFX940-TGSPLIT-NEXT: s_endpgm
5445 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5446 ; GFX11-WGP: ; %bb.0: ; %entry
5447 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5448 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5449 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5450 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5451 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5452 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5453 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5454 ; GFX11-WGP-NEXT: s_nop 0
5455 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5456 ; GFX11-WGP-NEXT: s_endpgm
5458 ; GFX11-CU-LABEL: global_singlethread_seq_cst_acquire_ret_cmpxchg:
5459 ; GFX11-CU: ; %bb.0: ; %entry
5460 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5461 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5462 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5463 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5464 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5465 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5466 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5467 ; GFX11-CU-NEXT: s_nop 0
5468 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5469 ; GFX11-CU-NEXT: s_endpgm
5470 ptr addrspace(1) %out, i32 %in, i32 %old) {
5472 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5473 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst acquire
5474 %val0 = extractvalue { i32, i1 } %val, 0
5475 store i32 %val0, ptr addrspace(1) %out, align 4
5479 define amdgpu_kernel void @global_singlethread_monotonic_seq_cst_ret_cmpxchg(
5480 ; GFX6-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5481 ; GFX6: ; %bb.0: ; %entry
5482 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5483 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5484 ; GFX6-NEXT: s_mov_b32 s6, -1
5485 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5486 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5487 ; GFX6-NEXT: s_mov_b32 s4, s0
5488 ; GFX6-NEXT: s_mov_b32 s5, s1
5489 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5490 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5491 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5492 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5493 ; GFX6-NEXT: s_endpgm
5495 ; GFX7-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5496 ; GFX7: ; %bb.0: ; %entry
5497 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5498 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5499 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5500 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5501 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5502 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5503 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5504 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5505 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5506 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5507 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5508 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5509 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5510 ; GFX7-NEXT: s_endpgm
5512 ; GFX10-WGP-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5513 ; GFX10-WGP: ; %bb.0: ; %entry
5514 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5515 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5516 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5517 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5518 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5519 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5520 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5521 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5522 ; GFX10-WGP-NEXT: s_endpgm
5524 ; GFX10-CU-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5525 ; GFX10-CU: ; %bb.0: ; %entry
5526 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5527 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5528 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5529 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5530 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5531 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5532 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5533 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5534 ; GFX10-CU-NEXT: s_endpgm
5536 ; SKIP-CACHE-INV-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5537 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5538 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5539 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5540 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5541 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5542 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5543 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5544 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5545 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5546 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5547 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5548 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5549 ; SKIP-CACHE-INV-NEXT: s_endpgm
5551 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5552 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5553 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5554 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5555 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5556 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5557 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5558 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5559 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5560 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5562 ; GFX90A-TGSPLIT-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5563 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5564 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5565 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5566 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5567 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5568 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5569 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5570 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5571 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5573 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5574 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5575 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5576 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5577 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5578 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5579 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5580 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5581 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5582 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5584 ; GFX940-TGSPLIT-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5585 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5586 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5587 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5588 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5589 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5590 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5591 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5592 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5593 ; GFX940-TGSPLIT-NEXT: s_endpgm
5595 ; GFX11-WGP-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5596 ; GFX11-WGP: ; %bb.0: ; %entry
5597 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5598 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5599 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5600 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5601 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5602 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5603 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5604 ; GFX11-WGP-NEXT: s_nop 0
5605 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5606 ; GFX11-WGP-NEXT: s_endpgm
5608 ; GFX11-CU-LABEL: global_singlethread_monotonic_seq_cst_ret_cmpxchg:
5609 ; GFX11-CU: ; %bb.0: ; %entry
5610 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5611 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5612 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5613 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5614 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5615 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5616 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5617 ; GFX11-CU-NEXT: s_nop 0
5618 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5619 ; GFX11-CU-NEXT: s_endpgm
5620 ptr addrspace(1) %out, i32 %in, i32 %old) {
5622 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5623 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic seq_cst
5624 %val0 = extractvalue { i32, i1 } %val, 0
5625 store i32 %val0, ptr addrspace(1) %out, align 4
5629 define amdgpu_kernel void @global_singlethread_acquire_seq_cst_ret_cmpxchg(
5630 ; GFX6-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5631 ; GFX6: ; %bb.0: ; %entry
5632 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5633 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5634 ; GFX6-NEXT: s_mov_b32 s6, -1
5635 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5636 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5637 ; GFX6-NEXT: s_mov_b32 s4, s0
5638 ; GFX6-NEXT: s_mov_b32 s5, s1
5639 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5640 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5641 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5642 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5643 ; GFX6-NEXT: s_endpgm
5645 ; GFX7-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5646 ; GFX7: ; %bb.0: ; %entry
5647 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5648 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5649 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5650 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5651 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5652 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5653 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5654 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5655 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5656 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5657 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5658 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5659 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5660 ; GFX7-NEXT: s_endpgm
5662 ; GFX10-WGP-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5663 ; GFX10-WGP: ; %bb.0: ; %entry
5664 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5665 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5666 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5667 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5668 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5669 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5670 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5671 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5672 ; GFX10-WGP-NEXT: s_endpgm
5674 ; GFX10-CU-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5675 ; GFX10-CU: ; %bb.0: ; %entry
5676 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5677 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5678 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5679 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5680 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5681 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5682 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5683 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5684 ; GFX10-CU-NEXT: s_endpgm
5686 ; SKIP-CACHE-INV-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5687 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5688 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5689 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5690 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5691 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5692 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5693 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5694 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5695 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5696 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5697 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5698 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5699 ; SKIP-CACHE-INV-NEXT: s_endpgm
5701 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5702 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5703 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5704 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5705 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5706 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5707 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5708 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5709 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5710 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5712 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5713 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5714 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5715 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5716 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5717 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5718 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5719 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5720 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5721 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5723 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5724 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5725 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5726 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5727 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5728 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5729 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5730 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5731 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5732 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5734 ; GFX940-TGSPLIT-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5735 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5736 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5737 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5738 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5739 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5740 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5741 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5742 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5743 ; GFX940-TGSPLIT-NEXT: s_endpgm
5745 ; GFX11-WGP-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5746 ; GFX11-WGP: ; %bb.0: ; %entry
5747 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5748 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5749 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5750 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5751 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5752 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5753 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5754 ; GFX11-WGP-NEXT: s_nop 0
5755 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5756 ; GFX11-WGP-NEXT: s_endpgm
5758 ; GFX11-CU-LABEL: global_singlethread_acquire_seq_cst_ret_cmpxchg:
5759 ; GFX11-CU: ; %bb.0: ; %entry
5760 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5761 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5762 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5763 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5764 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5765 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5766 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5767 ; GFX11-CU-NEXT: s_nop 0
5768 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5769 ; GFX11-CU-NEXT: s_endpgm
5770 ptr addrspace(1) %out, i32 %in, i32 %old) {
5772 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5773 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acquire seq_cst
5774 %val0 = extractvalue { i32, i1 } %val, 0
5775 store i32 %val0, ptr addrspace(1) %out, align 4
5779 define amdgpu_kernel void @global_singlethread_release_seq_cst_ret_cmpxchg(
5780 ; GFX6-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5781 ; GFX6: ; %bb.0: ; %entry
5782 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5783 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5784 ; GFX6-NEXT: s_mov_b32 s6, -1
5785 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5786 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5787 ; GFX6-NEXT: s_mov_b32 s4, s0
5788 ; GFX6-NEXT: s_mov_b32 s5, s1
5789 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5790 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5791 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5792 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5793 ; GFX6-NEXT: s_endpgm
5795 ; GFX7-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5796 ; GFX7: ; %bb.0: ; %entry
5797 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5798 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5799 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5800 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5801 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5802 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5803 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5804 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5805 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5806 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5807 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5808 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5809 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5810 ; GFX7-NEXT: s_endpgm
5812 ; GFX10-WGP-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5813 ; GFX10-WGP: ; %bb.0: ; %entry
5814 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5815 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5816 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5817 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5818 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5819 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5820 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5821 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5822 ; GFX10-WGP-NEXT: s_endpgm
5824 ; GFX10-CU-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5825 ; GFX10-CU: ; %bb.0: ; %entry
5826 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5827 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5828 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5829 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5830 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5831 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5832 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5833 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5834 ; GFX10-CU-NEXT: s_endpgm
5836 ; SKIP-CACHE-INV-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5837 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5838 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5839 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5840 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5841 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5842 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5843 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5844 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5845 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5846 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5847 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5848 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5849 ; SKIP-CACHE-INV-NEXT: s_endpgm
5851 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5852 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5853 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5854 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5855 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5856 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5857 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5858 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5859 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5860 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5862 ; GFX90A-TGSPLIT-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5863 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5864 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5865 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5866 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5867 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5868 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5869 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5870 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5871 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5873 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5874 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5875 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5876 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5877 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5878 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5879 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5880 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5881 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5882 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5884 ; GFX940-TGSPLIT-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5885 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5886 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5887 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5888 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5889 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5890 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
5891 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5892 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
5893 ; GFX940-TGSPLIT-NEXT: s_endpgm
5895 ; GFX11-WGP-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5896 ; GFX11-WGP: ; %bb.0: ; %entry
5897 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5898 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5899 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5900 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5901 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5902 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5903 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5904 ; GFX11-WGP-NEXT: s_nop 0
5905 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5906 ; GFX11-WGP-NEXT: s_endpgm
5908 ; GFX11-CU-LABEL: global_singlethread_release_seq_cst_ret_cmpxchg:
5909 ; GFX11-CU: ; %bb.0: ; %entry
5910 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5911 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5912 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5913 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5914 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5915 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5916 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5917 ; GFX11-CU-NEXT: s_nop 0
5918 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5919 ; GFX11-CU-NEXT: s_endpgm
5920 ptr addrspace(1) %out, i32 %in, i32 %old) {
5922 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
5923 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") release seq_cst
5924 %val0 = extractvalue { i32, i1 } %val, 0
5925 store i32 %val0, ptr addrspace(1) %out, align 4
5929 define amdgpu_kernel void @global_singlethread_acq_rel_seq_cst_ret_cmpxchg(
5930 ; GFX6-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
5931 ; GFX6: ; %bb.0: ; %entry
5932 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5933 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5934 ; GFX6-NEXT: s_mov_b32 s6, -1
5935 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5936 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5937 ; GFX6-NEXT: s_mov_b32 s4, s0
5938 ; GFX6-NEXT: s_mov_b32 s5, s1
5939 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5940 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5941 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5942 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5943 ; GFX6-NEXT: s_endpgm
5945 ; GFX7-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
5946 ; GFX7: ; %bb.0: ; %entry
5947 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5948 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5949 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5950 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5951 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5952 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5953 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5954 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5955 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5956 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5957 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5958 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5959 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5960 ; GFX7-NEXT: s_endpgm
5962 ; GFX10-WGP-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
5963 ; GFX10-WGP: ; %bb.0: ; %entry
5964 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5965 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5966 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5967 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5968 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5969 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5970 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5971 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5972 ; GFX10-WGP-NEXT: s_endpgm
5974 ; GFX10-CU-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
5975 ; GFX10-CU: ; %bb.0: ; %entry
5976 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5977 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5978 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5979 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5980 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5981 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5982 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5983 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5984 ; GFX10-CU-NEXT: s_endpgm
5986 ; SKIP-CACHE-INV-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
5987 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5988 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5989 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5990 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5991 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5992 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5993 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5994 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5995 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5996 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5997 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5998 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5999 ; SKIP-CACHE-INV-NEXT: s_endpgm
6001 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
6002 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6003 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6004 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6005 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6006 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6007 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6008 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6009 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6010 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6012 ; GFX90A-TGSPLIT-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
6013 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6014 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6015 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6016 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6017 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6018 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6019 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6020 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6021 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6023 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
6024 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6025 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6026 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6027 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6028 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6029 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
6030 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6031 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
6032 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6034 ; GFX940-TGSPLIT-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
6035 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6036 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6037 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6038 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6039 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6040 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
6041 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6042 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
6043 ; GFX940-TGSPLIT-NEXT: s_endpgm
6045 ; GFX11-WGP-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
6046 ; GFX11-WGP: ; %bb.0: ; %entry
6047 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6048 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
6049 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6050 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6051 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6052 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6053 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
6054 ; GFX11-WGP-NEXT: s_nop 0
6055 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6056 ; GFX11-WGP-NEXT: s_endpgm
6058 ; GFX11-CU-LABEL: global_singlethread_acq_rel_seq_cst_ret_cmpxchg:
6059 ; GFX11-CU: ; %bb.0: ; %entry
6060 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6061 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
6062 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6063 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6064 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6065 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6066 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
6067 ; GFX11-CU-NEXT: s_nop 0
6068 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6069 ; GFX11-CU-NEXT: s_endpgm
6070 ptr addrspace(1) %out, i32 %in, i32 %old) {
6072 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
6073 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel seq_cst
6074 %val0 = extractvalue { i32, i1 } %val, 0
6075 store i32 %val0, ptr addrspace(1) %out, align 4
6079 define amdgpu_kernel void @global_singlethread_seq_cst_seq_cst_ret_cmpxchg(
6080 ; GFX6-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6081 ; GFX6: ; %bb.0: ; %entry
6082 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6083 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6084 ; GFX6-NEXT: s_mov_b32 s6, -1
6085 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6086 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6087 ; GFX6-NEXT: s_mov_b32 s4, s0
6088 ; GFX6-NEXT: s_mov_b32 s5, s1
6089 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
6090 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6091 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6092 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6093 ; GFX6-NEXT: s_endpgm
6095 ; GFX7-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6096 ; GFX7: ; %bb.0: ; %entry
6097 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6098 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6099 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6100 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6101 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6102 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6103 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6104 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6105 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6106 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6107 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6108 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6109 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6110 ; GFX7-NEXT: s_endpgm
6112 ; GFX10-WGP-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6113 ; GFX10-WGP: ; %bb.0: ; %entry
6114 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6115 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
6116 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6117 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
6118 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
6119 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6120 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6121 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
6122 ; GFX10-WGP-NEXT: s_endpgm
6124 ; GFX10-CU-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6125 ; GFX10-CU: ; %bb.0: ; %entry
6126 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6127 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
6128 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6129 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
6130 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
6131 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6132 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6133 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
6134 ; GFX10-CU-NEXT: s_endpgm
6136 ; SKIP-CACHE-INV-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6137 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6138 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6139 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6140 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6141 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6142 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6143 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6144 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6145 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
6146 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6147 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6148 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6149 ; SKIP-CACHE-INV-NEXT: s_endpgm
6151 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6152 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6153 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6154 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6155 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6156 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6157 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6158 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6159 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6160 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6162 ; GFX90A-TGSPLIT-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6163 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6164 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6165 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6166 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6167 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6168 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6169 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6170 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6171 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6173 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6174 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6175 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6176 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6177 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6178 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6179 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
6180 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6181 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
6182 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6184 ; GFX940-TGSPLIT-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6185 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6186 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6187 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6188 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6189 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6190 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
6191 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6192 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
6193 ; GFX940-TGSPLIT-NEXT: s_endpgm
6195 ; GFX11-WGP-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6196 ; GFX11-WGP: ; %bb.0: ; %entry
6197 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6198 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
6199 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6200 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6201 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6202 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6203 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
6204 ; GFX11-WGP-NEXT: s_nop 0
6205 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6206 ; GFX11-WGP-NEXT: s_endpgm
6208 ; GFX11-CU-LABEL: global_singlethread_seq_cst_seq_cst_ret_cmpxchg:
6209 ; GFX11-CU: ; %bb.0: ; %entry
6210 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6211 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
6212 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6213 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6214 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6215 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6216 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
6217 ; GFX11-CU-NEXT: s_nop 0
6218 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6219 ; GFX11-CU-NEXT: s_endpgm
6220 ptr addrspace(1) %out, i32 %in, i32 %old) {
6222 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
6223 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst seq_cst
6224 %val0 = extractvalue { i32, i1 } %val, 0
6225 store i32 %val0, ptr addrspace(1) %out, align 4
6229 define amdgpu_kernel void @global_singlethread_one_as_unordered_load(
6230 ; GFX6-LABEL: global_singlethread_one_as_unordered_load:
6231 ; GFX6: ; %bb.0: ; %entry
6232 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6233 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6234 ; GFX6-NEXT: s_mov_b32 s6, -1
6235 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6236 ; GFX6-NEXT: s_mov_b32 s4, s0
6237 ; GFX6-NEXT: s_mov_b32 s5, s1
6238 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0
6239 ; GFX6-NEXT: s_mov_b32 s4, s2
6240 ; GFX6-NEXT: s_mov_b32 s5, s3
6241 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6242 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6243 ; GFX6-NEXT: s_endpgm
6245 ; GFX7-LABEL: global_singlethread_one_as_unordered_load:
6246 ; GFX7: ; %bb.0: ; %entry
6247 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6248 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6249 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6250 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6251 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
6252 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
6253 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
6254 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6255 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6256 ; GFX7-NEXT: s_endpgm
6258 ; GFX10-WGP-LABEL: global_singlethread_one_as_unordered_load:
6259 ; GFX10-WGP: ; %bb.0: ; %entry
6260 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6261 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6262 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6263 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1]
6264 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6265 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
6266 ; GFX10-WGP-NEXT: s_endpgm
6268 ; GFX10-CU-LABEL: global_singlethread_one_as_unordered_load:
6269 ; GFX10-CU: ; %bb.0: ; %entry
6270 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6271 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6272 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6273 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1]
6274 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6275 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
6276 ; GFX10-CU-NEXT: s_endpgm
6278 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_unordered_load:
6279 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6280 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6281 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6282 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6283 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6284 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6285 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6286 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
6287 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
6288 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
6289 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6290 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6291 ; SKIP-CACHE-INV-NEXT: s_endpgm
6293 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_unordered_load:
6294 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6295 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6296 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6297 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6298 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6299 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6300 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6301 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6303 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_unordered_load:
6304 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6305 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6306 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6307 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6308 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6309 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6310 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6311 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6313 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_unordered_load:
6314 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6315 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6316 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6317 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6318 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6319 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6320 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6321 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6323 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_unordered_load:
6324 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6325 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6326 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6327 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6328 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6329 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6330 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6331 ; GFX940-TGSPLIT-NEXT: s_endpgm
6333 ; GFX11-WGP-LABEL: global_singlethread_one_as_unordered_load:
6334 ; GFX11-WGP: ; %bb.0: ; %entry
6335 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6336 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6337 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6338 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1]
6339 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6340 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
6341 ; GFX11-WGP-NEXT: s_nop 0
6342 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6343 ; GFX11-WGP-NEXT: s_endpgm
6345 ; GFX11-CU-LABEL: global_singlethread_one_as_unordered_load:
6346 ; GFX11-CU: ; %bb.0: ; %entry
6347 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6348 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6349 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6350 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
6351 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6352 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
6353 ; GFX11-CU-NEXT: s_nop 0
6354 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6355 ; GFX11-CU-NEXT: s_endpgm
6356 ptr addrspace(1) %in, ptr addrspace(1) %out) {
6358 %val = load atomic i32, ptr addrspace(1) %in syncscope("singlethread-one-as") unordered, align 4
6359 store i32 %val, ptr addrspace(1) %out
6363 define amdgpu_kernel void @global_singlethread_one_as_monotonic_load(
6364 ; GFX6-LABEL: global_singlethread_one_as_monotonic_load:
6365 ; GFX6: ; %bb.0: ; %entry
6366 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6367 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6368 ; GFX6-NEXT: s_mov_b32 s6, -1
6369 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6370 ; GFX6-NEXT: s_mov_b32 s4, s0
6371 ; GFX6-NEXT: s_mov_b32 s5, s1
6372 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0
6373 ; GFX6-NEXT: s_mov_b32 s4, s2
6374 ; GFX6-NEXT: s_mov_b32 s5, s3
6375 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6376 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6377 ; GFX6-NEXT: s_endpgm
6379 ; GFX7-LABEL: global_singlethread_one_as_monotonic_load:
6380 ; GFX7: ; %bb.0: ; %entry
6381 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6382 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6383 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6384 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6385 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
6386 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
6387 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
6388 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6389 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6390 ; GFX7-NEXT: s_endpgm
6392 ; GFX10-WGP-LABEL: global_singlethread_one_as_monotonic_load:
6393 ; GFX10-WGP: ; %bb.0: ; %entry
6394 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6395 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6396 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6397 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1]
6398 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6399 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
6400 ; GFX10-WGP-NEXT: s_endpgm
6402 ; GFX10-CU-LABEL: global_singlethread_one_as_monotonic_load:
6403 ; GFX10-CU: ; %bb.0: ; %entry
6404 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6405 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6406 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6407 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1]
6408 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6409 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
6410 ; GFX10-CU-NEXT: s_endpgm
6412 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_monotonic_load:
6413 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6414 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6415 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6416 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6417 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6418 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6419 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6420 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
6421 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
6422 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
6423 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6424 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6425 ; SKIP-CACHE-INV-NEXT: s_endpgm
6427 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_load:
6428 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6429 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6430 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6431 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6432 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6433 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6434 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6435 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6437 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_load:
6438 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6439 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6440 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6441 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6442 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6443 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6444 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6445 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6447 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_load:
6448 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6449 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6450 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6451 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6452 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6453 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6454 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6455 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6457 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_load:
6458 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6459 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6460 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6461 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6462 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6463 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6464 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6465 ; GFX940-TGSPLIT-NEXT: s_endpgm
6467 ; GFX11-WGP-LABEL: global_singlethread_one_as_monotonic_load:
6468 ; GFX11-WGP: ; %bb.0: ; %entry
6469 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6470 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6471 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6472 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1]
6473 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6474 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
6475 ; GFX11-WGP-NEXT: s_nop 0
6476 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6477 ; GFX11-WGP-NEXT: s_endpgm
6479 ; GFX11-CU-LABEL: global_singlethread_one_as_monotonic_load:
6480 ; GFX11-CU: ; %bb.0: ; %entry
6481 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6482 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6483 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6484 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
6485 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6486 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
6487 ; GFX11-CU-NEXT: s_nop 0
6488 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6489 ; GFX11-CU-NEXT: s_endpgm
6490 ptr addrspace(1) %in, ptr addrspace(1) %out) {
6492 %val = load atomic i32, ptr addrspace(1) %in syncscope("singlethread-one-as") monotonic, align 4
6493 store i32 %val, ptr addrspace(1) %out
6497 define amdgpu_kernel void @global_singlethread_one_as_acquire_load(
6498 ; GFX6-LABEL: global_singlethread_one_as_acquire_load:
6499 ; GFX6: ; %bb.0: ; %entry
6500 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6501 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6502 ; GFX6-NEXT: s_mov_b32 s6, -1
6503 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6504 ; GFX6-NEXT: s_mov_b32 s4, s0
6505 ; GFX6-NEXT: s_mov_b32 s5, s1
6506 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0
6507 ; GFX6-NEXT: s_mov_b32 s4, s2
6508 ; GFX6-NEXT: s_mov_b32 s5, s3
6509 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6510 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6511 ; GFX6-NEXT: s_endpgm
6513 ; GFX7-LABEL: global_singlethread_one_as_acquire_load:
6514 ; GFX7: ; %bb.0: ; %entry
6515 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6516 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6517 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6518 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6519 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
6520 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
6521 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
6522 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6523 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6524 ; GFX7-NEXT: s_endpgm
6526 ; GFX10-WGP-LABEL: global_singlethread_one_as_acquire_load:
6527 ; GFX10-WGP: ; %bb.0: ; %entry
6528 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6529 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6530 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6531 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1]
6532 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6533 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
6534 ; GFX10-WGP-NEXT: s_endpgm
6536 ; GFX10-CU-LABEL: global_singlethread_one_as_acquire_load:
6537 ; GFX10-CU: ; %bb.0: ; %entry
6538 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6539 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6540 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6541 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1]
6542 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6543 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
6544 ; GFX10-CU-NEXT: s_endpgm
6546 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acquire_load:
6547 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6548 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6549 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6550 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6551 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6552 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6553 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6554 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
6555 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
6556 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
6557 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6558 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6559 ; SKIP-CACHE-INV-NEXT: s_endpgm
6561 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_load:
6562 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6563 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6564 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6565 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6566 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6567 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6568 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6569 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6571 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acquire_load:
6572 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6573 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6574 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6575 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6576 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6577 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6578 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6579 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6581 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_load:
6582 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6583 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6584 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6585 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6586 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6587 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6588 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6589 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6591 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acquire_load:
6592 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6593 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6594 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6595 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6596 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6597 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6598 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6599 ; GFX940-TGSPLIT-NEXT: s_endpgm
6601 ; GFX11-WGP-LABEL: global_singlethread_one_as_acquire_load:
6602 ; GFX11-WGP: ; %bb.0: ; %entry
6603 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6604 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6605 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6606 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1]
6607 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6608 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
6609 ; GFX11-WGP-NEXT: s_nop 0
6610 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6611 ; GFX11-WGP-NEXT: s_endpgm
6613 ; GFX11-CU-LABEL: global_singlethread_one_as_acquire_load:
6614 ; GFX11-CU: ; %bb.0: ; %entry
6615 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6616 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6617 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6618 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
6619 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6620 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
6621 ; GFX11-CU-NEXT: s_nop 0
6622 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6623 ; GFX11-CU-NEXT: s_endpgm
6624 ptr addrspace(1) %in, ptr addrspace(1) %out) {
6626 %val = load atomic i32, ptr addrspace(1) %in syncscope("singlethread-one-as") acquire, align 4
6627 store i32 %val, ptr addrspace(1) %out
6631 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_load(
6632 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_load:
6633 ; GFX6: ; %bb.0: ; %entry
6634 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6635 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6636 ; GFX6-NEXT: s_mov_b32 s6, -1
6637 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6638 ; GFX6-NEXT: s_mov_b32 s4, s0
6639 ; GFX6-NEXT: s_mov_b32 s5, s1
6640 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0
6641 ; GFX6-NEXT: s_mov_b32 s4, s2
6642 ; GFX6-NEXT: s_mov_b32 s5, s3
6643 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6644 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6645 ; GFX6-NEXT: s_endpgm
6647 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_load:
6648 ; GFX7: ; %bb.0: ; %entry
6649 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6650 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6651 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6652 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6653 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
6654 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
6655 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
6656 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6657 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6658 ; GFX7-NEXT: s_endpgm
6660 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_load:
6661 ; GFX10-WGP: ; %bb.0: ; %entry
6662 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6663 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6664 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6665 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1]
6666 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6667 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
6668 ; GFX10-WGP-NEXT: s_endpgm
6670 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_load:
6671 ; GFX10-CU: ; %bb.0: ; %entry
6672 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6673 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6674 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6675 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1]
6676 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6677 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
6678 ; GFX10-CU-NEXT: s_endpgm
6680 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_load:
6681 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6682 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6683 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6684 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6685 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6686 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6687 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6688 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
6689 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
6690 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
6691 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6692 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6693 ; SKIP-CACHE-INV-NEXT: s_endpgm
6695 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_load:
6696 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6697 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6698 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6699 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6700 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6701 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6702 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6703 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6705 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_load:
6706 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6707 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6708 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6709 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6710 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6711 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6712 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6713 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6715 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_load:
6716 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6717 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6718 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6719 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6720 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6721 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6722 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6723 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6725 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_load:
6726 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6727 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6728 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6729 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6730 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6731 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6732 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6733 ; GFX940-TGSPLIT-NEXT: s_endpgm
6735 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_load:
6736 ; GFX11-WGP: ; %bb.0: ; %entry
6737 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6738 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6739 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6740 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1]
6741 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6742 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
6743 ; GFX11-WGP-NEXT: s_nop 0
6744 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6745 ; GFX11-WGP-NEXT: s_endpgm
6747 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_load:
6748 ; GFX11-CU: ; %bb.0: ; %entry
6749 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6750 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6751 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6752 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
6753 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6754 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
6755 ; GFX11-CU-NEXT: s_nop 0
6756 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6757 ; GFX11-CU-NEXT: s_endpgm
6758 ptr addrspace(1) %in, ptr addrspace(1) %out) {
6760 %val = load atomic i32, ptr addrspace(1) %in syncscope("singlethread-one-as") seq_cst, align 4
6761 store i32 %val, ptr addrspace(1) %out
6765 define amdgpu_kernel void @global_singlethread_one_as_unordered_store(
6766 ; GFX6-LABEL: global_singlethread_one_as_unordered_store:
6767 ; GFX6: ; %bb.0: ; %entry
6768 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
6769 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
6770 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
6771 ; GFX6-NEXT: s_mov_b32 s2, -1
6772 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6773 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
6774 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
6775 ; GFX6-NEXT: s_endpgm
6777 ; GFX7-LABEL: global_singlethread_one_as_unordered_store:
6778 ; GFX7: ; %bb.0: ; %entry
6779 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
6780 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
6781 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6782 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6783 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6784 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6785 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6786 ; GFX7-NEXT: s_endpgm
6788 ; GFX10-WGP-LABEL: global_singlethread_one_as_unordered_store:
6789 ; GFX10-WGP: ; %bb.0: ; %entry
6790 ; GFX10-WGP-NEXT: s_clause 0x1
6791 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
6792 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
6793 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6794 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6795 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6796 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
6797 ; GFX10-WGP-NEXT: s_endpgm
6799 ; GFX10-CU-LABEL: global_singlethread_one_as_unordered_store:
6800 ; GFX10-CU: ; %bb.0: ; %entry
6801 ; GFX10-CU-NEXT: s_clause 0x1
6802 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
6803 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
6804 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6805 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6806 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6807 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
6808 ; GFX10-CU-NEXT: s_endpgm
6810 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_unordered_store:
6811 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6812 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
6813 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
6814 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
6815 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
6816 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6817 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6818 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
6819 ; SKIP-CACHE-INV-NEXT: s_endpgm
6821 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_unordered_store:
6822 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6823 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
6824 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
6825 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6826 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6827 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6828 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
6829 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6831 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_unordered_store:
6832 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6833 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
6834 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
6835 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6836 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6837 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6838 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
6839 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6841 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_unordered_store:
6842 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6843 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
6844 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
6845 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6846 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6847 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
6848 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6849 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6851 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_unordered_store:
6852 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6853 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
6854 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
6855 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6856 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6857 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
6858 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6859 ; GFX940-TGSPLIT-NEXT: s_endpgm
6861 ; GFX11-WGP-LABEL: global_singlethread_one_as_unordered_store:
6862 ; GFX11-WGP: ; %bb.0: ; %entry
6863 ; GFX11-WGP-NEXT: s_clause 0x1
6864 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
6865 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
6866 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6867 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
6868 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
6869 ; GFX11-WGP-NEXT: s_nop 0
6870 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6871 ; GFX11-WGP-NEXT: s_endpgm
6873 ; GFX11-CU-LABEL: global_singlethread_one_as_unordered_store:
6874 ; GFX11-CU: ; %bb.0: ; %entry
6875 ; GFX11-CU-NEXT: s_clause 0x1
6876 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
6877 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
6878 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6879 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
6880 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
6881 ; GFX11-CU-NEXT: s_nop 0
6882 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6883 ; GFX11-CU-NEXT: s_endpgm
6884 i32 %in, ptr addrspace(1) %out) {
6886 store atomic i32 %in, ptr addrspace(1) %out syncscope("singlethread-one-as") unordered, align 4
6890 define amdgpu_kernel void @global_singlethread_one_as_monotonic_store(
6891 ; GFX6-LABEL: global_singlethread_one_as_monotonic_store:
6892 ; GFX6: ; %bb.0: ; %entry
6893 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
6894 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
6895 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
6896 ; GFX6-NEXT: s_mov_b32 s2, -1
6897 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6898 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
6899 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
6900 ; GFX6-NEXT: s_endpgm
6902 ; GFX7-LABEL: global_singlethread_one_as_monotonic_store:
6903 ; GFX7: ; %bb.0: ; %entry
6904 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
6905 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
6906 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6907 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6908 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6909 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6910 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6911 ; GFX7-NEXT: s_endpgm
6913 ; GFX10-WGP-LABEL: global_singlethread_one_as_monotonic_store:
6914 ; GFX10-WGP: ; %bb.0: ; %entry
6915 ; GFX10-WGP-NEXT: s_clause 0x1
6916 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
6917 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
6918 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6919 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6920 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
6921 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
6922 ; GFX10-WGP-NEXT: s_endpgm
6924 ; GFX10-CU-LABEL: global_singlethread_one_as_monotonic_store:
6925 ; GFX10-CU: ; %bb.0: ; %entry
6926 ; GFX10-CU-NEXT: s_clause 0x1
6927 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
6928 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
6929 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6930 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6931 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
6932 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
6933 ; GFX10-CU-NEXT: s_endpgm
6935 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_monotonic_store:
6936 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6937 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
6938 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
6939 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
6940 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
6941 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6942 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6943 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
6944 ; SKIP-CACHE-INV-NEXT: s_endpgm
6946 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_store:
6947 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6948 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
6949 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
6950 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6951 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6952 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6953 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
6954 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6956 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_store:
6957 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6958 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
6959 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
6960 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6961 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6962 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6963 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
6964 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6966 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_store:
6967 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6968 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
6969 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
6970 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6971 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6972 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
6973 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6974 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6976 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_store:
6977 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6978 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
6979 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
6980 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6981 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6982 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
6983 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
6984 ; GFX940-TGSPLIT-NEXT: s_endpgm
6986 ; GFX11-WGP-LABEL: global_singlethread_one_as_monotonic_store:
6987 ; GFX11-WGP: ; %bb.0: ; %entry
6988 ; GFX11-WGP-NEXT: s_clause 0x1
6989 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
6990 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
6991 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6992 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
6993 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
6994 ; GFX11-WGP-NEXT: s_nop 0
6995 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6996 ; GFX11-WGP-NEXT: s_endpgm
6998 ; GFX11-CU-LABEL: global_singlethread_one_as_monotonic_store:
6999 ; GFX11-CU: ; %bb.0: ; %entry
7000 ; GFX11-CU-NEXT: s_clause 0x1
7001 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
7002 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7003 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7004 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7005 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7006 ; GFX11-CU-NEXT: s_nop 0
7007 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7008 ; GFX11-CU-NEXT: s_endpgm
7009 i32 %in, ptr addrspace(1) %out) {
7011 store atomic i32 %in, ptr addrspace(1) %out syncscope("singlethread-one-as") monotonic, align 4
7015 define amdgpu_kernel void @global_singlethread_one_as_release_store(
7016 ; GFX6-LABEL: global_singlethread_one_as_release_store:
7017 ; GFX6: ; %bb.0: ; %entry
7018 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
7019 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7020 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7021 ; GFX6-NEXT: s_mov_b32 s2, -1
7022 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7023 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7024 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
7025 ; GFX6-NEXT: s_endpgm
7027 ; GFX7-LABEL: global_singlethread_one_as_release_store:
7028 ; GFX7: ; %bb.0: ; %entry
7029 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7030 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7031 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7032 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7033 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7034 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7035 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7036 ; GFX7-NEXT: s_endpgm
7038 ; GFX10-WGP-LABEL: global_singlethread_one_as_release_store:
7039 ; GFX10-WGP: ; %bb.0: ; %entry
7040 ; GFX10-WGP-NEXT: s_clause 0x1
7041 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7042 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7043 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7044 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7045 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7046 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
7047 ; GFX10-WGP-NEXT: s_endpgm
7049 ; GFX10-CU-LABEL: global_singlethread_one_as_release_store:
7050 ; GFX10-CU: ; %bb.0: ; %entry
7051 ; GFX10-CU-NEXT: s_clause 0x1
7052 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7053 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7054 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7055 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7056 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7057 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
7058 ; GFX10-CU-NEXT: s_endpgm
7060 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_release_store:
7061 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7062 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
7063 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
7064 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7065 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7066 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7067 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7068 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7069 ; SKIP-CACHE-INV-NEXT: s_endpgm
7071 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_store:
7072 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7073 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7074 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7075 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7076 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7077 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7078 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7079 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7081 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_release_store:
7082 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7083 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7084 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7085 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7086 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7087 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7088 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7089 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7091 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_store:
7092 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7093 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7094 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7095 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7096 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7097 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7098 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7099 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7101 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_release_store:
7102 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7103 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7104 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7105 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7106 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7107 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7108 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7109 ; GFX940-TGSPLIT-NEXT: s_endpgm
7111 ; GFX11-WGP-LABEL: global_singlethread_one_as_release_store:
7112 ; GFX11-WGP: ; %bb.0: ; %entry
7113 ; GFX11-WGP-NEXT: s_clause 0x1
7114 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
7115 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7116 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7117 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7118 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7119 ; GFX11-WGP-NEXT: s_nop 0
7120 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7121 ; GFX11-WGP-NEXT: s_endpgm
7123 ; GFX11-CU-LABEL: global_singlethread_one_as_release_store:
7124 ; GFX11-CU: ; %bb.0: ; %entry
7125 ; GFX11-CU-NEXT: s_clause 0x1
7126 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
7127 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7128 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7129 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7130 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7131 ; GFX11-CU-NEXT: s_nop 0
7132 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7133 ; GFX11-CU-NEXT: s_endpgm
7134 i32 %in, ptr addrspace(1) %out) {
7136 store atomic i32 %in, ptr addrspace(1) %out syncscope("singlethread-one-as") release, align 4
7140 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_store(
7141 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_store:
7142 ; GFX6: ; %bb.0: ; %entry
7143 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
7144 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7145 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7146 ; GFX6-NEXT: s_mov_b32 s2, -1
7147 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7148 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7149 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
7150 ; GFX6-NEXT: s_endpgm
7152 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_store:
7153 ; GFX7: ; %bb.0: ; %entry
7154 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7155 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7156 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7157 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7158 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7159 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7160 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7161 ; GFX7-NEXT: s_endpgm
7163 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_store:
7164 ; GFX10-WGP: ; %bb.0: ; %entry
7165 ; GFX10-WGP-NEXT: s_clause 0x1
7166 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7167 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7168 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7169 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7170 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7171 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
7172 ; GFX10-WGP-NEXT: s_endpgm
7174 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_store:
7175 ; GFX10-CU: ; %bb.0: ; %entry
7176 ; GFX10-CU-NEXT: s_clause 0x1
7177 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7178 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7179 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7180 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7181 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7182 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
7183 ; GFX10-CU-NEXT: s_endpgm
7185 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_store:
7186 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7187 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
7188 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
7189 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7190 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7191 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7192 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7193 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7194 ; SKIP-CACHE-INV-NEXT: s_endpgm
7196 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_store:
7197 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7198 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7199 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7200 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7201 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7202 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7203 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7204 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7206 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_store:
7207 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7208 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7209 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7210 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7211 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7212 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7213 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7214 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7216 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_store:
7217 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7218 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7219 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7220 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7221 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7222 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7223 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7224 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7226 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_store:
7227 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7228 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7229 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7230 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7231 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7232 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7233 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7234 ; GFX940-TGSPLIT-NEXT: s_endpgm
7236 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_store:
7237 ; GFX11-WGP: ; %bb.0: ; %entry
7238 ; GFX11-WGP-NEXT: s_clause 0x1
7239 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
7240 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7241 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7242 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7243 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7244 ; GFX11-WGP-NEXT: s_nop 0
7245 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7246 ; GFX11-WGP-NEXT: s_endpgm
7248 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_store:
7249 ; GFX11-CU: ; %bb.0: ; %entry
7250 ; GFX11-CU-NEXT: s_clause 0x1
7251 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
7252 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7253 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7254 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7255 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7256 ; GFX11-CU-NEXT: s_nop 0
7257 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7258 ; GFX11-CU-NEXT: s_endpgm
7259 i32 %in, ptr addrspace(1) %out) {
7261 store atomic i32 %in, ptr addrspace(1) %out syncscope("singlethread-one-as") seq_cst, align 4
7265 define amdgpu_kernel void @global_singlethread_one_as_monotonic_atomicrmw(
7266 ; GFX6-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7267 ; GFX6: ; %bb.0: ; %entry
7268 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
7269 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7270 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7271 ; GFX6-NEXT: s_mov_b32 s2, -1
7272 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7273 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7274 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7275 ; GFX6-NEXT: s_endpgm
7277 ; GFX7-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7278 ; GFX7: ; %bb.0: ; %entry
7279 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7280 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
7281 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7282 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7283 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7284 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7285 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
7286 ; GFX7-NEXT: s_endpgm
7288 ; GFX10-WGP-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7289 ; GFX10-WGP: ; %bb.0: ; %entry
7290 ; GFX10-WGP-NEXT: s_clause 0x1
7291 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
7292 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7293 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7294 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7295 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7296 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
7297 ; GFX10-WGP-NEXT: s_endpgm
7299 ; GFX10-CU-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7300 ; GFX10-CU: ; %bb.0: ; %entry
7301 ; GFX10-CU-NEXT: s_clause 0x1
7302 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
7303 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7304 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7305 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7306 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7307 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
7308 ; GFX10-CU-NEXT: s_endpgm
7310 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7311 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7312 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
7313 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7314 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7315 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7316 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7317 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7318 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7319 ; SKIP-CACHE-INV-NEXT: s_endpgm
7321 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7322 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7323 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7324 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7325 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7326 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7327 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7328 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7329 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7331 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7332 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7333 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7334 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7335 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7336 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7337 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7338 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7339 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7341 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7342 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7343 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7344 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7345 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7346 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7347 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7348 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7349 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7351 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7352 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7353 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7354 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7355 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7356 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7357 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7358 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7359 ; GFX940-TGSPLIT-NEXT: s_endpgm
7361 ; GFX11-WGP-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7362 ; GFX11-WGP: ; %bb.0: ; %entry
7363 ; GFX11-WGP-NEXT: s_clause 0x1
7364 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
7365 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7366 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7367 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7368 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7369 ; GFX11-WGP-NEXT: s_nop 0
7370 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7371 ; GFX11-WGP-NEXT: s_endpgm
7373 ; GFX11-CU-LABEL: global_singlethread_one_as_monotonic_atomicrmw:
7374 ; GFX11-CU: ; %bb.0: ; %entry
7375 ; GFX11-CU-NEXT: s_clause 0x1
7376 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
7377 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7378 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7379 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7380 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7381 ; GFX11-CU-NEXT: s_nop 0
7382 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7383 ; GFX11-CU-NEXT: s_endpgm
7384 ptr addrspace(1) %out, i32 %in) {
7386 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread-one-as") monotonic
7390 define amdgpu_kernel void @global_singlethread_one_as_acquire_atomicrmw(
7391 ; GFX6-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7392 ; GFX6: ; %bb.0: ; %entry
7393 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
7394 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7395 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7396 ; GFX6-NEXT: s_mov_b32 s2, -1
7397 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7398 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7399 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7400 ; GFX6-NEXT: s_endpgm
7402 ; GFX7-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7403 ; GFX7: ; %bb.0: ; %entry
7404 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7405 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
7406 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7407 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7408 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7409 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7410 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
7411 ; GFX7-NEXT: s_endpgm
7413 ; GFX10-WGP-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7414 ; GFX10-WGP: ; %bb.0: ; %entry
7415 ; GFX10-WGP-NEXT: s_clause 0x1
7416 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
7417 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7418 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7419 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7420 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7421 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
7422 ; GFX10-WGP-NEXT: s_endpgm
7424 ; GFX10-CU-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7425 ; GFX10-CU: ; %bb.0: ; %entry
7426 ; GFX10-CU-NEXT: s_clause 0x1
7427 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
7428 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7429 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7430 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7431 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7432 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
7433 ; GFX10-CU-NEXT: s_endpgm
7435 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7436 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7437 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
7438 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7439 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7440 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7441 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7442 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7443 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7444 ; SKIP-CACHE-INV-NEXT: s_endpgm
7446 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7447 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7448 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7449 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7450 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7451 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7452 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7453 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7454 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7456 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7457 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7458 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7459 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7460 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7461 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7462 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7463 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7464 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7466 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7467 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7468 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7469 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7470 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7471 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7472 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7473 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7474 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7476 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7477 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7478 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7479 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7480 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7481 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7482 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7483 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7484 ; GFX940-TGSPLIT-NEXT: s_endpgm
7486 ; GFX11-WGP-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7487 ; GFX11-WGP: ; %bb.0: ; %entry
7488 ; GFX11-WGP-NEXT: s_clause 0x1
7489 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
7490 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7491 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7492 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7493 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7494 ; GFX11-WGP-NEXT: s_nop 0
7495 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7496 ; GFX11-WGP-NEXT: s_endpgm
7498 ; GFX11-CU-LABEL: global_singlethread_one_as_acquire_atomicrmw:
7499 ; GFX11-CU: ; %bb.0: ; %entry
7500 ; GFX11-CU-NEXT: s_clause 0x1
7501 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
7502 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7503 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7504 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7505 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7506 ; GFX11-CU-NEXT: s_nop 0
7507 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7508 ; GFX11-CU-NEXT: s_endpgm
7509 ptr addrspace(1) %out, i32 %in) {
7511 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread-one-as") acquire
7515 define amdgpu_kernel void @global_singlethread_one_as_release_atomicrmw(
7516 ; GFX6-LABEL: global_singlethread_one_as_release_atomicrmw:
7517 ; GFX6: ; %bb.0: ; %entry
7518 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
7519 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7520 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7521 ; GFX6-NEXT: s_mov_b32 s2, -1
7522 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7523 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7524 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7525 ; GFX6-NEXT: s_endpgm
7527 ; GFX7-LABEL: global_singlethread_one_as_release_atomicrmw:
7528 ; GFX7: ; %bb.0: ; %entry
7529 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7530 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
7531 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7532 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7533 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7534 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7535 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
7536 ; GFX7-NEXT: s_endpgm
7538 ; GFX10-WGP-LABEL: global_singlethread_one_as_release_atomicrmw:
7539 ; GFX10-WGP: ; %bb.0: ; %entry
7540 ; GFX10-WGP-NEXT: s_clause 0x1
7541 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
7542 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7543 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7544 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7545 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7546 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
7547 ; GFX10-WGP-NEXT: s_endpgm
7549 ; GFX10-CU-LABEL: global_singlethread_one_as_release_atomicrmw:
7550 ; GFX10-CU: ; %bb.0: ; %entry
7551 ; GFX10-CU-NEXT: s_clause 0x1
7552 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
7553 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7554 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7555 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7556 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7557 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
7558 ; GFX10-CU-NEXT: s_endpgm
7560 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_release_atomicrmw:
7561 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7562 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
7563 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7564 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7565 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7566 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7567 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7568 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7569 ; SKIP-CACHE-INV-NEXT: s_endpgm
7571 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_atomicrmw:
7572 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7573 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7574 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7575 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7576 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7577 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7578 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7579 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7581 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_release_atomicrmw:
7582 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7583 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7584 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7585 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7586 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7587 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7588 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7589 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7591 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_atomicrmw:
7592 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7593 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7594 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7595 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7596 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7597 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7598 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7599 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7601 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_release_atomicrmw:
7602 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7603 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7604 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7605 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7606 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7607 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7608 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7609 ; GFX940-TGSPLIT-NEXT: s_endpgm
7611 ; GFX11-WGP-LABEL: global_singlethread_one_as_release_atomicrmw:
7612 ; GFX11-WGP: ; %bb.0: ; %entry
7613 ; GFX11-WGP-NEXT: s_clause 0x1
7614 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
7615 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7616 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7617 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7618 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7619 ; GFX11-WGP-NEXT: s_nop 0
7620 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7621 ; GFX11-WGP-NEXT: s_endpgm
7623 ; GFX11-CU-LABEL: global_singlethread_one_as_release_atomicrmw:
7624 ; GFX11-CU: ; %bb.0: ; %entry
7625 ; GFX11-CU-NEXT: s_clause 0x1
7626 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
7627 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7628 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7629 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7630 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7631 ; GFX11-CU-NEXT: s_nop 0
7632 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7633 ; GFX11-CU-NEXT: s_endpgm
7634 ptr addrspace(1) %out, i32 %in) {
7636 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread-one-as") release
7640 define amdgpu_kernel void @global_singlethread_one_as_acq_rel_atomicrmw(
7641 ; GFX6-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7642 ; GFX6: ; %bb.0: ; %entry
7643 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
7644 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7645 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7646 ; GFX6-NEXT: s_mov_b32 s2, -1
7647 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7648 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7649 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7650 ; GFX6-NEXT: s_endpgm
7652 ; GFX7-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7653 ; GFX7: ; %bb.0: ; %entry
7654 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7655 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
7656 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7657 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7658 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7659 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7660 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
7661 ; GFX7-NEXT: s_endpgm
7663 ; GFX10-WGP-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7664 ; GFX10-WGP: ; %bb.0: ; %entry
7665 ; GFX10-WGP-NEXT: s_clause 0x1
7666 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
7667 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7668 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7669 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7670 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7671 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
7672 ; GFX10-WGP-NEXT: s_endpgm
7674 ; GFX10-CU-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7675 ; GFX10-CU: ; %bb.0: ; %entry
7676 ; GFX10-CU-NEXT: s_clause 0x1
7677 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
7678 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7679 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7680 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7681 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7682 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
7683 ; GFX10-CU-NEXT: s_endpgm
7685 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7686 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7687 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
7688 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7689 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7690 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7691 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7692 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7693 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7694 ; SKIP-CACHE-INV-NEXT: s_endpgm
7696 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7697 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7698 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7699 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7700 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7701 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7702 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7703 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7704 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7706 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7707 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7708 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7709 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7710 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7711 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7712 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7713 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7714 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7716 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7717 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7718 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7719 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7720 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7721 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7722 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7723 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7724 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7726 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7727 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7728 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7729 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7730 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7731 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7732 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7733 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7734 ; GFX940-TGSPLIT-NEXT: s_endpgm
7736 ; GFX11-WGP-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7737 ; GFX11-WGP: ; %bb.0: ; %entry
7738 ; GFX11-WGP-NEXT: s_clause 0x1
7739 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
7740 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7741 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7742 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7743 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7744 ; GFX11-WGP-NEXT: s_nop 0
7745 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7746 ; GFX11-WGP-NEXT: s_endpgm
7748 ; GFX11-CU-LABEL: global_singlethread_one_as_acq_rel_atomicrmw:
7749 ; GFX11-CU: ; %bb.0: ; %entry
7750 ; GFX11-CU-NEXT: s_clause 0x1
7751 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
7752 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7753 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7754 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7755 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7756 ; GFX11-CU-NEXT: s_nop 0
7757 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7758 ; GFX11-CU-NEXT: s_endpgm
7759 ptr addrspace(1) %out, i32 %in) {
7761 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread-one-as") acq_rel
7765 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_atomicrmw(
7766 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7767 ; GFX6: ; %bb.0: ; %entry
7768 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
7769 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7770 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7771 ; GFX6-NEXT: s_mov_b32 s2, -1
7772 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7773 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7774 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7775 ; GFX6-NEXT: s_endpgm
7777 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7778 ; GFX7: ; %bb.0: ; %entry
7779 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7780 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
7781 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7782 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7783 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7784 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7785 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
7786 ; GFX7-NEXT: s_endpgm
7788 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7789 ; GFX10-WGP: ; %bb.0: ; %entry
7790 ; GFX10-WGP-NEXT: s_clause 0x1
7791 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
7792 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7793 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7794 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7795 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7796 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
7797 ; GFX10-WGP-NEXT: s_endpgm
7799 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7800 ; GFX10-CU: ; %bb.0: ; %entry
7801 ; GFX10-CU-NEXT: s_clause 0x1
7802 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
7803 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7804 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7805 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7806 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7807 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
7808 ; GFX10-CU-NEXT: s_endpgm
7810 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7811 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7812 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
7813 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7814 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7815 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7816 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7817 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7818 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7819 ; SKIP-CACHE-INV-NEXT: s_endpgm
7821 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7822 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7823 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7824 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7825 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7826 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7827 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7828 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7829 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7831 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7832 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7833 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7834 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7835 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7836 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7837 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7838 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7839 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7841 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7842 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7843 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7844 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7845 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7846 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7847 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7848 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7849 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7851 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7852 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7853 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7854 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7855 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7856 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7857 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7858 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3]
7859 ; GFX940-TGSPLIT-NEXT: s_endpgm
7861 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7862 ; GFX11-WGP: ; %bb.0: ; %entry
7863 ; GFX11-WGP-NEXT: s_clause 0x1
7864 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
7865 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7866 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7867 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7868 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7869 ; GFX11-WGP-NEXT: s_nop 0
7870 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7871 ; GFX11-WGP-NEXT: s_endpgm
7873 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_atomicrmw:
7874 ; GFX11-CU: ; %bb.0: ; %entry
7875 ; GFX11-CU-NEXT: s_clause 0x1
7876 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
7877 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7878 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7879 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7880 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7881 ; GFX11-CU-NEXT: s_nop 0
7882 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7883 ; GFX11-CU-NEXT: s_endpgm
7884 ptr addrspace(1) %out, i32 %in) {
7886 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread-one-as") seq_cst
7890 define amdgpu_kernel void @global_singlethread_one_as_acquire_ret_atomicrmw(
7891 ; GFX6-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
7892 ; GFX6: ; %bb.0: ; %entry
7893 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
7894 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7895 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7896 ; GFX6-NEXT: s_mov_b32 s2, -1
7897 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7898 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7899 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
7900 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7901 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
7902 ; GFX6-NEXT: s_endpgm
7904 ; GFX7-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
7905 ; GFX7: ; %bb.0: ; %entry
7906 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7907 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
7908 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7909 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7910 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7911 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7912 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
7913 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7914 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7915 ; GFX7-NEXT: s_endpgm
7917 ; GFX10-WGP-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
7918 ; GFX10-WGP: ; %bb.0: ; %entry
7919 ; GFX10-WGP-NEXT: s_clause 0x1
7920 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
7921 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7922 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7923 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7924 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7925 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
7926 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7927 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
7928 ; GFX10-WGP-NEXT: s_endpgm
7930 ; GFX10-CU-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
7931 ; GFX10-CU: ; %bb.0: ; %entry
7932 ; GFX10-CU-NEXT: s_clause 0x1
7933 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
7934 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7935 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7936 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7937 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7938 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
7939 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7940 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
7941 ; GFX10-CU-NEXT: s_endpgm
7943 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
7944 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7945 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
7946 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7947 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7948 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7949 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7950 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7951 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
7952 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7953 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7954 ; SKIP-CACHE-INV-NEXT: s_endpgm
7956 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
7957 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7958 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7959 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7960 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7961 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7962 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7963 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
7964 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7965 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7966 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7968 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
7969 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7970 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7971 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7972 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7973 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7974 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7975 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
7976 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7977 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7978 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7980 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
7981 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7982 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7983 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7984 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7985 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7986 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7987 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
7988 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7989 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7990 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7992 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
7993 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7994 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7995 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7996 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7997 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7998 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7999 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
8000 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8001 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
8002 ; GFX940-TGSPLIT-NEXT: s_endpgm
8004 ; GFX11-WGP-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
8005 ; GFX11-WGP: ; %bb.0: ; %entry
8006 ; GFX11-WGP-NEXT: s_clause 0x1
8007 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
8008 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8009 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8010 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8011 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8012 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8013 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8014 ; GFX11-WGP-NEXT: s_nop 0
8015 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8016 ; GFX11-WGP-NEXT: s_endpgm
8018 ; GFX11-CU-LABEL: global_singlethread_one_as_acquire_ret_atomicrmw:
8019 ; GFX11-CU: ; %bb.0: ; %entry
8020 ; GFX11-CU-NEXT: s_clause 0x1
8021 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
8022 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8023 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8024 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8025 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8026 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8027 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8028 ; GFX11-CU-NEXT: s_nop 0
8029 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8030 ; GFX11-CU-NEXT: s_endpgm
8031 ptr addrspace(1) %out, i32 %in) {
8033 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread-one-as") acquire
8034 store i32 %val, ptr addrspace(1) %out, align 4
8038 define amdgpu_kernel void @global_singlethread_one_as_acq_rel_ret_atomicrmw(
8039 ; GFX6-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8040 ; GFX6: ; %bb.0: ; %entry
8041 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
8042 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8043 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
8044 ; GFX6-NEXT: s_mov_b32 s2, -1
8045 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8046 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
8047 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8048 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8049 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
8050 ; GFX6-NEXT: s_endpgm
8052 ; GFX7-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8053 ; GFX7: ; %bb.0: ; %entry
8054 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8055 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8056 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8057 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8058 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8059 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8060 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8061 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8062 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8063 ; GFX7-NEXT: s_endpgm
8065 ; GFX10-WGP-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8066 ; GFX10-WGP: ; %bb.0: ; %entry
8067 ; GFX10-WGP-NEXT: s_clause 0x1
8068 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8069 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8070 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8071 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8072 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8073 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8074 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8075 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
8076 ; GFX10-WGP-NEXT: s_endpgm
8078 ; GFX10-CU-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8079 ; GFX10-CU: ; %bb.0: ; %entry
8080 ; GFX10-CU-NEXT: s_clause 0x1
8081 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8082 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8083 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8084 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8085 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8086 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8087 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8088 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
8089 ; GFX10-CU-NEXT: s_endpgm
8091 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8092 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8093 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
8094 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
8095 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
8096 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
8097 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8098 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
8099 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8100 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8101 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
8102 ; SKIP-CACHE-INV-NEXT: s_endpgm
8104 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8105 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8106 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8107 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8108 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8109 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8110 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8111 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8112 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8113 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8114 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8116 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8117 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8118 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8119 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8120 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8121 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8122 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8123 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8124 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8125 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8126 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8128 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8129 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8130 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8131 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8132 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8133 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8134 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8135 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
8136 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8137 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
8138 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8140 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8141 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8142 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8143 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8144 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8145 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8146 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8147 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
8148 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8149 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
8150 ; GFX940-TGSPLIT-NEXT: s_endpgm
8152 ; GFX11-WGP-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8153 ; GFX11-WGP: ; %bb.0: ; %entry
8154 ; GFX11-WGP-NEXT: s_clause 0x1
8155 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
8156 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8157 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8158 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8159 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8160 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8161 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8162 ; GFX11-WGP-NEXT: s_nop 0
8163 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8164 ; GFX11-WGP-NEXT: s_endpgm
8166 ; GFX11-CU-LABEL: global_singlethread_one_as_acq_rel_ret_atomicrmw:
8167 ; GFX11-CU: ; %bb.0: ; %entry
8168 ; GFX11-CU-NEXT: s_clause 0x1
8169 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
8170 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8171 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8172 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8173 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8174 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8175 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8176 ; GFX11-CU-NEXT: s_nop 0
8177 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8178 ; GFX11-CU-NEXT: s_endpgm
8179 ptr addrspace(1) %out, i32 %in) {
8181 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread-one-as") acq_rel
8182 store i32 %val, ptr addrspace(1) %out, align 4
8186 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_ret_atomicrmw(
8187 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8188 ; GFX6: ; %bb.0: ; %entry
8189 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
8190 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8191 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
8192 ; GFX6-NEXT: s_mov_b32 s2, -1
8193 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8194 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
8195 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8196 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8197 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
8198 ; GFX6-NEXT: s_endpgm
8200 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8201 ; GFX7: ; %bb.0: ; %entry
8202 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8203 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8204 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8205 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8206 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8207 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8208 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8209 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8210 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8211 ; GFX7-NEXT: s_endpgm
8213 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8214 ; GFX10-WGP: ; %bb.0: ; %entry
8215 ; GFX10-WGP-NEXT: s_clause 0x1
8216 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8217 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8218 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8219 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8220 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8221 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8222 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8223 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
8224 ; GFX10-WGP-NEXT: s_endpgm
8226 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8227 ; GFX10-CU: ; %bb.0: ; %entry
8228 ; GFX10-CU-NEXT: s_clause 0x1
8229 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8230 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8231 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8232 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8233 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8234 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8235 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8236 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
8237 ; GFX10-CU-NEXT: s_endpgm
8239 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8240 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8241 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
8242 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
8243 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
8244 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
8245 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8246 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
8247 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8248 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8249 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
8250 ; SKIP-CACHE-INV-NEXT: s_endpgm
8252 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8253 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8254 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8255 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8256 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8257 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8258 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8259 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8260 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8261 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8262 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8264 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8265 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8266 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8267 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8268 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8269 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8270 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8271 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8272 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8273 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8274 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8276 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8277 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8278 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8279 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8280 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8281 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8282 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8283 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
8284 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8285 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
8286 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8288 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8289 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8290 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8291 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8292 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8293 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8294 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8295 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0
8296 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8297 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
8298 ; GFX940-TGSPLIT-NEXT: s_endpgm
8300 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8301 ; GFX11-WGP: ; %bb.0: ; %entry
8302 ; GFX11-WGP-NEXT: s_clause 0x1
8303 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
8304 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8305 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8306 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8307 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8308 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8309 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8310 ; GFX11-WGP-NEXT: s_nop 0
8311 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8312 ; GFX11-WGP-NEXT: s_endpgm
8314 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_ret_atomicrmw:
8315 ; GFX11-CU: ; %bb.0: ; %entry
8316 ; GFX11-CU-NEXT: s_clause 0x1
8317 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
8318 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8319 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8320 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8321 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8322 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8323 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8324 ; GFX11-CU-NEXT: s_nop 0
8325 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8326 ; GFX11-CU-NEXT: s_endpgm
8327 ptr addrspace(1) %out, i32 %in) {
8329 %val = atomicrmw volatile xchg ptr addrspace(1) %out, i32 %in syncscope("singlethread-one-as") seq_cst
8330 store i32 %val, ptr addrspace(1) %out, align 4
8334 define amdgpu_kernel void @global_singlethread_one_as_monotonic_monotonic_cmpxchg(
8335 ; GFX6-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8336 ; GFX6: ; %bb.0: ; %entry
8337 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8338 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
8339 ; GFX6-NEXT: s_mov_b32 s6, -1
8340 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8341 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8342 ; GFX6-NEXT: s_mov_b32 s4, s0
8343 ; GFX6-NEXT: s_mov_b32 s5, s1
8344 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
8345 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8346 ; GFX6-NEXT: s_endpgm
8348 ; GFX7-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8349 ; GFX7: ; %bb.0: ; %entry
8350 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8351 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8352 ; GFX7-NEXT: s_add_u32 s0, s0, 16
8353 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
8354 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8355 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8356 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8357 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
8358 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
8359 ; GFX7-NEXT: s_endpgm
8361 ; GFX10-WGP-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8362 ; GFX10-WGP: ; %bb.0: ; %entry
8363 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8364 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
8365 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8366 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
8367 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
8368 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8369 ; GFX10-WGP-NEXT: s_endpgm
8371 ; GFX10-CU-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8372 ; GFX10-CU: ; %bb.0: ; %entry
8373 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8374 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
8375 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8376 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
8377 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
8378 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8379 ; GFX10-CU-NEXT: s_endpgm
8381 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8382 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8383 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8384 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
8385 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
8386 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8387 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8388 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
8389 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
8390 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8391 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8392 ; SKIP-CACHE-INV-NEXT: s_endpgm
8394 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8395 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8396 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8397 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8398 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8399 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8400 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8401 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8403 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8404 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8405 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8406 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8407 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8408 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8409 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8410 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8412 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8413 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8414 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8415 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8416 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8417 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8418 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8419 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8421 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8422 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8423 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8424 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8425 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8426 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8427 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8428 ; GFX940-TGSPLIT-NEXT: s_endpgm
8430 ; GFX11-WGP-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8431 ; GFX11-WGP: ; %bb.0: ; %entry
8432 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8433 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
8434 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8435 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8436 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8437 ; GFX11-WGP-NEXT: s_nop 0
8438 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8439 ; GFX11-WGP-NEXT: s_endpgm
8441 ; GFX11-CU-LABEL: global_singlethread_one_as_monotonic_monotonic_cmpxchg:
8442 ; GFX11-CU: ; %bb.0: ; %entry
8443 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8444 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
8445 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8446 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8447 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8448 ; GFX11-CU-NEXT: s_nop 0
8449 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8450 ; GFX11-CU-NEXT: s_endpgm
8451 ptr addrspace(1) %out, i32 %in, i32 %old) {
8453 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
8454 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic monotonic
8458 define amdgpu_kernel void @global_singlethread_one_as_acquire_monotonic_cmpxchg(
8459 ; GFX6-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8460 ; GFX6: ; %bb.0: ; %entry
8461 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8462 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
8463 ; GFX6-NEXT: s_mov_b32 s6, -1
8464 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8465 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8466 ; GFX6-NEXT: s_mov_b32 s4, s0
8467 ; GFX6-NEXT: s_mov_b32 s5, s1
8468 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
8469 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8470 ; GFX6-NEXT: s_endpgm
8472 ; GFX7-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8473 ; GFX7: ; %bb.0: ; %entry
8474 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8475 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8476 ; GFX7-NEXT: s_add_u32 s0, s0, 16
8477 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
8478 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8479 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8480 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8481 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
8482 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
8483 ; GFX7-NEXT: s_endpgm
8485 ; GFX10-WGP-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8486 ; GFX10-WGP: ; %bb.0: ; %entry
8487 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8488 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
8489 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8490 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
8491 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
8492 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8493 ; GFX10-WGP-NEXT: s_endpgm
8495 ; GFX10-CU-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8496 ; GFX10-CU: ; %bb.0: ; %entry
8497 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8498 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
8499 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8500 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
8501 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
8502 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8503 ; GFX10-CU-NEXT: s_endpgm
8505 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8506 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8507 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8508 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
8509 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
8510 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8511 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8512 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
8513 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
8514 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8515 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8516 ; SKIP-CACHE-INV-NEXT: s_endpgm
8518 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8519 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8520 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8521 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8522 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8523 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8524 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8525 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8527 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8528 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8529 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8530 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8531 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8532 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8533 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8534 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8536 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8537 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8538 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8539 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8540 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8541 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8542 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8543 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8545 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8546 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8547 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8548 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8549 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8550 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8551 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8552 ; GFX940-TGSPLIT-NEXT: s_endpgm
8554 ; GFX11-WGP-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8555 ; GFX11-WGP: ; %bb.0: ; %entry
8556 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8557 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
8558 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8559 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8560 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8561 ; GFX11-WGP-NEXT: s_nop 0
8562 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8563 ; GFX11-WGP-NEXT: s_endpgm
8565 ; GFX11-CU-LABEL: global_singlethread_one_as_acquire_monotonic_cmpxchg:
8566 ; GFX11-CU: ; %bb.0: ; %entry
8567 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8568 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
8569 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8570 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8571 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8572 ; GFX11-CU-NEXT: s_nop 0
8573 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8574 ; GFX11-CU-NEXT: s_endpgm
8575 ptr addrspace(1) %out, i32 %in, i32 %old) {
8577 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
8578 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire monotonic
8582 define amdgpu_kernel void @global_singlethread_one_as_release_monotonic_cmpxchg(
8583 ; GFX6-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8584 ; GFX6: ; %bb.0: ; %entry
8585 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8586 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
8587 ; GFX6-NEXT: s_mov_b32 s6, -1
8588 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8589 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8590 ; GFX6-NEXT: s_mov_b32 s4, s0
8591 ; GFX6-NEXT: s_mov_b32 s5, s1
8592 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
8593 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8594 ; GFX6-NEXT: s_endpgm
8596 ; GFX7-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8597 ; GFX7: ; %bb.0: ; %entry
8598 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8599 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8600 ; GFX7-NEXT: s_add_u32 s0, s0, 16
8601 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
8602 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8603 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8604 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8605 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
8606 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
8607 ; GFX7-NEXT: s_endpgm
8609 ; GFX10-WGP-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8610 ; GFX10-WGP: ; %bb.0: ; %entry
8611 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8612 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
8613 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8614 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
8615 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
8616 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8617 ; GFX10-WGP-NEXT: s_endpgm
8619 ; GFX10-CU-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8620 ; GFX10-CU: ; %bb.0: ; %entry
8621 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8622 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
8623 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8624 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
8625 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
8626 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8627 ; GFX10-CU-NEXT: s_endpgm
8629 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8630 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8631 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8632 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
8633 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
8634 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8635 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8636 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
8637 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
8638 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8639 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8640 ; SKIP-CACHE-INV-NEXT: s_endpgm
8642 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8643 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8644 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8645 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8646 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8647 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8648 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8649 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8651 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8652 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8653 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8654 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8655 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8656 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8657 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8658 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8660 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8661 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8662 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8663 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8664 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8665 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8666 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8667 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8669 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8670 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8671 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8672 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8673 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8674 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8675 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8676 ; GFX940-TGSPLIT-NEXT: s_endpgm
8678 ; GFX11-WGP-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8679 ; GFX11-WGP: ; %bb.0: ; %entry
8680 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8681 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
8682 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8683 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8684 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8685 ; GFX11-WGP-NEXT: s_nop 0
8686 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8687 ; GFX11-WGP-NEXT: s_endpgm
8689 ; GFX11-CU-LABEL: global_singlethread_one_as_release_monotonic_cmpxchg:
8690 ; GFX11-CU: ; %bb.0: ; %entry
8691 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8692 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
8693 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8694 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8695 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8696 ; GFX11-CU-NEXT: s_nop 0
8697 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8698 ; GFX11-CU-NEXT: s_endpgm
8699 ptr addrspace(1) %out, i32 %in, i32 %old) {
8701 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
8702 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release monotonic
8706 define amdgpu_kernel void @global_singlethread_one_as_acq_rel_monotonic_cmpxchg(
8707 ; GFX6-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8708 ; GFX6: ; %bb.0: ; %entry
8709 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8710 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
8711 ; GFX6-NEXT: s_mov_b32 s6, -1
8712 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8713 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8714 ; GFX6-NEXT: s_mov_b32 s4, s0
8715 ; GFX6-NEXT: s_mov_b32 s5, s1
8716 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
8717 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8718 ; GFX6-NEXT: s_endpgm
8720 ; GFX7-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8721 ; GFX7: ; %bb.0: ; %entry
8722 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8723 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8724 ; GFX7-NEXT: s_add_u32 s0, s0, 16
8725 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
8726 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8727 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8728 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8729 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
8730 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
8731 ; GFX7-NEXT: s_endpgm
8733 ; GFX10-WGP-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8734 ; GFX10-WGP: ; %bb.0: ; %entry
8735 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8736 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
8737 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8738 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
8739 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
8740 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8741 ; GFX10-WGP-NEXT: s_endpgm
8743 ; GFX10-CU-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8744 ; GFX10-CU: ; %bb.0: ; %entry
8745 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8746 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
8747 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8748 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
8749 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
8750 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8751 ; GFX10-CU-NEXT: s_endpgm
8753 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8754 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8755 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8756 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
8757 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
8758 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8759 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8760 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
8761 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
8762 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8763 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8764 ; SKIP-CACHE-INV-NEXT: s_endpgm
8766 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8767 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8768 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8769 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8770 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8771 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8772 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8773 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8775 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8776 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8777 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8778 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8779 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8780 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8781 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8782 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8784 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8785 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8786 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8787 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8788 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8789 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8790 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8791 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8793 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8794 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8795 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8796 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8797 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8798 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8799 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8800 ; GFX940-TGSPLIT-NEXT: s_endpgm
8802 ; GFX11-WGP-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8803 ; GFX11-WGP: ; %bb.0: ; %entry
8804 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8805 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
8806 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8807 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8808 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8809 ; GFX11-WGP-NEXT: s_nop 0
8810 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8811 ; GFX11-WGP-NEXT: s_endpgm
8813 ; GFX11-CU-LABEL: global_singlethread_one_as_acq_rel_monotonic_cmpxchg:
8814 ; GFX11-CU: ; %bb.0: ; %entry
8815 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8816 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
8817 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8818 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8819 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8820 ; GFX11-CU-NEXT: s_nop 0
8821 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8822 ; GFX11-CU-NEXT: s_endpgm
8823 ptr addrspace(1) %out, i32 %in, i32 %old) {
8825 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
8826 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel monotonic
8830 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_monotonic_cmpxchg(
8831 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8832 ; GFX6: ; %bb.0: ; %entry
8833 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8834 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
8835 ; GFX6-NEXT: s_mov_b32 s6, -1
8836 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8837 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8838 ; GFX6-NEXT: s_mov_b32 s4, s0
8839 ; GFX6-NEXT: s_mov_b32 s5, s1
8840 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
8841 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8842 ; GFX6-NEXT: s_endpgm
8844 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8845 ; GFX7: ; %bb.0: ; %entry
8846 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8847 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8848 ; GFX7-NEXT: s_add_u32 s0, s0, 16
8849 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
8850 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8851 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8852 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8853 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
8854 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
8855 ; GFX7-NEXT: s_endpgm
8857 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8858 ; GFX10-WGP: ; %bb.0: ; %entry
8859 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8860 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
8861 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8862 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
8863 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
8864 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8865 ; GFX10-WGP-NEXT: s_endpgm
8867 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8868 ; GFX10-CU: ; %bb.0: ; %entry
8869 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8870 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
8871 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8872 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
8873 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
8874 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8875 ; GFX10-CU-NEXT: s_endpgm
8877 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8878 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8879 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8880 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
8881 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
8882 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8883 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8884 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
8885 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
8886 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8887 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8888 ; SKIP-CACHE-INV-NEXT: s_endpgm
8890 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8891 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8892 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8893 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8894 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8895 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8896 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8897 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8899 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8900 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8901 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8902 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8903 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8904 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8905 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8906 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8908 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8909 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8910 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8911 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8912 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8913 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8914 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8915 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8917 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8918 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8919 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8920 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8921 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8922 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8923 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8924 ; GFX940-TGSPLIT-NEXT: s_endpgm
8926 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8927 ; GFX11-WGP: ; %bb.0: ; %entry
8928 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8929 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
8930 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8931 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8932 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8933 ; GFX11-WGP-NEXT: s_nop 0
8934 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8935 ; GFX11-WGP-NEXT: s_endpgm
8937 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_monotonic_cmpxchg:
8938 ; GFX11-CU: ; %bb.0: ; %entry
8939 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
8940 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
8941 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8942 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8943 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
8944 ; GFX11-CU-NEXT: s_nop 0
8945 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8946 ; GFX11-CU-NEXT: s_endpgm
8947 ptr addrspace(1) %out, i32 %in, i32 %old) {
8949 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
8950 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst monotonic
8954 define amdgpu_kernel void @global_singlethread_one_as_monotonic_acquire_cmpxchg(
8955 ; GFX6-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
8956 ; GFX6: ; %bb.0: ; %entry
8957 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8958 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
8959 ; GFX6-NEXT: s_mov_b32 s6, -1
8960 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8961 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8962 ; GFX6-NEXT: s_mov_b32 s4, s0
8963 ; GFX6-NEXT: s_mov_b32 s5, s1
8964 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
8965 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8966 ; GFX6-NEXT: s_endpgm
8968 ; GFX7-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
8969 ; GFX7: ; %bb.0: ; %entry
8970 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8971 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8972 ; GFX7-NEXT: s_add_u32 s0, s0, 16
8973 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
8974 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8975 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8976 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8977 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
8978 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
8979 ; GFX7-NEXT: s_endpgm
8981 ; GFX10-WGP-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
8982 ; GFX10-WGP: ; %bb.0: ; %entry
8983 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8984 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
8985 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8986 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
8987 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
8988 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8989 ; GFX10-WGP-NEXT: s_endpgm
8991 ; GFX10-CU-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
8992 ; GFX10-CU: ; %bb.0: ; %entry
8993 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8994 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
8995 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8996 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
8997 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
8998 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8999 ; GFX10-CU-NEXT: s_endpgm
9001 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
9002 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9003 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9004 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9005 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9006 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9007 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9008 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9009 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9010 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9011 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9012 ; SKIP-CACHE-INV-NEXT: s_endpgm
9014 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
9015 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9016 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9017 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9018 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9019 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9020 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9021 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9023 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
9024 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9025 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9026 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9027 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9028 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9029 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9030 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9032 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
9033 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9034 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9035 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9036 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9037 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9038 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9039 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9041 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
9042 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9043 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9044 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9045 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9046 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9047 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9048 ; GFX940-TGSPLIT-NEXT: s_endpgm
9050 ; GFX11-WGP-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
9051 ; GFX11-WGP: ; %bb.0: ; %entry
9052 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9053 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9054 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9055 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9056 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9057 ; GFX11-WGP-NEXT: s_nop 0
9058 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9059 ; GFX11-WGP-NEXT: s_endpgm
9061 ; GFX11-CU-LABEL: global_singlethread_one_as_monotonic_acquire_cmpxchg:
9062 ; GFX11-CU: ; %bb.0: ; %entry
9063 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9064 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9065 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9066 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9067 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9068 ; GFX11-CU-NEXT: s_nop 0
9069 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9070 ; GFX11-CU-NEXT: s_endpgm
9071 ptr addrspace(1) %out, i32 %in, i32 %old) {
9073 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9074 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic acquire
9078 define amdgpu_kernel void @global_singlethread_one_as_acquire_acquire_cmpxchg(
9079 ; GFX6-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9080 ; GFX6: ; %bb.0: ; %entry
9081 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9082 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9083 ; GFX6-NEXT: s_mov_b32 s6, -1
9084 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9085 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9086 ; GFX6-NEXT: s_mov_b32 s4, s0
9087 ; GFX6-NEXT: s_mov_b32 s5, s1
9088 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9089 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9090 ; GFX6-NEXT: s_endpgm
9092 ; GFX7-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9093 ; GFX7: ; %bb.0: ; %entry
9094 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9095 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9096 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9097 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9098 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9099 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9100 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9101 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9102 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9103 ; GFX7-NEXT: s_endpgm
9105 ; GFX10-WGP-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9106 ; GFX10-WGP: ; %bb.0: ; %entry
9107 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9108 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9109 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9110 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9111 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9112 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9113 ; GFX10-WGP-NEXT: s_endpgm
9115 ; GFX10-CU-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9116 ; GFX10-CU: ; %bb.0: ; %entry
9117 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9118 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9119 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9120 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9121 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9122 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9123 ; GFX10-CU-NEXT: s_endpgm
9125 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9126 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9127 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9128 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9129 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9130 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9131 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9132 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9133 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9134 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9135 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9136 ; SKIP-CACHE-INV-NEXT: s_endpgm
9138 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9139 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9140 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9141 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9142 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9143 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9144 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9145 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9147 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9148 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9149 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9150 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9151 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9152 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9153 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9154 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9156 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9157 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9158 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9159 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9160 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9161 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9162 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9163 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9165 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9166 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9167 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9168 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9169 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9170 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9171 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9172 ; GFX940-TGSPLIT-NEXT: s_endpgm
9174 ; GFX11-WGP-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9175 ; GFX11-WGP: ; %bb.0: ; %entry
9176 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9177 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9178 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9179 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9180 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9181 ; GFX11-WGP-NEXT: s_nop 0
9182 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9183 ; GFX11-WGP-NEXT: s_endpgm
9185 ; GFX11-CU-LABEL: global_singlethread_one_as_acquire_acquire_cmpxchg:
9186 ; GFX11-CU: ; %bb.0: ; %entry
9187 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9188 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9189 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9190 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9191 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9192 ; GFX11-CU-NEXT: s_nop 0
9193 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9194 ; GFX11-CU-NEXT: s_endpgm
9195 ptr addrspace(1) %out, i32 %in, i32 %old) {
9197 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9198 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire acquire
9202 define amdgpu_kernel void @global_singlethread_one_as_release_acquire_cmpxchg(
9203 ; GFX6-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9204 ; GFX6: ; %bb.0: ; %entry
9205 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9206 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9207 ; GFX6-NEXT: s_mov_b32 s6, -1
9208 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9209 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9210 ; GFX6-NEXT: s_mov_b32 s4, s0
9211 ; GFX6-NEXT: s_mov_b32 s5, s1
9212 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9213 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9214 ; GFX6-NEXT: s_endpgm
9216 ; GFX7-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9217 ; GFX7: ; %bb.0: ; %entry
9218 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9219 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9220 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9221 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9222 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9223 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9224 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9225 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9226 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9227 ; GFX7-NEXT: s_endpgm
9229 ; GFX10-WGP-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9230 ; GFX10-WGP: ; %bb.0: ; %entry
9231 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9232 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9233 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9234 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9235 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9236 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9237 ; GFX10-WGP-NEXT: s_endpgm
9239 ; GFX10-CU-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9240 ; GFX10-CU: ; %bb.0: ; %entry
9241 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9242 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9243 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9244 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9245 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9246 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9247 ; GFX10-CU-NEXT: s_endpgm
9249 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9250 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9251 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9252 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9253 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9254 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9255 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9256 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9257 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9258 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9259 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9260 ; SKIP-CACHE-INV-NEXT: s_endpgm
9262 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9263 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9264 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9265 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9266 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9267 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9268 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9269 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9271 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9272 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9273 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9274 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9275 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9276 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9277 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9278 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9280 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9281 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9282 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9283 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9284 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9285 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9286 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9287 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9289 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9290 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9291 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9292 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9293 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9294 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9295 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9296 ; GFX940-TGSPLIT-NEXT: s_endpgm
9298 ; GFX11-WGP-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9299 ; GFX11-WGP: ; %bb.0: ; %entry
9300 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9301 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9302 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9303 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9304 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9305 ; GFX11-WGP-NEXT: s_nop 0
9306 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9307 ; GFX11-WGP-NEXT: s_endpgm
9309 ; GFX11-CU-LABEL: global_singlethread_one_as_release_acquire_cmpxchg:
9310 ; GFX11-CU: ; %bb.0: ; %entry
9311 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9312 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9313 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9314 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9315 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9316 ; GFX11-CU-NEXT: s_nop 0
9317 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9318 ; GFX11-CU-NEXT: s_endpgm
9319 ptr addrspace(1) %out, i32 %in, i32 %old) {
9321 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9322 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release acquire
9326 define amdgpu_kernel void @global_singlethread_one_as_acq_rel_acquire_cmpxchg(
9327 ; GFX6-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9328 ; GFX6: ; %bb.0: ; %entry
9329 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9330 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9331 ; GFX6-NEXT: s_mov_b32 s6, -1
9332 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9333 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9334 ; GFX6-NEXT: s_mov_b32 s4, s0
9335 ; GFX6-NEXT: s_mov_b32 s5, s1
9336 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9337 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9338 ; GFX6-NEXT: s_endpgm
9340 ; GFX7-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9341 ; GFX7: ; %bb.0: ; %entry
9342 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9343 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9344 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9345 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9346 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9347 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9348 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9349 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9350 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9351 ; GFX7-NEXT: s_endpgm
9353 ; GFX10-WGP-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9354 ; GFX10-WGP: ; %bb.0: ; %entry
9355 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9356 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9357 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9358 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9359 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9360 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9361 ; GFX10-WGP-NEXT: s_endpgm
9363 ; GFX10-CU-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9364 ; GFX10-CU: ; %bb.0: ; %entry
9365 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9366 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9367 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9368 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9369 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9370 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9371 ; GFX10-CU-NEXT: s_endpgm
9373 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9374 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9375 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9376 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9377 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9378 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9379 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9380 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9381 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9382 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9383 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9384 ; SKIP-CACHE-INV-NEXT: s_endpgm
9386 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9387 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9388 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9389 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9390 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9391 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9392 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9393 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9395 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9396 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9397 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9398 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9399 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9400 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9401 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9402 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9404 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9405 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9406 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9407 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9408 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9409 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9410 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9411 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9413 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9414 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9415 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9416 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9417 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9418 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9419 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9420 ; GFX940-TGSPLIT-NEXT: s_endpgm
9422 ; GFX11-WGP-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9423 ; GFX11-WGP: ; %bb.0: ; %entry
9424 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9425 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9426 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9427 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9428 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9429 ; GFX11-WGP-NEXT: s_nop 0
9430 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9431 ; GFX11-WGP-NEXT: s_endpgm
9433 ; GFX11-CU-LABEL: global_singlethread_one_as_acq_rel_acquire_cmpxchg:
9434 ; GFX11-CU: ; %bb.0: ; %entry
9435 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9436 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9437 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9438 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9439 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9440 ; GFX11-CU-NEXT: s_nop 0
9441 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9442 ; GFX11-CU-NEXT: s_endpgm
9443 ptr addrspace(1) %out, i32 %in, i32 %old) {
9445 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9446 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel acquire
9450 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_acquire_cmpxchg(
9451 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9452 ; GFX6: ; %bb.0: ; %entry
9453 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9454 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9455 ; GFX6-NEXT: s_mov_b32 s6, -1
9456 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9457 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9458 ; GFX6-NEXT: s_mov_b32 s4, s0
9459 ; GFX6-NEXT: s_mov_b32 s5, s1
9460 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9461 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9462 ; GFX6-NEXT: s_endpgm
9464 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9465 ; GFX7: ; %bb.0: ; %entry
9466 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9467 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9468 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9469 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9470 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9471 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9472 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9473 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9474 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9475 ; GFX7-NEXT: s_endpgm
9477 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9478 ; GFX10-WGP: ; %bb.0: ; %entry
9479 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9480 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9481 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9482 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9483 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9484 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9485 ; GFX10-WGP-NEXT: s_endpgm
9487 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9488 ; GFX10-CU: ; %bb.0: ; %entry
9489 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9490 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9491 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9492 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9493 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9494 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9495 ; GFX10-CU-NEXT: s_endpgm
9497 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9498 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9499 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9500 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9501 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9502 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9503 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9504 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9505 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9506 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9507 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9508 ; SKIP-CACHE-INV-NEXT: s_endpgm
9510 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9511 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9512 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9513 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9514 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9515 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9516 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9517 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9519 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9520 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9521 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9522 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9523 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9524 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9525 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9526 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9528 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9529 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9530 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9531 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9532 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9533 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9534 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9535 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9537 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9538 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9539 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9540 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9541 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9542 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9543 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9544 ; GFX940-TGSPLIT-NEXT: s_endpgm
9546 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9547 ; GFX11-WGP: ; %bb.0: ; %entry
9548 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9549 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9550 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9551 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9552 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9553 ; GFX11-WGP-NEXT: s_nop 0
9554 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9555 ; GFX11-WGP-NEXT: s_endpgm
9557 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_acquire_cmpxchg:
9558 ; GFX11-CU: ; %bb.0: ; %entry
9559 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9560 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9561 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9562 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9563 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9564 ; GFX11-CU-NEXT: s_nop 0
9565 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9566 ; GFX11-CU-NEXT: s_endpgm
9567 ptr addrspace(1) %out, i32 %in, i32 %old) {
9569 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9570 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst acquire
9574 define amdgpu_kernel void @global_singlethread_one_as_monotonic_seq_cst_cmpxchg(
9575 ; GFX6-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9576 ; GFX6: ; %bb.0: ; %entry
9577 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9578 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9579 ; GFX6-NEXT: s_mov_b32 s6, -1
9580 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9581 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9582 ; GFX6-NEXT: s_mov_b32 s4, s0
9583 ; GFX6-NEXT: s_mov_b32 s5, s1
9584 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9585 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9586 ; GFX6-NEXT: s_endpgm
9588 ; GFX7-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9589 ; GFX7: ; %bb.0: ; %entry
9590 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9591 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9592 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9593 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9594 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9595 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9596 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9597 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9598 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9599 ; GFX7-NEXT: s_endpgm
9601 ; GFX10-WGP-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9602 ; GFX10-WGP: ; %bb.0: ; %entry
9603 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9604 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9605 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9606 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9607 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9608 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9609 ; GFX10-WGP-NEXT: s_endpgm
9611 ; GFX10-CU-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9612 ; GFX10-CU: ; %bb.0: ; %entry
9613 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9614 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9615 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9616 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9617 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9618 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9619 ; GFX10-CU-NEXT: s_endpgm
9621 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9622 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9623 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9624 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9625 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9626 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9627 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9628 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9629 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9630 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9631 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9632 ; SKIP-CACHE-INV-NEXT: s_endpgm
9634 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9635 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9636 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9637 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9638 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9639 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9640 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9641 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9643 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9644 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9645 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9646 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9647 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9648 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9649 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9650 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9652 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9653 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9654 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9655 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9656 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9657 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9658 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9659 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9661 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9662 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9663 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9664 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9665 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9666 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9667 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9668 ; GFX940-TGSPLIT-NEXT: s_endpgm
9670 ; GFX11-WGP-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9671 ; GFX11-WGP: ; %bb.0: ; %entry
9672 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9673 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9674 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9675 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9676 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9677 ; GFX11-WGP-NEXT: s_nop 0
9678 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9679 ; GFX11-WGP-NEXT: s_endpgm
9681 ; GFX11-CU-LABEL: global_singlethread_one_as_monotonic_seq_cst_cmpxchg:
9682 ; GFX11-CU: ; %bb.0: ; %entry
9683 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9684 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9685 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9686 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9687 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9688 ; GFX11-CU-NEXT: s_nop 0
9689 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9690 ; GFX11-CU-NEXT: s_endpgm
9691 ptr addrspace(1) %out, i32 %in, i32 %old) {
9693 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9694 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic seq_cst
9698 define amdgpu_kernel void @global_singlethread_one_as_acquire_seq_cst_cmpxchg(
9699 ; GFX6-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9700 ; GFX6: ; %bb.0: ; %entry
9701 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9702 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9703 ; GFX6-NEXT: s_mov_b32 s6, -1
9704 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9705 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9706 ; GFX6-NEXT: s_mov_b32 s4, s0
9707 ; GFX6-NEXT: s_mov_b32 s5, s1
9708 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9709 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9710 ; GFX6-NEXT: s_endpgm
9712 ; GFX7-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9713 ; GFX7: ; %bb.0: ; %entry
9714 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9715 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9716 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9717 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9718 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9719 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9720 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9721 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9722 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9723 ; GFX7-NEXT: s_endpgm
9725 ; GFX10-WGP-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9726 ; GFX10-WGP: ; %bb.0: ; %entry
9727 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9728 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9729 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9730 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9731 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9732 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9733 ; GFX10-WGP-NEXT: s_endpgm
9735 ; GFX10-CU-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9736 ; GFX10-CU: ; %bb.0: ; %entry
9737 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9738 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9739 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9740 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9741 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9742 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9743 ; GFX10-CU-NEXT: s_endpgm
9745 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9746 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9747 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9748 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9749 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9750 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9751 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9752 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9753 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9754 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9755 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9756 ; SKIP-CACHE-INV-NEXT: s_endpgm
9758 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9759 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9760 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9761 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9762 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9763 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9764 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9765 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9767 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9768 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9769 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9770 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9771 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9772 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9773 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9774 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9776 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9777 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9778 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9779 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9780 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9781 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9782 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9783 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9785 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9786 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9787 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9788 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9789 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9790 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9791 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9792 ; GFX940-TGSPLIT-NEXT: s_endpgm
9794 ; GFX11-WGP-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9795 ; GFX11-WGP: ; %bb.0: ; %entry
9796 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9797 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9798 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9799 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9800 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9801 ; GFX11-WGP-NEXT: s_nop 0
9802 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9803 ; GFX11-WGP-NEXT: s_endpgm
9805 ; GFX11-CU-LABEL: global_singlethread_one_as_acquire_seq_cst_cmpxchg:
9806 ; GFX11-CU: ; %bb.0: ; %entry
9807 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9808 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9809 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9810 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9811 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9812 ; GFX11-CU-NEXT: s_nop 0
9813 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9814 ; GFX11-CU-NEXT: s_endpgm
9815 ptr addrspace(1) %out, i32 %in, i32 %old) {
9817 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9818 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire seq_cst
9822 define amdgpu_kernel void @global_singlethread_one_as_release_seq_cst_cmpxchg(
9823 ; GFX6-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9824 ; GFX6: ; %bb.0: ; %entry
9825 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9826 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9827 ; GFX6-NEXT: s_mov_b32 s6, -1
9828 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9829 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9830 ; GFX6-NEXT: s_mov_b32 s4, s0
9831 ; GFX6-NEXT: s_mov_b32 s5, s1
9832 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9833 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9834 ; GFX6-NEXT: s_endpgm
9836 ; GFX7-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9837 ; GFX7: ; %bb.0: ; %entry
9838 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9839 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9840 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9841 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9842 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9843 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9844 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9845 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9846 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9847 ; GFX7-NEXT: s_endpgm
9849 ; GFX10-WGP-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9850 ; GFX10-WGP: ; %bb.0: ; %entry
9851 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9852 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9853 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9854 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9855 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9856 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9857 ; GFX10-WGP-NEXT: s_endpgm
9859 ; GFX10-CU-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9860 ; GFX10-CU: ; %bb.0: ; %entry
9861 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9862 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9863 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9864 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9865 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9866 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9867 ; GFX10-CU-NEXT: s_endpgm
9869 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9870 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9871 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9872 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9873 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9874 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9875 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9876 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9877 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9878 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9879 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9880 ; SKIP-CACHE-INV-NEXT: s_endpgm
9882 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9883 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9884 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9885 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9886 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9887 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9888 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9889 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9891 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9892 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9893 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9894 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9895 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9896 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9897 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9898 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9900 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9901 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9902 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9903 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9904 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9905 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9906 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9907 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9909 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9910 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9911 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9912 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9913 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9914 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9915 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9916 ; GFX940-TGSPLIT-NEXT: s_endpgm
9918 ; GFX11-WGP-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9919 ; GFX11-WGP: ; %bb.0: ; %entry
9920 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9921 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9922 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9923 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9924 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9925 ; GFX11-WGP-NEXT: s_nop 0
9926 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9927 ; GFX11-WGP-NEXT: s_endpgm
9929 ; GFX11-CU-LABEL: global_singlethread_one_as_release_seq_cst_cmpxchg:
9930 ; GFX11-CU: ; %bb.0: ; %entry
9931 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9932 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9933 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9934 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9935 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9936 ; GFX11-CU-NEXT: s_nop 0
9937 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9938 ; GFX11-CU-NEXT: s_endpgm
9939 ptr addrspace(1) %out, i32 %in, i32 %old) {
9941 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
9942 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release seq_cst
9946 define amdgpu_kernel void @global_singlethread_one_as_acq_rel_seq_cst_cmpxchg(
9947 ; GFX6-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
9948 ; GFX6: ; %bb.0: ; %entry
9949 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9950 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9951 ; GFX6-NEXT: s_mov_b32 s6, -1
9952 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9953 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9954 ; GFX6-NEXT: s_mov_b32 s4, s0
9955 ; GFX6-NEXT: s_mov_b32 s5, s1
9956 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9957 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9958 ; GFX6-NEXT: s_endpgm
9960 ; GFX7-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
9961 ; GFX7: ; %bb.0: ; %entry
9962 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9963 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9964 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9965 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9966 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9967 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9968 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9969 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9970 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9971 ; GFX7-NEXT: s_endpgm
9973 ; GFX10-WGP-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
9974 ; GFX10-WGP: ; %bb.0: ; %entry
9975 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9976 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9977 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9978 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9979 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9980 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9981 ; GFX10-WGP-NEXT: s_endpgm
9983 ; GFX10-CU-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
9984 ; GFX10-CU: ; %bb.0: ; %entry
9985 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9986 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9987 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9988 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9989 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9990 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9991 ; GFX10-CU-NEXT: s_endpgm
9993 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
9994 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9995 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9996 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9997 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9998 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9999 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10000 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10001 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10002 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10003 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10004 ; SKIP-CACHE-INV-NEXT: s_endpgm
10006 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
10007 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10008 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10009 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10010 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10011 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10012 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10013 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10015 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
10016 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10017 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10018 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10019 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10020 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10021 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10022 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10024 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
10025 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10026 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10027 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10028 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10029 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10030 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10031 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10033 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
10034 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10035 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10036 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10037 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10038 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10039 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10040 ; GFX940-TGSPLIT-NEXT: s_endpgm
10042 ; GFX11-WGP-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
10043 ; GFX11-WGP: ; %bb.0: ; %entry
10044 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10045 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10046 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10047 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10048 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10049 ; GFX11-WGP-NEXT: s_nop 0
10050 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10051 ; GFX11-WGP-NEXT: s_endpgm
10053 ; GFX11-CU-LABEL: global_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
10054 ; GFX11-CU: ; %bb.0: ; %entry
10055 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10056 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10057 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10058 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10059 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10060 ; GFX11-CU-NEXT: s_nop 0
10061 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10062 ; GFX11-CU-NEXT: s_endpgm
10063 ptr addrspace(1) %out, i32 %in, i32 %old) {
10065 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
10066 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel seq_cst
10070 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_seq_cst_cmpxchg(
10071 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10072 ; GFX6: ; %bb.0: ; %entry
10073 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10074 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10075 ; GFX6-NEXT: s_mov_b32 s6, -1
10076 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10077 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10078 ; GFX6-NEXT: s_mov_b32 s4, s0
10079 ; GFX6-NEXT: s_mov_b32 s5, s1
10080 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10081 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10082 ; GFX6-NEXT: s_endpgm
10084 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10085 ; GFX7: ; %bb.0: ; %entry
10086 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10087 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10088 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10089 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10090 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10091 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10092 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10093 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10094 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10095 ; GFX7-NEXT: s_endpgm
10097 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10098 ; GFX10-WGP: ; %bb.0: ; %entry
10099 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10100 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10101 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10102 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10103 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10104 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10105 ; GFX10-WGP-NEXT: s_endpgm
10107 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10108 ; GFX10-CU: ; %bb.0: ; %entry
10109 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10110 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10111 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10112 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10113 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10114 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10115 ; GFX10-CU-NEXT: s_endpgm
10117 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10118 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10119 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10120 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10121 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10122 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10123 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10124 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10125 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10126 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10127 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10128 ; SKIP-CACHE-INV-NEXT: s_endpgm
10130 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10131 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10132 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10133 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10134 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10135 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10136 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10137 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10139 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10140 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10141 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10142 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10143 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10144 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10145 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10146 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10148 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10149 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10150 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10151 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10152 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10153 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10154 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10155 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10157 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10158 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10159 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10160 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10161 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10162 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10163 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10164 ; GFX940-TGSPLIT-NEXT: s_endpgm
10166 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10167 ; GFX11-WGP: ; %bb.0: ; %entry
10168 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10169 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10170 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10171 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10172 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10173 ; GFX11-WGP-NEXT: s_nop 0
10174 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10175 ; GFX11-WGP-NEXT: s_endpgm
10177 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
10178 ; GFX11-CU: ; %bb.0: ; %entry
10179 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10180 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10181 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10182 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10183 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10184 ; GFX11-CU-NEXT: s_nop 0
10185 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10186 ; GFX11-CU-NEXT: s_endpgm
10187 ptr addrspace(1) %out, i32 %in, i32 %old) {
10189 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
10190 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst seq_cst
10194 define amdgpu_kernel void @global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg(
10195 ; GFX6-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10196 ; GFX6: ; %bb.0: ; %entry
10197 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10198 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10199 ; GFX6-NEXT: s_mov_b32 s6, -1
10200 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10201 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10202 ; GFX6-NEXT: s_mov_b32 s4, s0
10203 ; GFX6-NEXT: s_mov_b32 s5, s1
10204 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10205 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10206 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10207 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10208 ; GFX6-NEXT: s_endpgm
10210 ; GFX7-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10211 ; GFX7: ; %bb.0: ; %entry
10212 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10213 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10214 ; GFX7-NEXT: s_add_u32 s4, s0, 16
10215 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
10216 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10217 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10218 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10219 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10220 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
10221 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10222 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10223 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10224 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10225 ; GFX7-NEXT: s_endpgm
10227 ; GFX10-WGP-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10228 ; GFX10-WGP: ; %bb.0: ; %entry
10229 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10230 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10231 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10232 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10233 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10234 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10235 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10236 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
10237 ; GFX10-WGP-NEXT: s_endpgm
10239 ; GFX10-CU-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10240 ; GFX10-CU: ; %bb.0: ; %entry
10241 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10242 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10243 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10244 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10245 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10246 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10247 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10248 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
10249 ; GFX10-CU-NEXT: s_endpgm
10251 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10252 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10253 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10254 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10255 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10256 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10257 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10258 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10259 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10260 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10261 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10262 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10263 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
10264 ; SKIP-CACHE-INV-NEXT: s_endpgm
10266 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10267 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10268 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10269 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10270 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10271 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10272 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10273 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10274 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10275 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10277 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10278 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10279 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10280 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10281 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10282 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10283 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10284 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10285 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10286 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10288 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10289 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10290 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10291 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10292 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10293 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10294 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10295 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10296 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10297 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10299 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10300 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10301 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10302 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10303 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10304 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10305 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10306 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10307 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10308 ; GFX940-TGSPLIT-NEXT: s_endpgm
10310 ; GFX11-WGP-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10311 ; GFX11-WGP: ; %bb.0: ; %entry
10312 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10313 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10314 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10315 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10316 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10317 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10318 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
10319 ; GFX11-WGP-NEXT: s_nop 0
10320 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10321 ; GFX11-WGP-NEXT: s_endpgm
10323 ; GFX11-CU-LABEL: global_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
10324 ; GFX11-CU: ; %bb.0: ; %entry
10325 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10326 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10327 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10328 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10329 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10330 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10331 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
10332 ; GFX11-CU-NEXT: s_nop 0
10333 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10334 ; GFX11-CU-NEXT: s_endpgm
10335 ptr addrspace(1) %out, i32 %in, i32 %old) {
10337 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
10338 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic monotonic
10339 %val0 = extractvalue { i32, i1 } %val, 0
10340 store i32 %val0, ptr addrspace(1) %out, align 4
10344 define amdgpu_kernel void @global_singlethread_one_as_acquire_monotonic_ret_cmpxchg(
10345 ; GFX6-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10346 ; GFX6: ; %bb.0: ; %entry
10347 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10348 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10349 ; GFX6-NEXT: s_mov_b32 s6, -1
10350 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10351 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10352 ; GFX6-NEXT: s_mov_b32 s4, s0
10353 ; GFX6-NEXT: s_mov_b32 s5, s1
10354 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10355 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10356 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10357 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10358 ; GFX6-NEXT: s_endpgm
10360 ; GFX7-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10361 ; GFX7: ; %bb.0: ; %entry
10362 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10363 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10364 ; GFX7-NEXT: s_add_u32 s4, s0, 16
10365 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
10366 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10367 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10368 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10369 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10370 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
10371 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10372 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10373 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10374 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10375 ; GFX7-NEXT: s_endpgm
10377 ; GFX10-WGP-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10378 ; GFX10-WGP: ; %bb.0: ; %entry
10379 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10380 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10381 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10382 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10383 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10384 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10385 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10386 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
10387 ; GFX10-WGP-NEXT: s_endpgm
10389 ; GFX10-CU-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10390 ; GFX10-CU: ; %bb.0: ; %entry
10391 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10392 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10393 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10394 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10395 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10396 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10397 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10398 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
10399 ; GFX10-CU-NEXT: s_endpgm
10401 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10402 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10403 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10404 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10405 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10406 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10407 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10408 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10409 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10410 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10411 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10412 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10413 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
10414 ; SKIP-CACHE-INV-NEXT: s_endpgm
10416 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10417 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10418 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10419 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10420 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10421 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10422 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10423 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10424 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10425 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10427 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10428 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10429 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10430 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10431 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10432 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10433 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10434 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10435 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10436 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10438 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10439 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10440 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10441 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10442 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10443 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10444 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10445 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10446 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10447 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10449 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10450 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10451 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10452 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10453 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10454 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10455 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10456 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10457 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10458 ; GFX940-TGSPLIT-NEXT: s_endpgm
10460 ; GFX11-WGP-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10461 ; GFX11-WGP: ; %bb.0: ; %entry
10462 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10463 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10464 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10465 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10466 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10467 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10468 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
10469 ; GFX11-WGP-NEXT: s_nop 0
10470 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10471 ; GFX11-WGP-NEXT: s_endpgm
10473 ; GFX11-CU-LABEL: global_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
10474 ; GFX11-CU: ; %bb.0: ; %entry
10475 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10476 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10477 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10478 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10479 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10480 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10481 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
10482 ; GFX11-CU-NEXT: s_nop 0
10483 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10484 ; GFX11-CU-NEXT: s_endpgm
10485 ptr addrspace(1) %out, i32 %in, i32 %old) {
10487 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
10488 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire monotonic
10489 %val0 = extractvalue { i32, i1 } %val, 0
10490 store i32 %val0, ptr addrspace(1) %out, align 4
10494 define amdgpu_kernel void @global_singlethread_one_as_release_monotonic_ret_cmpxchg(
10495 ; GFX6-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10496 ; GFX6: ; %bb.0: ; %entry
10497 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10498 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10499 ; GFX6-NEXT: s_mov_b32 s6, -1
10500 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10501 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10502 ; GFX6-NEXT: s_mov_b32 s4, s0
10503 ; GFX6-NEXT: s_mov_b32 s5, s1
10504 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10505 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10506 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10507 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10508 ; GFX6-NEXT: s_endpgm
10510 ; GFX7-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10511 ; GFX7: ; %bb.0: ; %entry
10512 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10513 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10514 ; GFX7-NEXT: s_add_u32 s4, s0, 16
10515 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
10516 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10517 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10518 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10519 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10520 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
10521 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10522 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10523 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10524 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10525 ; GFX7-NEXT: s_endpgm
10527 ; GFX10-WGP-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10528 ; GFX10-WGP: ; %bb.0: ; %entry
10529 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10530 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10531 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10532 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10533 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10534 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10535 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10536 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
10537 ; GFX10-WGP-NEXT: s_endpgm
10539 ; GFX10-CU-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10540 ; GFX10-CU: ; %bb.0: ; %entry
10541 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10542 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10543 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10544 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10545 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10546 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10547 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10548 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
10549 ; GFX10-CU-NEXT: s_endpgm
10551 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10552 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10553 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10554 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10555 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10556 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10557 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10558 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10559 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10560 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10561 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10562 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10563 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
10564 ; SKIP-CACHE-INV-NEXT: s_endpgm
10566 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10567 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10568 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10569 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10570 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10571 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10572 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10573 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10574 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10575 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10577 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10578 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10579 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10580 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10581 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10582 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10583 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10584 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10585 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10586 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10588 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10589 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10590 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10591 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10592 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10593 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10594 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10595 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10596 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10597 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10599 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10600 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10601 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10602 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10603 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10604 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10605 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10606 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10607 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10608 ; GFX940-TGSPLIT-NEXT: s_endpgm
10610 ; GFX11-WGP-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10611 ; GFX11-WGP: ; %bb.0: ; %entry
10612 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10613 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10614 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10615 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10616 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10617 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10618 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
10619 ; GFX11-WGP-NEXT: s_nop 0
10620 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10621 ; GFX11-WGP-NEXT: s_endpgm
10623 ; GFX11-CU-LABEL: global_singlethread_one_as_release_monotonic_ret_cmpxchg:
10624 ; GFX11-CU: ; %bb.0: ; %entry
10625 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10626 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10627 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10628 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10629 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10630 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10631 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
10632 ; GFX11-CU-NEXT: s_nop 0
10633 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10634 ; GFX11-CU-NEXT: s_endpgm
10635 ptr addrspace(1) %out, i32 %in, i32 %old) {
10637 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
10638 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release monotonic
10639 %val0 = extractvalue { i32, i1 } %val, 0
10640 store i32 %val0, ptr addrspace(1) %out, align 4
10644 define amdgpu_kernel void @global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg(
10645 ; GFX6-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10646 ; GFX6: ; %bb.0: ; %entry
10647 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10648 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10649 ; GFX6-NEXT: s_mov_b32 s6, -1
10650 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10651 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10652 ; GFX6-NEXT: s_mov_b32 s4, s0
10653 ; GFX6-NEXT: s_mov_b32 s5, s1
10654 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10655 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10656 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10657 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10658 ; GFX6-NEXT: s_endpgm
10660 ; GFX7-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10661 ; GFX7: ; %bb.0: ; %entry
10662 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10663 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10664 ; GFX7-NEXT: s_add_u32 s4, s0, 16
10665 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
10666 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10667 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10668 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10669 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10670 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
10671 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10672 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10673 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10674 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10675 ; GFX7-NEXT: s_endpgm
10677 ; GFX10-WGP-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10678 ; GFX10-WGP: ; %bb.0: ; %entry
10679 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10680 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10681 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10682 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10683 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10684 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10685 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10686 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
10687 ; GFX10-WGP-NEXT: s_endpgm
10689 ; GFX10-CU-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10690 ; GFX10-CU: ; %bb.0: ; %entry
10691 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10692 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10693 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10694 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10695 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10696 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10697 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10698 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
10699 ; GFX10-CU-NEXT: s_endpgm
10701 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10702 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10703 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10704 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10705 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10706 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10707 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10708 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10709 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10710 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10711 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10712 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10713 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
10714 ; SKIP-CACHE-INV-NEXT: s_endpgm
10716 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10717 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10718 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10719 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10720 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10721 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10722 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10723 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10724 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10725 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10727 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10728 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10729 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10730 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10731 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10732 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10733 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10734 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10735 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10736 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10738 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10739 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10740 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10741 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10742 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10743 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10744 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10745 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10746 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10747 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10749 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10750 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10751 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10752 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10753 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10754 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10755 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10756 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10757 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10758 ; GFX940-TGSPLIT-NEXT: s_endpgm
10760 ; GFX11-WGP-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10761 ; GFX11-WGP: ; %bb.0: ; %entry
10762 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10763 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10764 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10765 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10766 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10767 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10768 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
10769 ; GFX11-WGP-NEXT: s_nop 0
10770 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10771 ; GFX11-WGP-NEXT: s_endpgm
10773 ; GFX11-CU-LABEL: global_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
10774 ; GFX11-CU: ; %bb.0: ; %entry
10775 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10776 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10777 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10778 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10779 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10780 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10781 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
10782 ; GFX11-CU-NEXT: s_nop 0
10783 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10784 ; GFX11-CU-NEXT: s_endpgm
10785 ptr addrspace(1) %out, i32 %in, i32 %old) {
10787 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
10788 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel monotonic
10789 %val0 = extractvalue { i32, i1 } %val, 0
10790 store i32 %val0, ptr addrspace(1) %out, align 4
10794 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg(
10795 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10796 ; GFX6: ; %bb.0: ; %entry
10797 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10798 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10799 ; GFX6-NEXT: s_mov_b32 s6, -1
10800 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10801 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10802 ; GFX6-NEXT: s_mov_b32 s4, s0
10803 ; GFX6-NEXT: s_mov_b32 s5, s1
10804 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10805 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10806 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10807 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10808 ; GFX6-NEXT: s_endpgm
10810 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10811 ; GFX7: ; %bb.0: ; %entry
10812 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10813 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10814 ; GFX7-NEXT: s_add_u32 s4, s0, 16
10815 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
10816 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10817 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10818 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10819 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10820 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
10821 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10822 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10823 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10824 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10825 ; GFX7-NEXT: s_endpgm
10827 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10828 ; GFX10-WGP: ; %bb.0: ; %entry
10829 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10830 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10831 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10832 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10833 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10834 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10835 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10836 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
10837 ; GFX10-WGP-NEXT: s_endpgm
10839 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10840 ; GFX10-CU: ; %bb.0: ; %entry
10841 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10842 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10843 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10844 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10845 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10846 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10847 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10848 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
10849 ; GFX10-CU-NEXT: s_endpgm
10851 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10852 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10853 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10854 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10855 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10856 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10857 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10858 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10859 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10860 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10861 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10862 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10863 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
10864 ; SKIP-CACHE-INV-NEXT: s_endpgm
10866 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10867 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10868 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10869 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10870 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10871 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10872 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10873 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10874 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10875 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10877 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10878 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10879 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10880 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10881 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10882 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10883 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10884 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10885 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
10886 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10888 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10889 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10890 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10891 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10892 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10893 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10894 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10895 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10896 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10897 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10899 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10900 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10901 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10902 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10903 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10904 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10905 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
10906 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10907 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
10908 ; GFX940-TGSPLIT-NEXT: s_endpgm
10910 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10911 ; GFX11-WGP: ; %bb.0: ; %entry
10912 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10913 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10914 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10915 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10916 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10917 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10918 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
10919 ; GFX11-WGP-NEXT: s_nop 0
10920 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10921 ; GFX11-WGP-NEXT: s_endpgm
10923 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
10924 ; GFX11-CU: ; %bb.0: ; %entry
10925 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10926 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10927 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10928 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10929 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
10930 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10931 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
10932 ; GFX11-CU-NEXT: s_nop 0
10933 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
10934 ; GFX11-CU-NEXT: s_endpgm
10935 ptr addrspace(1) %out, i32 %in, i32 %old) {
10937 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
10938 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst monotonic
10939 %val0 = extractvalue { i32, i1 } %val, 0
10940 store i32 %val0, ptr addrspace(1) %out, align 4
10944 define amdgpu_kernel void @global_singlethread_one_as_monotonic_acquire_ret_cmpxchg(
10945 ; GFX6-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
10946 ; GFX6: ; %bb.0: ; %entry
10947 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10948 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10949 ; GFX6-NEXT: s_mov_b32 s6, -1
10950 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10951 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10952 ; GFX6-NEXT: s_mov_b32 s4, s0
10953 ; GFX6-NEXT: s_mov_b32 s5, s1
10954 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10955 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
10956 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10957 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
10958 ; GFX6-NEXT: s_endpgm
10960 ; GFX7-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
10961 ; GFX7: ; %bb.0: ; %entry
10962 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10963 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10964 ; GFX7-NEXT: s_add_u32 s4, s0, 16
10965 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
10966 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10967 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10968 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10969 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10970 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
10971 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10972 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10973 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10974 ; GFX7-NEXT: flat_store_dword v[0:1], v2
10975 ; GFX7-NEXT: s_endpgm
10977 ; GFX10-WGP-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
10978 ; GFX10-WGP: ; %bb.0: ; %entry
10979 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10980 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10981 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10982 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10983 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10984 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10985 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10986 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
10987 ; GFX10-WGP-NEXT: s_endpgm
10989 ; GFX10-CU-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
10990 ; GFX10-CU: ; %bb.0: ; %entry
10991 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10992 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10993 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10994 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10995 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10996 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
10997 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10998 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
10999 ; GFX10-CU-NEXT: s_endpgm
11001 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
11002 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11003 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11004 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11005 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11006 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11007 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11008 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11009 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11010 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11011 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11012 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11013 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11014 ; SKIP-CACHE-INV-NEXT: s_endpgm
11016 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
11017 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11018 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11019 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11020 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11021 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11022 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11023 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11024 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11025 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11027 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
11028 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11029 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11030 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11031 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11032 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11033 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11034 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11035 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11036 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11038 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
11039 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11040 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11041 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11042 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11043 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11044 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11045 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11046 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11047 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11049 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
11050 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11051 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11052 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11053 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11054 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11055 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11056 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11057 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11058 ; GFX940-TGSPLIT-NEXT: s_endpgm
11060 ; GFX11-WGP-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
11061 ; GFX11-WGP: ; %bb.0: ; %entry
11062 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11063 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11064 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11065 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11066 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11067 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11068 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11069 ; GFX11-WGP-NEXT: s_nop 0
11070 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11071 ; GFX11-WGP-NEXT: s_endpgm
11073 ; GFX11-CU-LABEL: global_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
11074 ; GFX11-CU: ; %bb.0: ; %entry
11075 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11076 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11077 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11078 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11079 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11080 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11081 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11082 ; GFX11-CU-NEXT: s_nop 0
11083 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11084 ; GFX11-CU-NEXT: s_endpgm
11085 ptr addrspace(1) %out, i32 %in, i32 %old) {
11087 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
11088 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic acquire
11089 %val0 = extractvalue { i32, i1 } %val, 0
11090 store i32 %val0, ptr addrspace(1) %out, align 4
11094 define amdgpu_kernel void @global_singlethread_one_as_acquire_acquire_ret_cmpxchg(
11095 ; GFX6-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11096 ; GFX6: ; %bb.0: ; %entry
11097 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11098 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11099 ; GFX6-NEXT: s_mov_b32 s6, -1
11100 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11101 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11102 ; GFX6-NEXT: s_mov_b32 s4, s0
11103 ; GFX6-NEXT: s_mov_b32 s5, s1
11104 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11105 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11106 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11107 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11108 ; GFX6-NEXT: s_endpgm
11110 ; GFX7-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11111 ; GFX7: ; %bb.0: ; %entry
11112 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11113 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11114 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11115 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11116 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11117 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11118 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11119 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11120 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11121 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11122 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11123 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11124 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11125 ; GFX7-NEXT: s_endpgm
11127 ; GFX10-WGP-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11128 ; GFX10-WGP: ; %bb.0: ; %entry
11129 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11130 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11131 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11132 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11133 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11134 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11135 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11136 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11137 ; GFX10-WGP-NEXT: s_endpgm
11139 ; GFX10-CU-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11140 ; GFX10-CU: ; %bb.0: ; %entry
11141 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11142 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11143 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11144 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11145 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11146 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11147 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11148 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11149 ; GFX10-CU-NEXT: s_endpgm
11151 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11152 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11153 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11154 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11155 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11156 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11157 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11158 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11159 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11160 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11161 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11162 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11163 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11164 ; SKIP-CACHE-INV-NEXT: s_endpgm
11166 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11167 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11168 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11169 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11170 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11171 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11172 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11173 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11174 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11175 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11177 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11178 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11179 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11180 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11181 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11182 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11183 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11184 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11185 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11186 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11188 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11189 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11190 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11191 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11192 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11193 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11194 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11195 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11196 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11197 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11199 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11200 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11201 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11202 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11203 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11204 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11205 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11206 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11207 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11208 ; GFX940-TGSPLIT-NEXT: s_endpgm
11210 ; GFX11-WGP-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11211 ; GFX11-WGP: ; %bb.0: ; %entry
11212 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11213 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11214 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11215 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11216 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11217 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11218 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11219 ; GFX11-WGP-NEXT: s_nop 0
11220 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11221 ; GFX11-WGP-NEXT: s_endpgm
11223 ; GFX11-CU-LABEL: global_singlethread_one_as_acquire_acquire_ret_cmpxchg:
11224 ; GFX11-CU: ; %bb.0: ; %entry
11225 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11226 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11227 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11228 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11229 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11230 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11231 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11232 ; GFX11-CU-NEXT: s_nop 0
11233 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11234 ; GFX11-CU-NEXT: s_endpgm
11235 ptr addrspace(1) %out, i32 %in, i32 %old) {
11237 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
11238 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire acquire
11239 %val0 = extractvalue { i32, i1 } %val, 0
11240 store i32 %val0, ptr addrspace(1) %out, align 4
11244 define amdgpu_kernel void @global_singlethread_one_as_release_acquire_ret_cmpxchg(
11245 ; GFX6-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11246 ; GFX6: ; %bb.0: ; %entry
11247 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11248 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11249 ; GFX6-NEXT: s_mov_b32 s6, -1
11250 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11251 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11252 ; GFX6-NEXT: s_mov_b32 s4, s0
11253 ; GFX6-NEXT: s_mov_b32 s5, s1
11254 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11255 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11256 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11257 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11258 ; GFX6-NEXT: s_endpgm
11260 ; GFX7-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11261 ; GFX7: ; %bb.0: ; %entry
11262 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11263 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11264 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11265 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11266 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11267 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11268 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11269 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11270 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11271 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11272 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11273 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11274 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11275 ; GFX7-NEXT: s_endpgm
11277 ; GFX10-WGP-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11278 ; GFX10-WGP: ; %bb.0: ; %entry
11279 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11280 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11281 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11282 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11283 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11284 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11285 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11286 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11287 ; GFX10-WGP-NEXT: s_endpgm
11289 ; GFX10-CU-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11290 ; GFX10-CU: ; %bb.0: ; %entry
11291 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11292 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11293 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11294 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11295 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11296 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11297 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11298 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11299 ; GFX10-CU-NEXT: s_endpgm
11301 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11302 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11303 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11304 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11305 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11306 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11307 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11308 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11309 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11310 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11311 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11312 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11313 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11314 ; SKIP-CACHE-INV-NEXT: s_endpgm
11316 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11317 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11318 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11319 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11320 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11321 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11322 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11323 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11324 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11325 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11327 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11328 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11329 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11330 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11331 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11332 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11333 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11334 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11335 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11336 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11338 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11339 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11340 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11341 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11342 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11343 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11344 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11345 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11346 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11347 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11349 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11350 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11351 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11352 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11353 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11354 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11355 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11356 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11357 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11358 ; GFX940-TGSPLIT-NEXT: s_endpgm
11360 ; GFX11-WGP-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11361 ; GFX11-WGP: ; %bb.0: ; %entry
11362 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11363 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11364 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11365 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11366 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11367 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11368 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11369 ; GFX11-WGP-NEXT: s_nop 0
11370 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11371 ; GFX11-WGP-NEXT: s_endpgm
11373 ; GFX11-CU-LABEL: global_singlethread_one_as_release_acquire_ret_cmpxchg:
11374 ; GFX11-CU: ; %bb.0: ; %entry
11375 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11376 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11377 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11378 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11379 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11380 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11381 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11382 ; GFX11-CU-NEXT: s_nop 0
11383 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11384 ; GFX11-CU-NEXT: s_endpgm
11385 ptr addrspace(1) %out, i32 %in, i32 %old) {
11387 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
11388 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release acquire
11389 %val0 = extractvalue { i32, i1 } %val, 0
11390 store i32 %val0, ptr addrspace(1) %out, align 4
11394 define amdgpu_kernel void @global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg(
11395 ; GFX6-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11396 ; GFX6: ; %bb.0: ; %entry
11397 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11398 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11399 ; GFX6-NEXT: s_mov_b32 s6, -1
11400 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11401 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11402 ; GFX6-NEXT: s_mov_b32 s4, s0
11403 ; GFX6-NEXT: s_mov_b32 s5, s1
11404 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11405 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11406 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11407 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11408 ; GFX6-NEXT: s_endpgm
11410 ; GFX7-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11411 ; GFX7: ; %bb.0: ; %entry
11412 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11413 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11414 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11415 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11416 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11417 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11418 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11419 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11420 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11421 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11422 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11423 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11424 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11425 ; GFX7-NEXT: s_endpgm
11427 ; GFX10-WGP-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11428 ; GFX10-WGP: ; %bb.0: ; %entry
11429 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11430 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11431 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11432 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11433 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11434 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11435 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11436 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11437 ; GFX10-WGP-NEXT: s_endpgm
11439 ; GFX10-CU-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11440 ; GFX10-CU: ; %bb.0: ; %entry
11441 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11442 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11443 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11444 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11445 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11446 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11447 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11448 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11449 ; GFX10-CU-NEXT: s_endpgm
11451 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11452 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11453 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11454 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11455 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11456 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11457 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11458 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11459 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11460 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11461 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11462 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11463 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11464 ; SKIP-CACHE-INV-NEXT: s_endpgm
11466 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11467 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11468 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11469 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11470 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11471 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11472 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11473 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11474 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11475 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11477 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11478 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11479 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11480 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11481 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11482 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11483 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11484 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11485 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11486 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11488 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11489 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11490 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11491 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11492 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11493 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11494 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11495 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11496 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11497 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11499 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11500 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11501 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11502 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11503 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11504 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11505 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11506 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11507 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11508 ; GFX940-TGSPLIT-NEXT: s_endpgm
11510 ; GFX11-WGP-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11511 ; GFX11-WGP: ; %bb.0: ; %entry
11512 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11513 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11514 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11515 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11516 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11517 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11518 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11519 ; GFX11-WGP-NEXT: s_nop 0
11520 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11521 ; GFX11-WGP-NEXT: s_endpgm
11523 ; GFX11-CU-LABEL: global_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
11524 ; GFX11-CU: ; %bb.0: ; %entry
11525 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11526 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11527 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11528 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11529 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11530 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11531 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11532 ; GFX11-CU-NEXT: s_nop 0
11533 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11534 ; GFX11-CU-NEXT: s_endpgm
11535 ptr addrspace(1) %out, i32 %in, i32 %old) {
11537 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
11538 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel acquire
11539 %val0 = extractvalue { i32, i1 } %val, 0
11540 store i32 %val0, ptr addrspace(1) %out, align 4
11544 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg(
11545 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11546 ; GFX6: ; %bb.0: ; %entry
11547 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11548 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11549 ; GFX6-NEXT: s_mov_b32 s6, -1
11550 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11551 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11552 ; GFX6-NEXT: s_mov_b32 s4, s0
11553 ; GFX6-NEXT: s_mov_b32 s5, s1
11554 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11555 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11556 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11557 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11558 ; GFX6-NEXT: s_endpgm
11560 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11561 ; GFX7: ; %bb.0: ; %entry
11562 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11563 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11564 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11565 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11566 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11567 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11568 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11569 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11570 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11571 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11572 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11573 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11574 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11575 ; GFX7-NEXT: s_endpgm
11577 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11578 ; GFX10-WGP: ; %bb.0: ; %entry
11579 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11580 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11581 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11582 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11583 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11584 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11585 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11586 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11587 ; GFX10-WGP-NEXT: s_endpgm
11589 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11590 ; GFX10-CU: ; %bb.0: ; %entry
11591 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11592 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11593 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11594 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11595 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11596 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11597 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11598 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11599 ; GFX10-CU-NEXT: s_endpgm
11601 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11602 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11603 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11604 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11605 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11606 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11607 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11608 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11609 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11610 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11611 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11612 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11613 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11614 ; SKIP-CACHE-INV-NEXT: s_endpgm
11616 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11617 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11618 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11619 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11620 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11621 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11622 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11623 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11624 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11625 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11627 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11628 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11629 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11630 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11631 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11632 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11633 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11634 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11635 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11636 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11638 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11639 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11640 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11641 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11642 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11643 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11644 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11645 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11646 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11647 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11649 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11650 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11651 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11652 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11653 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11654 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11655 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11656 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11657 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11658 ; GFX940-TGSPLIT-NEXT: s_endpgm
11660 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11661 ; GFX11-WGP: ; %bb.0: ; %entry
11662 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11663 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11664 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11665 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11666 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11667 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11668 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11669 ; GFX11-WGP-NEXT: s_nop 0
11670 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11671 ; GFX11-WGP-NEXT: s_endpgm
11673 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
11674 ; GFX11-CU: ; %bb.0: ; %entry
11675 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11676 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11677 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11678 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11679 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11680 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11681 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11682 ; GFX11-CU-NEXT: s_nop 0
11683 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11684 ; GFX11-CU-NEXT: s_endpgm
11685 ptr addrspace(1) %out, i32 %in, i32 %old) {
11687 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
11688 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst acquire
11689 %val0 = extractvalue { i32, i1 } %val, 0
11690 store i32 %val0, ptr addrspace(1) %out, align 4
11694 define amdgpu_kernel void @global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg(
11695 ; GFX6-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11696 ; GFX6: ; %bb.0: ; %entry
11697 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11698 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11699 ; GFX6-NEXT: s_mov_b32 s6, -1
11700 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11701 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11702 ; GFX6-NEXT: s_mov_b32 s4, s0
11703 ; GFX6-NEXT: s_mov_b32 s5, s1
11704 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11705 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11706 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11707 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11708 ; GFX6-NEXT: s_endpgm
11710 ; GFX7-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11711 ; GFX7: ; %bb.0: ; %entry
11712 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11713 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11714 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11715 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11716 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11717 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11718 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11719 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11720 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11721 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11722 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11723 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11724 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11725 ; GFX7-NEXT: s_endpgm
11727 ; GFX10-WGP-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11728 ; GFX10-WGP: ; %bb.0: ; %entry
11729 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11730 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11731 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11732 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11733 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11734 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11735 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11736 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11737 ; GFX10-WGP-NEXT: s_endpgm
11739 ; GFX10-CU-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11740 ; GFX10-CU: ; %bb.0: ; %entry
11741 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11742 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11743 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11744 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11745 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11746 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11747 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11748 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11749 ; GFX10-CU-NEXT: s_endpgm
11751 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11752 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11753 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11754 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11755 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11756 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11757 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11758 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11759 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11760 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11761 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11762 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11763 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11764 ; SKIP-CACHE-INV-NEXT: s_endpgm
11766 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11767 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11768 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11769 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11770 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11771 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11772 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11773 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11774 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11775 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11777 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11778 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11779 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11780 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11781 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11782 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11783 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11784 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11785 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11786 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11788 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11789 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11790 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11791 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11792 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11793 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11794 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11795 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11796 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11797 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11799 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11800 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11801 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11802 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11803 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11804 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11805 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11806 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11807 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11808 ; GFX940-TGSPLIT-NEXT: s_endpgm
11810 ; GFX11-WGP-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11811 ; GFX11-WGP: ; %bb.0: ; %entry
11812 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11813 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11814 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11815 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11816 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11817 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11818 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11819 ; GFX11-WGP-NEXT: s_nop 0
11820 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11821 ; GFX11-WGP-NEXT: s_endpgm
11823 ; GFX11-CU-LABEL: global_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
11824 ; GFX11-CU: ; %bb.0: ; %entry
11825 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11826 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11827 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11828 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11829 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11830 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11831 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11832 ; GFX11-CU-NEXT: s_nop 0
11833 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11834 ; GFX11-CU-NEXT: s_endpgm
11835 ptr addrspace(1) %out, i32 %in, i32 %old) {
11837 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
11838 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic seq_cst
11839 %val0 = extractvalue { i32, i1 } %val, 0
11840 store i32 %val0, ptr addrspace(1) %out, align 4
11844 define amdgpu_kernel void @global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg(
11845 ; GFX6-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11846 ; GFX6: ; %bb.0: ; %entry
11847 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11848 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11849 ; GFX6-NEXT: s_mov_b32 s6, -1
11850 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11851 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11852 ; GFX6-NEXT: s_mov_b32 s4, s0
11853 ; GFX6-NEXT: s_mov_b32 s5, s1
11854 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11855 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11856 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11857 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11858 ; GFX6-NEXT: s_endpgm
11860 ; GFX7-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11861 ; GFX7: ; %bb.0: ; %entry
11862 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11863 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11864 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11865 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11866 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11867 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11868 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11869 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11870 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11871 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11872 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11873 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11874 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11875 ; GFX7-NEXT: s_endpgm
11877 ; GFX10-WGP-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11878 ; GFX10-WGP: ; %bb.0: ; %entry
11879 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11880 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11881 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11882 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11883 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11884 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11885 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11886 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11887 ; GFX10-WGP-NEXT: s_endpgm
11889 ; GFX10-CU-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11890 ; GFX10-CU: ; %bb.0: ; %entry
11891 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11892 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11893 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11894 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11895 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11896 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11897 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11898 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11899 ; GFX10-CU-NEXT: s_endpgm
11901 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11902 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11903 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11904 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11905 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11906 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11907 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11908 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11909 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11910 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11911 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11912 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11913 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11914 ; SKIP-CACHE-INV-NEXT: s_endpgm
11916 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11917 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11918 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11919 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11920 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11921 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11922 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11923 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11924 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11925 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11927 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11928 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11929 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11930 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11931 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11932 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11933 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11934 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11935 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11936 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11938 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11939 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11940 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11941 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11942 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11943 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11944 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11945 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11946 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11947 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11949 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11950 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11951 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11952 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11953 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11954 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11955 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
11956 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11957 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
11958 ; GFX940-TGSPLIT-NEXT: s_endpgm
11960 ; GFX11-WGP-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11961 ; GFX11-WGP: ; %bb.0: ; %entry
11962 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11963 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11964 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11965 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11966 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11967 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11968 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11969 ; GFX11-WGP-NEXT: s_nop 0
11970 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11971 ; GFX11-WGP-NEXT: s_endpgm
11973 ; GFX11-CU-LABEL: global_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
11974 ; GFX11-CU: ; %bb.0: ; %entry
11975 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11976 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11977 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11978 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11979 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11980 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11981 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11982 ; GFX11-CU-NEXT: s_nop 0
11983 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11984 ; GFX11-CU-NEXT: s_endpgm
11985 ptr addrspace(1) %out, i32 %in, i32 %old) {
11987 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
11988 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire seq_cst
11989 %val0 = extractvalue { i32, i1 } %val, 0
11990 store i32 %val0, ptr addrspace(1) %out, align 4
11994 define amdgpu_kernel void @global_singlethread_one_as_release_seq_cst_ret_cmpxchg(
11995 ; GFX6-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
11996 ; GFX6: ; %bb.0: ; %entry
11997 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11998 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11999 ; GFX6-NEXT: s_mov_b32 s6, -1
12000 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12001 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
12002 ; GFX6-NEXT: s_mov_b32 s4, s0
12003 ; GFX6-NEXT: s_mov_b32 s5, s1
12004 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
12005 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12006 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12007 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
12008 ; GFX6-NEXT: s_endpgm
12010 ; GFX7-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12011 ; GFX7: ; %bb.0: ; %entry
12012 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12013 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12014 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12015 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12016 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12017 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12018 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12019 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12020 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12021 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12022 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12023 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12024 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12025 ; GFX7-NEXT: s_endpgm
12027 ; GFX10-WGP-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12028 ; GFX10-WGP: ; %bb.0: ; %entry
12029 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12030 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
12031 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12032 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
12033 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
12034 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12035 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12036 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
12037 ; GFX10-WGP-NEXT: s_endpgm
12039 ; GFX10-CU-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12040 ; GFX10-CU: ; %bb.0: ; %entry
12041 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12042 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
12043 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12044 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
12045 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
12046 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12047 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12048 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
12049 ; GFX10-CU-NEXT: s_endpgm
12051 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12052 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12053 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12054 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
12055 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12056 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12057 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12058 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
12059 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
12060 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
12061 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12062 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12063 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
12064 ; SKIP-CACHE-INV-NEXT: s_endpgm
12066 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12067 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12068 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12069 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12070 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12071 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12072 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12073 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12074 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12075 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12077 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12078 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12079 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12080 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12081 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12082 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12083 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12084 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12085 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12086 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12088 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12089 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12090 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12091 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12092 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12093 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12094 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
12095 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12096 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
12097 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12099 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12100 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12101 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12102 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12103 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12104 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12105 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
12106 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12107 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
12108 ; GFX940-TGSPLIT-NEXT: s_endpgm
12110 ; GFX11-WGP-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12111 ; GFX11-WGP: ; %bb.0: ; %entry
12112 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12113 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
12114 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12115 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12116 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12117 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12118 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
12119 ; GFX11-WGP-NEXT: s_nop 0
12120 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12121 ; GFX11-WGP-NEXT: s_endpgm
12123 ; GFX11-CU-LABEL: global_singlethread_one_as_release_seq_cst_ret_cmpxchg:
12124 ; GFX11-CU: ; %bb.0: ; %entry
12125 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12126 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
12127 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12128 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12129 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12130 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12131 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
12132 ; GFX11-CU-NEXT: s_nop 0
12133 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12134 ; GFX11-CU-NEXT: s_endpgm
12135 ptr addrspace(1) %out, i32 %in, i32 %old) {
12137 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
12138 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release seq_cst
12139 %val0 = extractvalue { i32, i1 } %val, 0
12140 store i32 %val0, ptr addrspace(1) %out, align 4
12144 define amdgpu_kernel void @global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg(
12145 ; GFX6-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12146 ; GFX6: ; %bb.0: ; %entry
12147 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12148 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
12149 ; GFX6-NEXT: s_mov_b32 s6, -1
12150 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12151 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
12152 ; GFX6-NEXT: s_mov_b32 s4, s0
12153 ; GFX6-NEXT: s_mov_b32 s5, s1
12154 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
12155 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12156 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12157 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
12158 ; GFX6-NEXT: s_endpgm
12160 ; GFX7-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12161 ; GFX7: ; %bb.0: ; %entry
12162 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12163 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12164 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12165 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12166 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12167 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12168 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12169 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12170 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12171 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12172 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12173 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12174 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12175 ; GFX7-NEXT: s_endpgm
12177 ; GFX10-WGP-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12178 ; GFX10-WGP: ; %bb.0: ; %entry
12179 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12180 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
12181 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12182 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
12183 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
12184 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12185 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12186 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
12187 ; GFX10-WGP-NEXT: s_endpgm
12189 ; GFX10-CU-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12190 ; GFX10-CU: ; %bb.0: ; %entry
12191 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12192 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
12193 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12194 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
12195 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
12196 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12197 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12198 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
12199 ; GFX10-CU-NEXT: s_endpgm
12201 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12202 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12203 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12204 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
12205 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12206 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12207 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12208 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
12209 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
12210 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
12211 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12212 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12213 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
12214 ; SKIP-CACHE-INV-NEXT: s_endpgm
12216 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12217 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12218 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12219 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12220 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12221 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12222 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12223 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12224 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12225 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12227 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12228 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12229 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12230 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12231 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12232 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12233 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12234 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12235 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12236 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12238 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12239 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12240 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12241 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12242 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12243 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12244 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
12245 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12246 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
12247 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12249 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12250 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12251 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12252 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12253 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12254 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12255 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
12256 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12257 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
12258 ; GFX940-TGSPLIT-NEXT: s_endpgm
12260 ; GFX11-WGP-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12261 ; GFX11-WGP: ; %bb.0: ; %entry
12262 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12263 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
12264 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12265 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12266 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12267 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12268 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
12269 ; GFX11-WGP-NEXT: s_nop 0
12270 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12271 ; GFX11-WGP-NEXT: s_endpgm
12273 ; GFX11-CU-LABEL: global_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
12274 ; GFX11-CU: ; %bb.0: ; %entry
12275 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12276 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
12277 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12278 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12279 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12280 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12281 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
12282 ; GFX11-CU-NEXT: s_nop 0
12283 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12284 ; GFX11-CU-NEXT: s_endpgm
12285 ptr addrspace(1) %out, i32 %in, i32 %old) {
12287 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
12288 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel seq_cst
12289 %val0 = extractvalue { i32, i1 } %val, 0
12290 store i32 %val0, ptr addrspace(1) %out, align 4
12294 define amdgpu_kernel void @global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg(
12295 ; GFX6-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12296 ; GFX6: ; %bb.0: ; %entry
12297 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12298 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
12299 ; GFX6-NEXT: s_mov_b32 s6, -1
12300 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12301 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
12302 ; GFX6-NEXT: s_mov_b32 s4, s0
12303 ; GFX6-NEXT: s_mov_b32 s5, s1
12304 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
12305 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12306 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12307 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
12308 ; GFX6-NEXT: s_endpgm
12310 ; GFX7-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12311 ; GFX7: ; %bb.0: ; %entry
12312 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12313 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12314 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12315 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12316 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12317 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12318 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12319 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12320 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12321 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12322 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12323 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12324 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12325 ; GFX7-NEXT: s_endpgm
12327 ; GFX10-WGP-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12328 ; GFX10-WGP: ; %bb.0: ; %entry
12329 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12330 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
12331 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12332 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
12333 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
12334 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12335 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12336 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
12337 ; GFX10-WGP-NEXT: s_endpgm
12339 ; GFX10-CU-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12340 ; GFX10-CU: ; %bb.0: ; %entry
12341 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12342 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
12343 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12344 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
12345 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
12346 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12347 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12348 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
12349 ; GFX10-CU-NEXT: s_endpgm
12351 ; SKIP-CACHE-INV-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12352 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12353 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12354 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
12355 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12356 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12357 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12358 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
12359 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
12360 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
12361 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12362 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12363 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
12364 ; SKIP-CACHE-INV-NEXT: s_endpgm
12366 ; GFX90A-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12367 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12368 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12369 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12370 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12371 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12372 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12373 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12374 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12375 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12377 ; GFX90A-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12378 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12379 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12380 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12381 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12382 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12383 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12384 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12385 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12386 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12388 ; GFX940-NOTTGSPLIT-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12389 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12390 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12391 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12392 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12393 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12394 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
12395 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12396 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
12397 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12399 ; GFX940-TGSPLIT-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12400 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12401 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12402 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12403 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12404 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12405 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0
12406 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12407 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1] sc0 sc1
12408 ; GFX940-TGSPLIT-NEXT: s_endpgm
12410 ; GFX11-WGP-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12411 ; GFX11-WGP: ; %bb.0: ; %entry
12412 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12413 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
12414 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12415 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12416 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12417 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12418 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
12419 ; GFX11-WGP-NEXT: s_nop 0
12420 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12421 ; GFX11-WGP-NEXT: s_endpgm
12423 ; GFX11-CU-LABEL: global_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
12424 ; GFX11-CU: ; %bb.0: ; %entry
12425 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12426 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
12427 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12428 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12429 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12430 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12431 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
12432 ; GFX11-CU-NEXT: s_nop 0
12433 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12434 ; GFX11-CU-NEXT: s_endpgm
12435 ptr addrspace(1) %out, i32 %in, i32 %old) {
12437 %gep = getelementptr i32, ptr addrspace(1) %out, i32 4
12438 %val = cmpxchg volatile ptr addrspace(1) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst seq_cst
12439 %val0 = extractvalue { i32, i1 } %val, 0
12440 store i32 %val0, ptr addrspace(1) %out, align 4