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_system_unordered_load(
15 ; GFX6-LABEL: global_system_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_system_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_system_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_system_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_system_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_system_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_system_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_system_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]
106 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
108 ; GFX940-TGSPLIT-LABEL: global_system_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]
116 ; GFX940-TGSPLIT-NEXT: s_endpgm
118 ; GFX11-WGP-LABEL: global_system_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_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
127 ; GFX11-WGP-NEXT: s_endpgm
129 ; GFX11-CU-LABEL: global_system_unordered_load:
130 ; GFX11-CU: ; %bb.0: ; %entry
131 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
132 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
133 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
134 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
135 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
136 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
137 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
138 ; GFX11-CU-NEXT: s_endpgm
139 i32 addrspace(1)* %in, i32 addrspace(1)* %out) {
141 %val = load atomic i32, i32 addrspace(1)* %in unordered, align 4
142 store i32 %val, i32 addrspace(1)* %out
146 define amdgpu_kernel void @global_system_monotonic_load(
147 ; GFX6-LABEL: global_system_monotonic_load:
148 ; GFX6: ; %bb.0: ; %entry
149 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
150 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
151 ; GFX6-NEXT: s_mov_b32 s6, -1
152 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
153 ; GFX6-NEXT: s_mov_b32 s4, s0
154 ; GFX6-NEXT: s_mov_b32 s5, s1
155 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
156 ; GFX6-NEXT: s_mov_b32 s4, s2
157 ; GFX6-NEXT: s_mov_b32 s5, s3
158 ; GFX6-NEXT: s_waitcnt vmcnt(0)
159 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
160 ; GFX6-NEXT: s_endpgm
162 ; GFX7-LABEL: global_system_monotonic_load:
163 ; GFX7: ; %bb.0: ; %entry
164 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
165 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
166 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
167 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
168 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
169 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
170 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
171 ; GFX7-NEXT: s_waitcnt vmcnt(0)
172 ; GFX7-NEXT: flat_store_dword v[0:1], v2
173 ; GFX7-NEXT: s_endpgm
175 ; GFX10-WGP-LABEL: global_system_monotonic_load:
176 ; GFX10-WGP: ; %bb.0: ; %entry
177 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
178 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
179 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
180 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
181 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
182 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
183 ; GFX10-WGP-NEXT: s_endpgm
185 ; GFX10-CU-LABEL: global_system_monotonic_load:
186 ; GFX10-CU: ; %bb.0: ; %entry
187 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
188 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
189 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
190 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
191 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
192 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
193 ; GFX10-CU-NEXT: s_endpgm
195 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_load:
196 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
197 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
198 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
199 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
200 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
201 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
202 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
203 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
204 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
205 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
206 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
207 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
208 ; SKIP-CACHE-INV-NEXT: s_endpgm
210 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_load:
211 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
212 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
213 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
214 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
215 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
216 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
217 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
218 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
220 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_load:
221 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
222 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
223 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
224 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
225 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
226 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
227 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
228 ; GFX90A-TGSPLIT-NEXT: s_endpgm
230 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_load:
231 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
232 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
233 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
234 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
235 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
236 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
237 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
238 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
240 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_load:
241 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
242 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
243 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
244 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
245 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
246 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
247 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
248 ; GFX940-TGSPLIT-NEXT: s_endpgm
250 ; GFX11-WGP-LABEL: global_system_monotonic_load:
251 ; GFX11-WGP: ; %bb.0: ; %entry
252 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
253 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
254 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
255 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1] glc
256 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
257 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
258 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
259 ; GFX11-WGP-NEXT: s_endpgm
261 ; GFX11-CU-LABEL: global_system_monotonic_load:
262 ; GFX11-CU: ; %bb.0: ; %entry
263 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
264 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
265 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
266 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1] glc
267 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
268 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
269 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
270 ; GFX11-CU-NEXT: s_endpgm
271 i32 addrspace(1)* %in, i32 addrspace(1)* %out) {
273 %val = load atomic i32, i32 addrspace(1)* %in monotonic, align 4
274 store i32 %val, i32 addrspace(1)* %out
278 define amdgpu_kernel void @global_system_acquire_load(
279 ; GFX6-LABEL: global_system_acquire_load:
280 ; GFX6: ; %bb.0: ; %entry
281 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
282 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
283 ; GFX6-NEXT: s_mov_b32 s6, -1
284 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
285 ; GFX6-NEXT: s_mov_b32 s4, s0
286 ; GFX6-NEXT: s_mov_b32 s5, s1
287 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
288 ; GFX6-NEXT: s_waitcnt vmcnt(0)
289 ; GFX6-NEXT: buffer_wbinvl1
290 ; GFX6-NEXT: s_mov_b32 s4, s2
291 ; GFX6-NEXT: s_mov_b32 s5, s3
292 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
293 ; GFX6-NEXT: s_endpgm
295 ; GFX7-LABEL: global_system_acquire_load:
296 ; GFX7: ; %bb.0: ; %entry
297 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
298 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
299 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
300 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
301 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
302 ; GFX7-NEXT: s_waitcnt vmcnt(0)
303 ; GFX7-NEXT: buffer_wbinvl1_vol
304 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
305 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
306 ; GFX7-NEXT: flat_store_dword v[0:1], v2
307 ; GFX7-NEXT: s_endpgm
309 ; GFX10-WGP-LABEL: global_system_acquire_load:
310 ; GFX10-WGP: ; %bb.0: ; %entry
311 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
312 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
313 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
314 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
315 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
316 ; GFX10-WGP-NEXT: buffer_gl0_inv
317 ; GFX10-WGP-NEXT: buffer_gl1_inv
318 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
319 ; GFX10-WGP-NEXT: s_endpgm
321 ; GFX10-CU-LABEL: global_system_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] glc dlc
327 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
328 ; GFX10-CU-NEXT: buffer_gl0_inv
329 ; GFX10-CU-NEXT: buffer_gl1_inv
330 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
331 ; GFX10-CU-NEXT: s_endpgm
333 ; SKIP-CACHE-INV-LABEL: global_system_acquire_load:
334 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
335 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
336 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
337 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
338 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
339 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
340 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
341 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
342 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
343 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
344 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
345 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
346 ; SKIP-CACHE-INV-NEXT: s_endpgm
348 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_load:
349 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
350 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
351 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
352 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
353 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
354 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
355 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
356 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
357 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
358 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
360 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_load:
361 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
362 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
363 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
364 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
365 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
366 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
367 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
368 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
369 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
370 ; GFX90A-TGSPLIT-NEXT: s_endpgm
372 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_load:
373 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
374 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
375 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
376 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
377 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
378 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
379 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
380 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
381 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
383 ; GFX940-TGSPLIT-LABEL: global_system_acquire_load:
384 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
385 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
386 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
387 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
388 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
389 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
390 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
391 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
392 ; GFX940-TGSPLIT-NEXT: s_endpgm
394 ; GFX11-WGP-LABEL: global_system_acquire_load:
395 ; GFX11-WGP: ; %bb.0: ; %entry
396 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
397 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
398 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
399 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1] glc
400 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
401 ; GFX11-WGP-NEXT: buffer_gl0_inv
402 ; GFX11-WGP-NEXT: buffer_gl1_inv
403 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
404 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
405 ; GFX11-WGP-NEXT: s_endpgm
407 ; GFX11-CU-LABEL: global_system_acquire_load:
408 ; GFX11-CU: ; %bb.0: ; %entry
409 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
410 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
411 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
412 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1] glc
413 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
414 ; GFX11-CU-NEXT: buffer_gl0_inv
415 ; GFX11-CU-NEXT: buffer_gl1_inv
416 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
417 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
418 ; GFX11-CU-NEXT: s_endpgm
419 i32 addrspace(1)* %in, i32 addrspace(1)* %out) {
421 %val = load atomic i32, i32 addrspace(1)* %in acquire, align 4
422 store i32 %val, i32 addrspace(1)* %out
426 define amdgpu_kernel void @global_system_seq_cst_load(
427 ; GFX6-LABEL: global_system_seq_cst_load:
428 ; GFX6: ; %bb.0: ; %entry
429 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
430 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
431 ; GFX6-NEXT: s_mov_b32 s6, -1
432 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
433 ; GFX6-NEXT: s_mov_b32 s4, s0
434 ; GFX6-NEXT: s_mov_b32 s5, s1
435 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
436 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
437 ; GFX6-NEXT: s_waitcnt vmcnt(0)
438 ; GFX6-NEXT: buffer_wbinvl1
439 ; GFX6-NEXT: s_mov_b32 s4, s2
440 ; GFX6-NEXT: s_mov_b32 s5, s3
441 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
442 ; GFX6-NEXT: s_endpgm
444 ; GFX7-LABEL: global_system_seq_cst_load:
445 ; GFX7: ; %bb.0: ; %entry
446 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
447 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
448 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
449 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
450 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
451 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
452 ; GFX7-NEXT: s_waitcnt vmcnt(0)
453 ; GFX7-NEXT: buffer_wbinvl1_vol
454 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
455 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
456 ; GFX7-NEXT: flat_store_dword v[0:1], v2
457 ; GFX7-NEXT: s_endpgm
459 ; GFX10-WGP-LABEL: global_system_seq_cst_load:
460 ; GFX10-WGP: ; %bb.0: ; %entry
461 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
462 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
463 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
464 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
465 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
466 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
467 ; GFX10-WGP-NEXT: buffer_gl0_inv
468 ; GFX10-WGP-NEXT: buffer_gl1_inv
469 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
470 ; GFX10-WGP-NEXT: s_endpgm
472 ; GFX10-CU-LABEL: global_system_seq_cst_load:
473 ; GFX10-CU: ; %bb.0: ; %entry
474 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
475 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
476 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
477 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
478 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
479 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
480 ; GFX10-CU-NEXT: buffer_gl0_inv
481 ; GFX10-CU-NEXT: buffer_gl1_inv
482 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
483 ; GFX10-CU-NEXT: s_endpgm
485 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_load:
486 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
487 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
488 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
489 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
490 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
491 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
492 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
493 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
494 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
495 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
496 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
497 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
498 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
499 ; SKIP-CACHE-INV-NEXT: s_endpgm
501 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_load:
502 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
503 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
504 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
505 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
506 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
507 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
508 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
509 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
510 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
511 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
513 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_load:
514 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
515 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
516 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
517 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
518 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
519 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
520 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
521 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
522 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
523 ; GFX90A-TGSPLIT-NEXT: s_endpgm
525 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_load:
526 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
527 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
528 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
529 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
530 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
531 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
532 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
533 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
534 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
536 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_load:
537 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
538 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
539 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
540 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
541 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
542 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
543 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
544 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
545 ; GFX940-TGSPLIT-NEXT: s_endpgm
547 ; GFX11-WGP-LABEL: global_system_seq_cst_load:
548 ; GFX11-WGP: ; %bb.0: ; %entry
549 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
550 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
551 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
552 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
553 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1] glc
554 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
555 ; GFX11-WGP-NEXT: buffer_gl0_inv
556 ; GFX11-WGP-NEXT: buffer_gl1_inv
557 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
558 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
559 ; GFX11-WGP-NEXT: s_endpgm
561 ; GFX11-CU-LABEL: global_system_seq_cst_load:
562 ; GFX11-CU: ; %bb.0: ; %entry
563 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
564 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
565 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
566 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
567 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1] glc
568 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
569 ; GFX11-CU-NEXT: buffer_gl0_inv
570 ; GFX11-CU-NEXT: buffer_gl1_inv
571 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
572 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
573 ; GFX11-CU-NEXT: s_endpgm
574 i32 addrspace(1)* %in, i32 addrspace(1)* %out) {
576 %val = load atomic i32, i32 addrspace(1)* %in seq_cst, align 4
577 store i32 %val, i32 addrspace(1)* %out
581 define amdgpu_kernel void @global_system_unordered_store(
582 ; GFX6-LABEL: global_system_unordered_store:
583 ; GFX6: ; %bb.0: ; %entry
584 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
585 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
586 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
587 ; GFX6-NEXT: s_mov_b32 s2, -1
588 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
589 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
590 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
591 ; GFX6-NEXT: s_endpgm
593 ; GFX7-LABEL: global_system_unordered_store:
594 ; GFX7: ; %bb.0: ; %entry
595 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
596 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
597 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
598 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
599 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
600 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
601 ; GFX7-NEXT: flat_store_dword v[0:1], v2
602 ; GFX7-NEXT: s_endpgm
604 ; GFX10-WGP-LABEL: global_system_unordered_store:
605 ; GFX10-WGP: ; %bb.0: ; %entry
606 ; GFX10-WGP-NEXT: s_clause 0x1
607 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
608 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
609 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
610 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
611 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
612 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
613 ; GFX10-WGP-NEXT: s_endpgm
615 ; GFX10-CU-LABEL: global_system_unordered_store:
616 ; GFX10-CU: ; %bb.0: ; %entry
617 ; GFX10-CU-NEXT: s_clause 0x1
618 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
619 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
620 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
621 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
622 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
623 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
624 ; GFX10-CU-NEXT: s_endpgm
626 ; SKIP-CACHE-INV-LABEL: global_system_unordered_store:
627 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
628 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
629 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
630 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
631 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
632 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
633 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
634 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
635 ; SKIP-CACHE-INV-NEXT: s_endpgm
637 ; GFX90A-NOTTGSPLIT-LABEL: global_system_unordered_store:
638 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
639 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
640 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
641 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
642 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
643 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
644 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
645 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
647 ; GFX90A-TGSPLIT-LABEL: global_system_unordered_store:
648 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
649 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
650 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
651 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
652 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
653 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
654 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
655 ; GFX90A-TGSPLIT-NEXT: s_endpgm
657 ; GFX940-NOTTGSPLIT-LABEL: global_system_unordered_store:
658 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
659 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
660 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
661 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
662 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
663 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
664 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
665 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
667 ; GFX940-TGSPLIT-LABEL: global_system_unordered_store:
668 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
669 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
670 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
671 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
672 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
673 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
674 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
675 ; GFX940-TGSPLIT-NEXT: s_endpgm
677 ; GFX11-WGP-LABEL: global_system_unordered_store:
678 ; GFX11-WGP: ; %bb.0: ; %entry
679 ; GFX11-WGP-NEXT: s_clause 0x1
680 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
681 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
682 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
683 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
684 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
685 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
686 ; GFX11-WGP-NEXT: s_endpgm
688 ; GFX11-CU-LABEL: global_system_unordered_store:
689 ; GFX11-CU: ; %bb.0: ; %entry
690 ; GFX11-CU-NEXT: s_clause 0x1
691 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
692 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
693 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
694 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
695 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
696 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
697 ; GFX11-CU-NEXT: s_endpgm
698 i32 %in, i32 addrspace(1)* %out) {
700 store atomic i32 %in, i32 addrspace(1)* %out unordered, align 4
704 define amdgpu_kernel void @global_system_monotonic_store(
705 ; GFX6-LABEL: global_system_monotonic_store:
706 ; GFX6: ; %bb.0: ; %entry
707 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
708 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
709 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
710 ; GFX6-NEXT: s_mov_b32 s2, -1
711 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
712 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
713 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
714 ; GFX6-NEXT: s_endpgm
716 ; GFX7-LABEL: global_system_monotonic_store:
717 ; GFX7: ; %bb.0: ; %entry
718 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
719 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
720 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
721 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
722 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
723 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
724 ; GFX7-NEXT: flat_store_dword v[0:1], v2
725 ; GFX7-NEXT: s_endpgm
727 ; GFX10-WGP-LABEL: global_system_monotonic_store:
728 ; GFX10-WGP: ; %bb.0: ; %entry
729 ; GFX10-WGP-NEXT: s_clause 0x1
730 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
731 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
732 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
733 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
734 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
735 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
736 ; GFX10-WGP-NEXT: s_endpgm
738 ; GFX10-CU-LABEL: global_system_monotonic_store:
739 ; GFX10-CU: ; %bb.0: ; %entry
740 ; GFX10-CU-NEXT: s_clause 0x1
741 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
742 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
743 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
744 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
745 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
746 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
747 ; GFX10-CU-NEXT: s_endpgm
749 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_store:
750 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
751 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
752 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
753 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
754 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
755 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
756 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
757 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
758 ; SKIP-CACHE-INV-NEXT: s_endpgm
760 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_store:
761 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
762 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
763 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
764 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
765 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
766 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
767 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
768 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
770 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_store:
771 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
772 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
773 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
774 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
775 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
776 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
777 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
778 ; GFX90A-TGSPLIT-NEXT: s_endpgm
780 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_store:
781 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
782 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
783 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
784 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
785 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
786 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
787 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
788 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
790 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_store:
791 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
792 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
793 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
794 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
795 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
796 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
797 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
798 ; GFX940-TGSPLIT-NEXT: s_endpgm
800 ; GFX11-WGP-LABEL: global_system_monotonic_store:
801 ; GFX11-WGP: ; %bb.0: ; %entry
802 ; GFX11-WGP-NEXT: s_clause 0x1
803 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
804 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
805 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
806 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
807 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
808 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
809 ; GFX11-WGP-NEXT: s_endpgm
811 ; GFX11-CU-LABEL: global_system_monotonic_store:
812 ; GFX11-CU: ; %bb.0: ; %entry
813 ; GFX11-CU-NEXT: s_clause 0x1
814 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
815 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
816 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
817 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
818 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
819 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
820 ; GFX11-CU-NEXT: s_endpgm
821 i32 %in, i32 addrspace(1)* %out) {
823 store atomic i32 %in, i32 addrspace(1)* %out monotonic, align 4
827 define amdgpu_kernel void @global_system_release_store(
828 ; GFX6-LABEL: global_system_release_store:
829 ; GFX6: ; %bb.0: ; %entry
830 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
831 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
832 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
833 ; GFX6-NEXT: s_mov_b32 s2, -1
834 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
835 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
836 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
837 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
838 ; GFX6-NEXT: s_endpgm
840 ; GFX7-LABEL: global_system_release_store:
841 ; GFX7: ; %bb.0: ; %entry
842 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
843 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
844 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
845 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
846 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
847 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
848 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
849 ; GFX7-NEXT: flat_store_dword v[0:1], v2
850 ; GFX7-NEXT: s_endpgm
852 ; GFX10-WGP-LABEL: global_system_release_store:
853 ; GFX10-WGP: ; %bb.0: ; %entry
854 ; GFX10-WGP-NEXT: s_clause 0x1
855 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
856 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
857 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
858 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
859 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
860 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
861 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
862 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
863 ; GFX10-WGP-NEXT: s_endpgm
865 ; GFX10-CU-LABEL: global_system_release_store:
866 ; GFX10-CU: ; %bb.0: ; %entry
867 ; GFX10-CU-NEXT: s_clause 0x1
868 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
869 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
870 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
871 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
872 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
873 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
874 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
875 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
876 ; GFX10-CU-NEXT: s_endpgm
878 ; SKIP-CACHE-INV-LABEL: global_system_release_store:
879 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
880 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
881 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
882 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
883 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
884 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
885 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
886 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
887 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
888 ; SKIP-CACHE-INV-NEXT: s_endpgm
890 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_store:
891 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
892 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
893 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
894 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
895 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
896 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
897 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
898 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
899 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
900 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
902 ; GFX90A-TGSPLIT-LABEL: global_system_release_store:
903 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
904 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
905 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
906 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
907 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
908 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
909 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
910 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
911 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
912 ; GFX90A-TGSPLIT-NEXT: s_endpgm
914 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_store:
915 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
916 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
917 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
918 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
919 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
920 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
921 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
922 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
923 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
924 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
926 ; GFX940-TGSPLIT-LABEL: global_system_release_store:
927 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
928 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
929 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
930 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
931 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
932 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
933 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
934 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
935 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
936 ; GFX940-TGSPLIT-NEXT: s_endpgm
938 ; GFX11-WGP-LABEL: global_system_release_store:
939 ; GFX11-WGP: ; %bb.0: ; %entry
940 ; GFX11-WGP-NEXT: s_clause 0x1
941 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
942 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
943 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
944 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
945 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
946 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
947 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
948 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
949 ; GFX11-WGP-NEXT: s_endpgm
951 ; GFX11-CU-LABEL: global_system_release_store:
952 ; GFX11-CU: ; %bb.0: ; %entry
953 ; GFX11-CU-NEXT: s_clause 0x1
954 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
955 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
956 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
957 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
958 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
959 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
960 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
961 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
962 ; GFX11-CU-NEXT: s_endpgm
963 i32 %in, i32 addrspace(1)* %out) {
965 store atomic i32 %in, i32 addrspace(1)* %out release, align 4
969 define amdgpu_kernel void @global_system_seq_cst_store(
970 ; GFX6-LABEL: global_system_seq_cst_store:
971 ; GFX6: ; %bb.0: ; %entry
972 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
973 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
974 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
975 ; GFX6-NEXT: s_mov_b32 s2, -1
976 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
977 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
978 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
979 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
980 ; GFX6-NEXT: s_endpgm
982 ; GFX7-LABEL: global_system_seq_cst_store:
983 ; GFX7: ; %bb.0: ; %entry
984 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
985 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
986 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
987 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
988 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
989 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
990 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
991 ; GFX7-NEXT: flat_store_dword v[0:1], v2
992 ; GFX7-NEXT: s_endpgm
994 ; GFX10-WGP-LABEL: global_system_seq_cst_store:
995 ; GFX10-WGP: ; %bb.0: ; %entry
996 ; GFX10-WGP-NEXT: s_clause 0x1
997 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
998 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
999 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1000 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1001 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1002 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1003 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1004 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
1005 ; GFX10-WGP-NEXT: s_endpgm
1007 ; GFX10-CU-LABEL: global_system_seq_cst_store:
1008 ; GFX10-CU: ; %bb.0: ; %entry
1009 ; GFX10-CU-NEXT: s_clause 0x1
1010 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
1011 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
1012 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1013 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1014 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1015 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1016 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1017 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
1018 ; GFX10-CU-NEXT: s_endpgm
1020 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_store:
1021 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1022 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
1023 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
1024 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1025 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1026 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1027 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1028 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1029 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
1030 ; SKIP-CACHE-INV-NEXT: s_endpgm
1032 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_store:
1033 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1034 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
1035 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
1036 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1037 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1038 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1039 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1040 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1041 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
1042 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1044 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_store:
1045 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1046 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
1047 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
1048 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1049 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1050 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1051 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1052 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1053 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
1054 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1056 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_store:
1057 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1058 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
1059 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
1060 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1061 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1062 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1063 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1064 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1065 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
1066 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1068 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_store:
1069 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1070 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
1071 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
1072 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1073 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1074 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1075 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1076 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1077 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
1078 ; GFX940-TGSPLIT-NEXT: s_endpgm
1080 ; GFX11-WGP-LABEL: global_system_seq_cst_store:
1081 ; GFX11-WGP: ; %bb.0: ; %entry
1082 ; GFX11-WGP-NEXT: s_clause 0x1
1083 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
1084 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1085 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1086 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1087 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1088 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1089 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
1090 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1091 ; GFX11-WGP-NEXT: s_endpgm
1093 ; GFX11-CU-LABEL: global_system_seq_cst_store:
1094 ; GFX11-CU: ; %bb.0: ; %entry
1095 ; GFX11-CU-NEXT: s_clause 0x1
1096 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
1097 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
1098 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1099 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1100 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1101 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1102 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
1103 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1104 ; GFX11-CU-NEXT: s_endpgm
1105 i32 %in, i32 addrspace(1)* %out) {
1107 store atomic i32 %in, i32 addrspace(1)* %out seq_cst, align 4
1111 define amdgpu_kernel void @global_system_monotonic_atomicrmw(
1112 ; GFX6-LABEL: global_system_monotonic_atomicrmw:
1113 ; GFX6: ; %bb.0: ; %entry
1114 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1115 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1116 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1117 ; GFX6-NEXT: s_mov_b32 s2, -1
1118 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1119 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1120 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1121 ; GFX6-NEXT: s_endpgm
1123 ; GFX7-LABEL: global_system_monotonic_atomicrmw:
1124 ; GFX7: ; %bb.0: ; %entry
1125 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1126 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1127 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1128 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1129 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1130 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1131 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1132 ; GFX7-NEXT: s_endpgm
1134 ; GFX10-WGP-LABEL: global_system_monotonic_atomicrmw:
1135 ; GFX10-WGP: ; %bb.0: ; %entry
1136 ; GFX10-WGP-NEXT: s_clause 0x1
1137 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1138 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1139 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1140 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1141 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1142 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1143 ; GFX10-WGP-NEXT: s_endpgm
1145 ; GFX10-CU-LABEL: global_system_monotonic_atomicrmw:
1146 ; GFX10-CU: ; %bb.0: ; %entry
1147 ; GFX10-CU-NEXT: s_clause 0x1
1148 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1149 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1150 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1151 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1152 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1153 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1154 ; GFX10-CU-NEXT: s_endpgm
1156 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_atomicrmw:
1157 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1158 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1159 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1160 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1161 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1162 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1163 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1164 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1165 ; SKIP-CACHE-INV-NEXT: s_endpgm
1167 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_atomicrmw:
1168 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1169 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1170 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1171 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1172 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1173 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1174 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1175 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1177 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_atomicrmw:
1178 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1179 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1180 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1181 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1182 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1183 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1184 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1185 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1187 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_atomicrmw:
1188 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1189 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1190 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1191 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1192 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1193 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1194 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1195 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1197 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_atomicrmw:
1198 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1199 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1200 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1201 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1202 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1203 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1204 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1205 ; GFX940-TGSPLIT-NEXT: s_endpgm
1207 ; GFX11-WGP-LABEL: global_system_monotonic_atomicrmw:
1208 ; GFX11-WGP: ; %bb.0: ; %entry
1209 ; GFX11-WGP-NEXT: s_clause 0x1
1210 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1211 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1212 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1213 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1214 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1215 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1216 ; GFX11-WGP-NEXT: s_endpgm
1218 ; GFX11-CU-LABEL: global_system_monotonic_atomicrmw:
1219 ; GFX11-CU: ; %bb.0: ; %entry
1220 ; GFX11-CU-NEXT: s_clause 0x1
1221 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1222 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1223 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1224 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1225 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1226 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1227 ; GFX11-CU-NEXT: s_endpgm
1228 i32 addrspace(1)* %out, i32 %in) {
1230 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in monotonic
1234 define amdgpu_kernel void @global_system_acquire_atomicrmw(
1235 ; GFX6-LABEL: global_system_acquire_atomicrmw:
1236 ; GFX6: ; %bb.0: ; %entry
1237 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1238 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1239 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1240 ; GFX6-NEXT: s_mov_b32 s2, -1
1241 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1242 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1243 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1244 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1245 ; GFX6-NEXT: buffer_wbinvl1
1246 ; GFX6-NEXT: s_endpgm
1248 ; GFX7-LABEL: global_system_acquire_atomicrmw:
1249 ; GFX7: ; %bb.0: ; %entry
1250 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1251 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1252 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1253 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1254 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1255 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1256 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1257 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1258 ; GFX7-NEXT: buffer_wbinvl1_vol
1259 ; GFX7-NEXT: s_endpgm
1261 ; GFX10-WGP-LABEL: global_system_acquire_atomicrmw:
1262 ; GFX10-WGP: ; %bb.0: ; %entry
1263 ; GFX10-WGP-NEXT: s_clause 0x1
1264 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1265 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1266 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1267 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1268 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1269 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1270 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1271 ; GFX10-WGP-NEXT: buffer_gl0_inv
1272 ; GFX10-WGP-NEXT: buffer_gl1_inv
1273 ; GFX10-WGP-NEXT: s_endpgm
1275 ; GFX10-CU-LABEL: global_system_acquire_atomicrmw:
1276 ; GFX10-CU: ; %bb.0: ; %entry
1277 ; GFX10-CU-NEXT: s_clause 0x1
1278 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1279 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1280 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1281 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1282 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1283 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1284 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1285 ; GFX10-CU-NEXT: buffer_gl0_inv
1286 ; GFX10-CU-NEXT: buffer_gl1_inv
1287 ; GFX10-CU-NEXT: s_endpgm
1289 ; SKIP-CACHE-INV-LABEL: global_system_acquire_atomicrmw:
1290 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1291 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1292 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1293 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1294 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1295 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1296 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1297 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1298 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
1299 ; SKIP-CACHE-INV-NEXT: s_endpgm
1301 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_atomicrmw:
1302 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1303 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1304 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1305 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1306 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1307 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1308 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1309 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1310 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1311 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1312 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1314 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_atomicrmw:
1315 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1316 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1317 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1318 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1319 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1320 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1321 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1322 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1323 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1324 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1325 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1327 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_atomicrmw:
1328 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1329 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1330 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1331 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1332 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1333 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1334 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1335 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1336 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1337 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1339 ; GFX940-TGSPLIT-LABEL: global_system_acquire_atomicrmw:
1340 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1341 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1342 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1343 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1344 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1345 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1346 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1347 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1348 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1349 ; GFX940-TGSPLIT-NEXT: s_endpgm
1351 ; GFX11-WGP-LABEL: global_system_acquire_atomicrmw:
1352 ; GFX11-WGP: ; %bb.0: ; %entry
1353 ; GFX11-WGP-NEXT: s_clause 0x1
1354 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1355 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1356 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1357 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1358 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1359 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1360 ; GFX11-WGP-NEXT: buffer_gl0_inv
1361 ; GFX11-WGP-NEXT: buffer_gl1_inv
1362 ; GFX11-WGP-NEXT: s_endpgm
1364 ; GFX11-CU-LABEL: global_system_acquire_atomicrmw:
1365 ; GFX11-CU: ; %bb.0: ; %entry
1366 ; GFX11-CU-NEXT: s_clause 0x1
1367 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1368 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1369 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1370 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1371 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1372 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1373 ; GFX11-CU-NEXT: buffer_gl0_inv
1374 ; GFX11-CU-NEXT: buffer_gl1_inv
1375 ; GFX11-CU-NEXT: s_endpgm
1376 i32 addrspace(1)* %out, i32 %in) {
1378 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in acquire
1382 define amdgpu_kernel void @global_system_release_atomicrmw(
1383 ; GFX6-LABEL: global_system_release_atomicrmw:
1384 ; GFX6: ; %bb.0: ; %entry
1385 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1386 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1387 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1388 ; GFX6-NEXT: s_mov_b32 s2, -1
1389 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1390 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1391 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1392 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1393 ; GFX6-NEXT: s_endpgm
1395 ; GFX7-LABEL: global_system_release_atomicrmw:
1396 ; GFX7: ; %bb.0: ; %entry
1397 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1398 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1399 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1400 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1401 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1402 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1403 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1404 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1405 ; GFX7-NEXT: s_endpgm
1407 ; GFX10-WGP-LABEL: global_system_release_atomicrmw:
1408 ; GFX10-WGP: ; %bb.0: ; %entry
1409 ; GFX10-WGP-NEXT: s_clause 0x1
1410 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1411 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1412 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1413 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1414 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1415 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1416 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1417 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1418 ; GFX10-WGP-NEXT: s_endpgm
1420 ; GFX10-CU-LABEL: global_system_release_atomicrmw:
1421 ; GFX10-CU: ; %bb.0: ; %entry
1422 ; GFX10-CU-NEXT: s_clause 0x1
1423 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1424 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1425 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1426 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1427 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1428 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1429 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1430 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1431 ; GFX10-CU-NEXT: s_endpgm
1433 ; SKIP-CACHE-INV-LABEL: global_system_release_atomicrmw:
1434 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1435 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1436 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1437 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1438 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1439 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1440 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1441 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1442 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1443 ; SKIP-CACHE-INV-NEXT: s_endpgm
1445 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_atomicrmw:
1446 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1447 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1448 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1449 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1450 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1451 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1452 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1453 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1454 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1455 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1457 ; GFX90A-TGSPLIT-LABEL: global_system_release_atomicrmw:
1458 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1459 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1460 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1461 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1462 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1463 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1464 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1465 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1466 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1467 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1469 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_atomicrmw:
1470 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1471 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1472 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1473 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1474 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1475 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1476 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1477 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1478 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1479 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1481 ; GFX940-TGSPLIT-LABEL: global_system_release_atomicrmw:
1482 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1483 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1484 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1485 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1486 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1487 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1488 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1489 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1490 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1491 ; GFX940-TGSPLIT-NEXT: s_endpgm
1493 ; GFX11-WGP-LABEL: global_system_release_atomicrmw:
1494 ; GFX11-WGP: ; %bb.0: ; %entry
1495 ; GFX11-WGP-NEXT: s_clause 0x1
1496 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1497 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1498 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1499 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1500 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1501 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1502 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1503 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1504 ; GFX11-WGP-NEXT: s_endpgm
1506 ; GFX11-CU-LABEL: global_system_release_atomicrmw:
1507 ; GFX11-CU: ; %bb.0: ; %entry
1508 ; GFX11-CU-NEXT: s_clause 0x1
1509 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1510 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1511 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1512 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1513 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1514 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1515 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1516 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1517 ; GFX11-CU-NEXT: s_endpgm
1518 i32 addrspace(1)* %out, i32 %in) {
1520 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in release
1524 define amdgpu_kernel void @global_system_acq_rel_atomicrmw(
1525 ; GFX6-LABEL: global_system_acq_rel_atomicrmw:
1526 ; GFX6: ; %bb.0: ; %entry
1527 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1528 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1529 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1530 ; GFX6-NEXT: s_mov_b32 s2, -1
1531 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1532 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1533 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1534 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1535 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1536 ; GFX6-NEXT: buffer_wbinvl1
1537 ; GFX6-NEXT: s_endpgm
1539 ; GFX7-LABEL: global_system_acq_rel_atomicrmw:
1540 ; GFX7: ; %bb.0: ; %entry
1541 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1542 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1543 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1544 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1545 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1546 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1547 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1548 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1549 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1550 ; GFX7-NEXT: buffer_wbinvl1_vol
1551 ; GFX7-NEXT: s_endpgm
1553 ; GFX10-WGP-LABEL: global_system_acq_rel_atomicrmw:
1554 ; GFX10-WGP: ; %bb.0: ; %entry
1555 ; GFX10-WGP-NEXT: s_clause 0x1
1556 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1557 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1558 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1559 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1560 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1561 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1562 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1563 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1564 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1565 ; GFX10-WGP-NEXT: buffer_gl0_inv
1566 ; GFX10-WGP-NEXT: buffer_gl1_inv
1567 ; GFX10-WGP-NEXT: s_endpgm
1569 ; GFX10-CU-LABEL: global_system_acq_rel_atomicrmw:
1570 ; GFX10-CU: ; %bb.0: ; %entry
1571 ; GFX10-CU-NEXT: s_clause 0x1
1572 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1573 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1574 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1575 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1576 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1577 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1578 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1579 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1580 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1581 ; GFX10-CU-NEXT: buffer_gl0_inv
1582 ; GFX10-CU-NEXT: buffer_gl1_inv
1583 ; GFX10-CU-NEXT: s_endpgm
1585 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_atomicrmw:
1586 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1587 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1588 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1589 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1590 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1591 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1592 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1593 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1594 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1595 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
1596 ; SKIP-CACHE-INV-NEXT: s_endpgm
1598 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_atomicrmw:
1599 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1600 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1601 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1602 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1603 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1604 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1605 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1606 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1607 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1608 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1609 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1610 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1611 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1613 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_atomicrmw:
1614 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1615 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1616 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1617 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1618 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1619 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1620 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1621 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1622 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1623 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1624 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1625 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1626 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1628 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_atomicrmw:
1629 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1630 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1631 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1632 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1633 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1634 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1635 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1636 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1637 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1638 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1639 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1640 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1642 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_atomicrmw:
1643 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1644 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1645 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1646 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1647 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1648 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1649 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1650 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1651 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1652 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1653 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1654 ; GFX940-TGSPLIT-NEXT: s_endpgm
1656 ; GFX11-WGP-LABEL: global_system_acq_rel_atomicrmw:
1657 ; GFX11-WGP: ; %bb.0: ; %entry
1658 ; GFX11-WGP-NEXT: s_clause 0x1
1659 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1660 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1661 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1662 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1663 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1664 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1665 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1666 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1667 ; GFX11-WGP-NEXT: buffer_gl0_inv
1668 ; GFX11-WGP-NEXT: buffer_gl1_inv
1669 ; GFX11-WGP-NEXT: s_endpgm
1671 ; GFX11-CU-LABEL: global_system_acq_rel_atomicrmw:
1672 ; GFX11-CU: ; %bb.0: ; %entry
1673 ; GFX11-CU-NEXT: s_clause 0x1
1674 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1675 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1676 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1677 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1678 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1679 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1680 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1681 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1682 ; GFX11-CU-NEXT: buffer_gl0_inv
1683 ; GFX11-CU-NEXT: buffer_gl1_inv
1684 ; GFX11-CU-NEXT: s_endpgm
1685 i32 addrspace(1)* %out, i32 %in) {
1687 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in acq_rel
1691 define amdgpu_kernel void @global_system_seq_cst_atomicrmw(
1692 ; GFX6-LABEL: global_system_seq_cst_atomicrmw:
1693 ; GFX6: ; %bb.0: ; %entry
1694 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1695 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1696 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1697 ; GFX6-NEXT: s_mov_b32 s2, -1
1698 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1699 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1700 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1701 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1702 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1703 ; GFX6-NEXT: buffer_wbinvl1
1704 ; GFX6-NEXT: s_endpgm
1706 ; GFX7-LABEL: global_system_seq_cst_atomicrmw:
1707 ; GFX7: ; %bb.0: ; %entry
1708 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1709 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1710 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1711 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1712 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1713 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1714 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1715 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1716 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1717 ; GFX7-NEXT: buffer_wbinvl1_vol
1718 ; GFX7-NEXT: s_endpgm
1720 ; GFX10-WGP-LABEL: global_system_seq_cst_atomicrmw:
1721 ; GFX10-WGP: ; %bb.0: ; %entry
1722 ; GFX10-WGP-NEXT: s_clause 0x1
1723 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1724 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1725 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1726 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1727 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1728 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1729 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1730 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
1731 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1732 ; GFX10-WGP-NEXT: buffer_gl0_inv
1733 ; GFX10-WGP-NEXT: buffer_gl1_inv
1734 ; GFX10-WGP-NEXT: s_endpgm
1736 ; GFX10-CU-LABEL: global_system_seq_cst_atomicrmw:
1737 ; GFX10-CU: ; %bb.0: ; %entry
1738 ; GFX10-CU-NEXT: s_clause 0x1
1739 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1740 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1741 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1742 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1743 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1744 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1745 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1746 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
1747 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1748 ; GFX10-CU-NEXT: buffer_gl0_inv
1749 ; GFX10-CU-NEXT: buffer_gl1_inv
1750 ; GFX10-CU-NEXT: s_endpgm
1752 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_atomicrmw:
1753 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1754 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1755 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1756 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1757 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1758 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1759 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1760 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1761 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
1762 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
1763 ; SKIP-CACHE-INV-NEXT: s_endpgm
1765 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_atomicrmw:
1766 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1767 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1768 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1769 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1770 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1771 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1772 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1773 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1774 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1775 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1776 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1777 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1778 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1780 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_atomicrmw:
1781 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1782 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1783 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1784 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1785 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1786 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1787 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1788 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1789 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
1790 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1791 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1792 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1793 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1795 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_atomicrmw:
1796 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1797 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1798 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1799 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1800 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1801 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1802 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1803 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1804 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1805 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1806 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1807 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1809 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_atomicrmw:
1810 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1811 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1812 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1813 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1814 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1815 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1816 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1817 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1818 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
1819 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1820 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1821 ; GFX940-TGSPLIT-NEXT: s_endpgm
1823 ; GFX11-WGP-LABEL: global_system_seq_cst_atomicrmw:
1824 ; GFX11-WGP: ; %bb.0: ; %entry
1825 ; GFX11-WGP-NEXT: s_clause 0x1
1826 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1827 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1828 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1829 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1830 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1831 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1832 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1833 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1834 ; GFX11-WGP-NEXT: buffer_gl0_inv
1835 ; GFX11-WGP-NEXT: buffer_gl1_inv
1836 ; GFX11-WGP-NEXT: s_endpgm
1838 ; GFX11-CU-LABEL: global_system_seq_cst_atomicrmw:
1839 ; GFX11-CU: ; %bb.0: ; %entry
1840 ; GFX11-CU-NEXT: s_clause 0x1
1841 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
1842 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1843 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1844 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1845 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1846 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1847 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
1848 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1849 ; GFX11-CU-NEXT: buffer_gl0_inv
1850 ; GFX11-CU-NEXT: buffer_gl1_inv
1851 ; GFX11-CU-NEXT: s_endpgm
1852 i32 addrspace(1)* %out, i32 %in) {
1854 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in seq_cst
1858 define amdgpu_kernel void @global_system_acquire_ret_atomicrmw(
1859 ; GFX6-LABEL: global_system_acquire_ret_atomicrmw:
1860 ; GFX6: ; %bb.0: ; %entry
1861 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
1862 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1863 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
1864 ; GFX6-NEXT: s_mov_b32 s2, -1
1865 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1866 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
1867 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
1868 ; GFX6-NEXT: s_waitcnt vmcnt(0)
1869 ; GFX6-NEXT: buffer_wbinvl1
1870 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
1871 ; GFX6-NEXT: s_endpgm
1873 ; GFX7-LABEL: global_system_acquire_ret_atomicrmw:
1874 ; GFX7: ; %bb.0: ; %entry
1875 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1876 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1877 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1878 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1879 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1880 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1881 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1882 ; GFX7-NEXT: s_waitcnt vmcnt(0)
1883 ; GFX7-NEXT: buffer_wbinvl1_vol
1884 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1885 ; GFX7-NEXT: s_endpgm
1887 ; GFX10-WGP-LABEL: global_system_acquire_ret_atomicrmw:
1888 ; GFX10-WGP: ; %bb.0: ; %entry
1889 ; GFX10-WGP-NEXT: s_clause 0x1
1890 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1891 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1892 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
1893 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1894 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
1895 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1896 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
1897 ; GFX10-WGP-NEXT: buffer_gl0_inv
1898 ; GFX10-WGP-NEXT: buffer_gl1_inv
1899 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
1900 ; GFX10-WGP-NEXT: s_endpgm
1902 ; GFX10-CU-LABEL: global_system_acquire_ret_atomicrmw:
1903 ; GFX10-CU: ; %bb.0: ; %entry
1904 ; GFX10-CU-NEXT: s_clause 0x1
1905 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1906 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1907 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
1908 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1909 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
1910 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1911 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
1912 ; GFX10-CU-NEXT: buffer_gl0_inv
1913 ; GFX10-CU-NEXT: buffer_gl1_inv
1914 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
1915 ; GFX10-CU-NEXT: s_endpgm
1917 ; SKIP-CACHE-INV-LABEL: global_system_acquire_ret_atomicrmw:
1918 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1919 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
1920 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
1921 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
1922 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
1923 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1924 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
1925 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
1926 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
1927 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
1928 ; SKIP-CACHE-INV-NEXT: s_endpgm
1930 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_ret_atomicrmw:
1931 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1932 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1933 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1934 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1935 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1936 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1937 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1938 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1939 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1940 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1941 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
1942 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1944 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_ret_atomicrmw:
1945 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1946 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1947 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1948 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1949 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1950 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
1951 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
1952 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1953 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1954 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1955 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
1956 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1958 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_ret_atomicrmw:
1959 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1960 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1961 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1962 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1963 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1964 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1965 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
1966 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
1967 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1968 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
1969 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1971 ; GFX940-TGSPLIT-LABEL: global_system_acquire_ret_atomicrmw:
1972 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1973 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1974 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1975 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
1976 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1977 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1978 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
1979 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1980 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1981 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
1982 ; GFX940-TGSPLIT-NEXT: s_endpgm
1984 ; GFX11-WGP-LABEL: global_system_acquire_ret_atomicrmw:
1985 ; GFX11-WGP: ; %bb.0: ; %entry
1986 ; GFX11-WGP-NEXT: s_clause 0x1
1987 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
1988 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1989 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1990 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
1991 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
1992 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
1993 ; GFX11-WGP-NEXT: buffer_gl0_inv
1994 ; GFX11-WGP-NEXT: buffer_gl1_inv
1995 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
1996 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1997 ; GFX11-WGP-NEXT: s_endpgm
1999 ; GFX11-CU-LABEL: global_system_acquire_ret_atomicrmw:
2000 ; GFX11-CU: ; %bb.0: ; %entry
2001 ; GFX11-CU-NEXT: s_clause 0x1
2002 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
2003 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
2004 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2005 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
2006 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2007 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
2008 ; GFX11-CU-NEXT: buffer_gl0_inv
2009 ; GFX11-CU-NEXT: buffer_gl1_inv
2010 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
2011 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2012 ; GFX11-CU-NEXT: s_endpgm
2013 i32 addrspace(1)* %out, i32 %in) {
2015 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in acquire
2016 store i32 %val, i32 addrspace(1)* %out, align 4
2020 define amdgpu_kernel void @global_system_acq_rel_ret_atomicrmw(
2021 ; GFX6-LABEL: global_system_acq_rel_ret_atomicrmw:
2022 ; GFX6: ; %bb.0: ; %entry
2023 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
2024 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2025 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
2026 ; GFX6-NEXT: s_mov_b32 s2, -1
2027 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2028 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
2029 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2030 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
2031 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2032 ; GFX6-NEXT: buffer_wbinvl1
2033 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
2034 ; GFX6-NEXT: s_endpgm
2036 ; GFX7-LABEL: global_system_acq_rel_ret_atomicrmw:
2037 ; GFX7: ; %bb.0: ; %entry
2038 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2039 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
2040 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2041 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2042 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2043 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2044 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2045 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2046 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2047 ; GFX7-NEXT: buffer_wbinvl1_vol
2048 ; GFX7-NEXT: flat_store_dword v[0:1], v2
2049 ; GFX7-NEXT: s_endpgm
2051 ; GFX10-WGP-LABEL: global_system_acq_rel_ret_atomicrmw:
2052 ; GFX10-WGP: ; %bb.0: ; %entry
2053 ; GFX10-WGP-NEXT: s_clause 0x1
2054 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
2055 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2056 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
2057 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2058 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2059 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2060 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2061 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2062 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
2063 ; GFX10-WGP-NEXT: buffer_gl0_inv
2064 ; GFX10-WGP-NEXT: buffer_gl1_inv
2065 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
2066 ; GFX10-WGP-NEXT: s_endpgm
2068 ; GFX10-CU-LABEL: global_system_acq_rel_ret_atomicrmw:
2069 ; GFX10-CU: ; %bb.0: ; %entry
2070 ; GFX10-CU-NEXT: s_clause 0x1
2071 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
2072 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2073 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
2074 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2075 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2076 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2077 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2078 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2079 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
2080 ; GFX10-CU-NEXT: buffer_gl0_inv
2081 ; GFX10-CU-NEXT: buffer_gl1_inv
2082 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
2083 ; GFX10-CU-NEXT: s_endpgm
2085 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_ret_atomicrmw:
2086 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2087 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
2088 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
2089 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
2090 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
2091 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2092 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
2093 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2094 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
2095 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
2096 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
2097 ; SKIP-CACHE-INV-NEXT: s_endpgm
2099 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_ret_atomicrmw:
2100 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2101 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2102 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2103 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2104 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2105 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2106 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2107 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2108 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2109 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2110 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2111 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2112 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
2113 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2115 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_ret_atomicrmw:
2116 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2117 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2118 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2119 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2120 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2121 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2122 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2123 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2124 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2125 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2126 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2127 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2128 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
2129 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2131 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_ret_atomicrmw:
2132 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2133 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2134 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2135 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2136 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2137 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
2138 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2139 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2140 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
2141 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2142 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2143 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
2144 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2146 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_ret_atomicrmw:
2147 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2148 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2149 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2150 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2151 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2152 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
2153 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2154 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2155 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
2156 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2157 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2158 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
2159 ; GFX940-TGSPLIT-NEXT: s_endpgm
2161 ; GFX11-WGP-LABEL: global_system_acq_rel_ret_atomicrmw:
2162 ; GFX11-WGP: ; %bb.0: ; %entry
2163 ; GFX11-WGP-NEXT: s_clause 0x1
2164 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
2165 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
2166 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2167 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
2168 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2169 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2170 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2171 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
2172 ; GFX11-WGP-NEXT: buffer_gl0_inv
2173 ; GFX11-WGP-NEXT: buffer_gl1_inv
2174 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
2175 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2176 ; GFX11-WGP-NEXT: s_endpgm
2178 ; GFX11-CU-LABEL: global_system_acq_rel_ret_atomicrmw:
2179 ; GFX11-CU: ; %bb.0: ; %entry
2180 ; GFX11-CU-NEXT: s_clause 0x1
2181 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
2182 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
2183 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2184 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
2185 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2186 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2187 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2188 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
2189 ; GFX11-CU-NEXT: buffer_gl0_inv
2190 ; GFX11-CU-NEXT: buffer_gl1_inv
2191 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
2192 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2193 ; GFX11-CU-NEXT: s_endpgm
2194 i32 addrspace(1)* %out, i32 %in) {
2196 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in acq_rel
2197 store i32 %val, i32 addrspace(1)* %out, align 4
2201 define amdgpu_kernel void @global_system_seq_cst_ret_atomicrmw(
2202 ; GFX6-LABEL: global_system_seq_cst_ret_atomicrmw:
2203 ; GFX6: ; %bb.0: ; %entry
2204 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
2205 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2206 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
2207 ; GFX6-NEXT: s_mov_b32 s2, -1
2208 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2209 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
2210 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2211 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
2212 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2213 ; GFX6-NEXT: buffer_wbinvl1
2214 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
2215 ; GFX6-NEXT: s_endpgm
2217 ; GFX7-LABEL: global_system_seq_cst_ret_atomicrmw:
2218 ; GFX7: ; %bb.0: ; %entry
2219 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2220 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
2221 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2222 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2223 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2224 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2225 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2226 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2227 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2228 ; GFX7-NEXT: buffer_wbinvl1_vol
2229 ; GFX7-NEXT: flat_store_dword v[0:1], v2
2230 ; GFX7-NEXT: s_endpgm
2232 ; GFX10-WGP-LABEL: global_system_seq_cst_ret_atomicrmw:
2233 ; GFX10-WGP: ; %bb.0: ; %entry
2234 ; GFX10-WGP-NEXT: s_clause 0x1
2235 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
2236 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2237 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
2238 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2239 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
2240 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2241 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2242 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2243 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
2244 ; GFX10-WGP-NEXT: buffer_gl0_inv
2245 ; GFX10-WGP-NEXT: buffer_gl1_inv
2246 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
2247 ; GFX10-WGP-NEXT: s_endpgm
2249 ; GFX10-CU-LABEL: global_system_seq_cst_ret_atomicrmw:
2250 ; GFX10-CU: ; %bb.0: ; %entry
2251 ; GFX10-CU-NEXT: s_clause 0x1
2252 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
2253 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2254 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
2255 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2256 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
2257 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2258 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2259 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2260 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
2261 ; GFX10-CU-NEXT: buffer_gl0_inv
2262 ; GFX10-CU-NEXT: buffer_gl1_inv
2263 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
2264 ; GFX10-CU-NEXT: s_endpgm
2266 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_ret_atomicrmw:
2267 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2268 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
2269 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
2270 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
2271 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
2272 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2273 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
2274 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2275 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
2276 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
2277 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
2278 ; SKIP-CACHE-INV-NEXT: s_endpgm
2280 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_ret_atomicrmw:
2281 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2282 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2283 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2284 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2285 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2286 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2287 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2288 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2289 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2290 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2291 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2292 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2293 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
2294 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2296 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_ret_atomicrmw:
2297 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2298 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2299 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2300 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2301 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2302 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
2303 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2304 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2305 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
2306 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2307 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2308 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2309 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
2310 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2312 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_ret_atomicrmw:
2313 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2314 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2315 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2316 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2317 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2318 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
2319 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2320 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2321 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
2322 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2323 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2324 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
2325 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2327 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_ret_atomicrmw:
2328 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2329 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2330 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2331 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
2332 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2333 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
2334 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2335 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2336 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
2337 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2338 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2339 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
2340 ; GFX940-TGSPLIT-NEXT: s_endpgm
2342 ; GFX11-WGP-LABEL: global_system_seq_cst_ret_atomicrmw:
2343 ; GFX11-WGP: ; %bb.0: ; %entry
2344 ; GFX11-WGP-NEXT: s_clause 0x1
2345 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
2346 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
2347 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2348 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
2349 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2350 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2351 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2352 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
2353 ; GFX11-WGP-NEXT: buffer_gl0_inv
2354 ; GFX11-WGP-NEXT: buffer_gl1_inv
2355 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
2356 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2357 ; GFX11-WGP-NEXT: s_endpgm
2359 ; GFX11-CU-LABEL: global_system_seq_cst_ret_atomicrmw:
2360 ; GFX11-CU: ; %bb.0: ; %entry
2361 ; GFX11-CU-NEXT: s_clause 0x1
2362 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
2363 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
2364 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2365 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
2366 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2367 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2368 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
2369 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
2370 ; GFX11-CU-NEXT: buffer_gl0_inv
2371 ; GFX11-CU-NEXT: buffer_gl1_inv
2372 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
2373 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2374 ; GFX11-CU-NEXT: s_endpgm
2375 i32 addrspace(1)* %out, i32 %in) {
2377 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in seq_cst
2378 store i32 %val, i32 addrspace(1)* %out, align 4
2382 define amdgpu_kernel void @global_system_monotonic_monotonic_cmpxchg(
2383 ; GFX6-LABEL: global_system_monotonic_monotonic_cmpxchg:
2384 ; GFX6: ; %bb.0: ; %entry
2385 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2386 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2387 ; GFX6-NEXT: s_mov_b32 s6, -1
2388 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2389 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2390 ; GFX6-NEXT: s_mov_b32 s4, s0
2391 ; GFX6-NEXT: s_mov_b32 s5, s1
2392 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2393 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2394 ; GFX6-NEXT: s_endpgm
2396 ; GFX7-LABEL: global_system_monotonic_monotonic_cmpxchg:
2397 ; GFX7: ; %bb.0: ; %entry
2398 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2399 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2400 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2401 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2402 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2403 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2404 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2405 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2406 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2407 ; GFX7-NEXT: s_endpgm
2409 ; GFX10-WGP-LABEL: global_system_monotonic_monotonic_cmpxchg:
2410 ; GFX10-WGP: ; %bb.0: ; %entry
2411 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2412 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2413 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2414 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2415 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2416 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2417 ; GFX10-WGP-NEXT: s_endpgm
2419 ; GFX10-CU-LABEL: global_system_monotonic_monotonic_cmpxchg:
2420 ; GFX10-CU: ; %bb.0: ; %entry
2421 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2422 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2423 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2424 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2425 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2426 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2427 ; GFX10-CU-NEXT: s_endpgm
2429 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_monotonic_cmpxchg:
2430 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2431 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2432 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2433 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2434 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2435 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2436 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2437 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2438 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2439 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2440 ; SKIP-CACHE-INV-NEXT: s_endpgm
2442 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_monotonic_cmpxchg:
2443 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2444 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2445 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2446 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2447 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2448 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2449 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2451 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_monotonic_cmpxchg:
2452 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2453 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2454 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2455 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2456 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2457 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2458 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2460 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_monotonic_cmpxchg:
2461 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2462 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2463 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2464 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2465 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2466 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
2467 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2469 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_monotonic_cmpxchg:
2470 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2471 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2472 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2473 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2474 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2475 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
2476 ; GFX940-TGSPLIT-NEXT: s_endpgm
2478 ; GFX11-WGP-LABEL: global_system_monotonic_monotonic_cmpxchg:
2479 ; GFX11-WGP: ; %bb.0: ; %entry
2480 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2481 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2482 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2483 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2484 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2485 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2486 ; GFX11-WGP-NEXT: s_endpgm
2488 ; GFX11-CU-LABEL: global_system_monotonic_monotonic_cmpxchg:
2489 ; GFX11-CU: ; %bb.0: ; %entry
2490 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2491 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2492 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2493 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2494 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2495 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2496 ; GFX11-CU-NEXT: s_endpgm
2497 i32 addrspace(1)* %out, i32 %in, i32 %old) {
2499 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
2500 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in monotonic monotonic
2504 define amdgpu_kernel void @global_system_acquire_monotonic_cmpxchg(
2505 ; GFX6-LABEL: global_system_acquire_monotonic_cmpxchg:
2506 ; GFX6: ; %bb.0: ; %entry
2507 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2508 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2509 ; GFX6-NEXT: s_mov_b32 s6, -1
2510 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2511 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2512 ; GFX6-NEXT: s_mov_b32 s4, s0
2513 ; GFX6-NEXT: s_mov_b32 s5, s1
2514 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2515 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2516 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2517 ; GFX6-NEXT: buffer_wbinvl1
2518 ; GFX6-NEXT: s_endpgm
2520 ; GFX7-LABEL: global_system_acquire_monotonic_cmpxchg:
2521 ; GFX7: ; %bb.0: ; %entry
2522 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2523 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2524 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2525 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2526 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2527 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2528 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2529 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2530 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2531 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2532 ; GFX7-NEXT: buffer_wbinvl1_vol
2533 ; GFX7-NEXT: s_endpgm
2535 ; GFX10-WGP-LABEL: global_system_acquire_monotonic_cmpxchg:
2536 ; GFX10-WGP: ; %bb.0: ; %entry
2537 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2538 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2539 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2540 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2541 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2542 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2543 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2544 ; GFX10-WGP-NEXT: buffer_gl0_inv
2545 ; GFX10-WGP-NEXT: buffer_gl1_inv
2546 ; GFX10-WGP-NEXT: s_endpgm
2548 ; GFX10-CU-LABEL: global_system_acquire_monotonic_cmpxchg:
2549 ; GFX10-CU: ; %bb.0: ; %entry
2550 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2551 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2552 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2553 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2554 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2555 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2556 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2557 ; GFX10-CU-NEXT: buffer_gl0_inv
2558 ; GFX10-CU-NEXT: buffer_gl1_inv
2559 ; GFX10-CU-NEXT: s_endpgm
2561 ; SKIP-CACHE-INV-LABEL: global_system_acquire_monotonic_cmpxchg:
2562 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2563 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2564 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2565 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2566 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2567 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2568 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2569 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2570 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2571 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2572 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
2573 ; SKIP-CACHE-INV-NEXT: s_endpgm
2575 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_monotonic_cmpxchg:
2576 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2577 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2578 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2579 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2580 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2581 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2582 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2583 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2584 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2585 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2587 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_monotonic_cmpxchg:
2588 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2589 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2590 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2591 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2592 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2593 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2594 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2595 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2596 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2597 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2599 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_monotonic_cmpxchg:
2600 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2601 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2602 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2603 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2604 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2605 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
2606 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2607 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2608 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2610 ; GFX940-TGSPLIT-LABEL: global_system_acquire_monotonic_cmpxchg:
2611 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2612 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2613 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2614 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2615 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2616 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
2617 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2618 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2619 ; GFX940-TGSPLIT-NEXT: s_endpgm
2621 ; GFX11-WGP-LABEL: global_system_acquire_monotonic_cmpxchg:
2622 ; GFX11-WGP: ; %bb.0: ; %entry
2623 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2624 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2625 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2626 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2627 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2628 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2629 ; GFX11-WGP-NEXT: buffer_gl0_inv
2630 ; GFX11-WGP-NEXT: buffer_gl1_inv
2631 ; GFX11-WGP-NEXT: s_endpgm
2633 ; GFX11-CU-LABEL: global_system_acquire_monotonic_cmpxchg:
2634 ; GFX11-CU: ; %bb.0: ; %entry
2635 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2636 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2637 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2638 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2639 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2640 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2641 ; GFX11-CU-NEXT: buffer_gl0_inv
2642 ; GFX11-CU-NEXT: buffer_gl1_inv
2643 ; GFX11-CU-NEXT: s_endpgm
2644 i32 addrspace(1)* %out, i32 %in, i32 %old) {
2646 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
2647 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acquire monotonic
2651 define amdgpu_kernel void @global_system_release_monotonic_cmpxchg(
2652 ; GFX6-LABEL: global_system_release_monotonic_cmpxchg:
2653 ; GFX6: ; %bb.0: ; %entry
2654 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2655 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2656 ; GFX6-NEXT: s_mov_b32 s6, -1
2657 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2658 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2659 ; GFX6-NEXT: s_mov_b32 s4, s0
2660 ; GFX6-NEXT: s_mov_b32 s5, s1
2661 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2662 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2663 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2664 ; GFX6-NEXT: s_endpgm
2666 ; GFX7-LABEL: global_system_release_monotonic_cmpxchg:
2667 ; GFX7: ; %bb.0: ; %entry
2668 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2669 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2670 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2671 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2672 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2673 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2674 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2675 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2676 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2677 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2678 ; GFX7-NEXT: s_endpgm
2680 ; GFX10-WGP-LABEL: global_system_release_monotonic_cmpxchg:
2681 ; GFX10-WGP: ; %bb.0: ; %entry
2682 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2683 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2684 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2685 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2686 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2687 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2688 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2689 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2690 ; GFX10-WGP-NEXT: s_endpgm
2692 ; GFX10-CU-LABEL: global_system_release_monotonic_cmpxchg:
2693 ; GFX10-CU: ; %bb.0: ; %entry
2694 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2695 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2696 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2697 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2698 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2699 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2700 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2701 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2702 ; GFX10-CU-NEXT: s_endpgm
2704 ; SKIP-CACHE-INV-LABEL: global_system_release_monotonic_cmpxchg:
2705 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2706 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2707 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2708 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2709 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2710 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2711 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2712 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2713 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2714 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2715 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2716 ; SKIP-CACHE-INV-NEXT: s_endpgm
2718 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_monotonic_cmpxchg:
2719 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2720 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2721 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2722 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2723 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2724 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2725 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2726 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2727 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2729 ; GFX90A-TGSPLIT-LABEL: global_system_release_monotonic_cmpxchg:
2730 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2731 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2732 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2733 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2734 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2735 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2736 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2737 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2738 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2740 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_monotonic_cmpxchg:
2741 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2742 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2743 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2744 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2745 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2746 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2747 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2748 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
2749 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2751 ; GFX940-TGSPLIT-LABEL: global_system_release_monotonic_cmpxchg:
2752 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2753 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2754 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2755 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2756 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2757 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2758 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2759 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
2760 ; GFX940-TGSPLIT-NEXT: s_endpgm
2762 ; GFX11-WGP-LABEL: global_system_release_monotonic_cmpxchg:
2763 ; GFX11-WGP: ; %bb.0: ; %entry
2764 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2765 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2766 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2767 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2768 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2769 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2770 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2771 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2772 ; GFX11-WGP-NEXT: s_endpgm
2774 ; GFX11-CU-LABEL: global_system_release_monotonic_cmpxchg:
2775 ; GFX11-CU: ; %bb.0: ; %entry
2776 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2777 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2778 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2779 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2780 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2781 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2782 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2783 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2784 ; GFX11-CU-NEXT: s_endpgm
2785 i32 addrspace(1)* %out, i32 %in, i32 %old) {
2787 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
2788 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in release monotonic
2792 define amdgpu_kernel void @global_system_acq_rel_monotonic_cmpxchg(
2793 ; GFX6-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2794 ; GFX6: ; %bb.0: ; %entry
2795 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2796 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2797 ; GFX6-NEXT: s_mov_b32 s6, -1
2798 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2799 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2800 ; GFX6-NEXT: s_mov_b32 s4, s0
2801 ; GFX6-NEXT: s_mov_b32 s5, s1
2802 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2803 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2804 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2805 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2806 ; GFX6-NEXT: buffer_wbinvl1
2807 ; GFX6-NEXT: s_endpgm
2809 ; GFX7-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2810 ; GFX7: ; %bb.0: ; %entry
2811 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2812 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2813 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2814 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2815 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2816 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2817 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2818 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2819 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2820 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2821 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2822 ; GFX7-NEXT: buffer_wbinvl1_vol
2823 ; GFX7-NEXT: s_endpgm
2825 ; GFX10-WGP-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2826 ; GFX10-WGP: ; %bb.0: ; %entry
2827 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2828 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2829 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2830 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2831 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2832 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2833 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2834 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2835 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2836 ; GFX10-WGP-NEXT: buffer_gl0_inv
2837 ; GFX10-WGP-NEXT: buffer_gl1_inv
2838 ; GFX10-WGP-NEXT: s_endpgm
2840 ; GFX10-CU-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2841 ; GFX10-CU: ; %bb.0: ; %entry
2842 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2843 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
2844 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2845 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
2846 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
2847 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2848 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2849 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2850 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2851 ; GFX10-CU-NEXT: buffer_gl0_inv
2852 ; GFX10-CU-NEXT: buffer_gl1_inv
2853 ; GFX10-CU-NEXT: s_endpgm
2855 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2856 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2857 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2858 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
2859 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
2860 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2861 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2862 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
2863 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
2864 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2865 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2866 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2867 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
2868 ; SKIP-CACHE-INV-NEXT: s_endpgm
2870 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2871 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2872 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2873 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2874 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2875 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2876 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2877 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2878 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2879 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2880 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2881 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2882 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2884 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2885 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2886 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2887 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2888 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2889 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
2890 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2891 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2892 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
2893 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2894 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2895 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2896 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2898 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2899 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2900 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2901 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2902 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2903 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2904 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2905 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2906 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
2907 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
2908 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2909 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2911 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2912 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2913 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2914 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
2915 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2916 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2917 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2918 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2919 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
2920 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2921 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2922 ; GFX940-TGSPLIT-NEXT: s_endpgm
2924 ; GFX11-WGP-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2925 ; GFX11-WGP: ; %bb.0: ; %entry
2926 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2927 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
2928 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2929 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2930 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2931 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2932 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2933 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2934 ; GFX11-WGP-NEXT: buffer_gl0_inv
2935 ; GFX11-WGP-NEXT: buffer_gl1_inv
2936 ; GFX11-WGP-NEXT: s_endpgm
2938 ; GFX11-CU-LABEL: global_system_acq_rel_monotonic_cmpxchg:
2939 ; GFX11-CU: ; %bb.0: ; %entry
2940 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2941 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
2942 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2943 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2944 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2945 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2946 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
2947 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2948 ; GFX11-CU-NEXT: buffer_gl0_inv
2949 ; GFX11-CU-NEXT: buffer_gl1_inv
2950 ; GFX11-CU-NEXT: s_endpgm
2951 i32 addrspace(1)* %out, i32 %in, i32 %old) {
2953 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
2954 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acq_rel monotonic
2958 define amdgpu_kernel void @global_system_seq_cst_monotonic_cmpxchg(
2959 ; GFX6-LABEL: global_system_seq_cst_monotonic_cmpxchg:
2960 ; GFX6: ; %bb.0: ; %entry
2961 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2962 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
2963 ; GFX6-NEXT: s_mov_b32 s6, -1
2964 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2965 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
2966 ; GFX6-NEXT: s_mov_b32 s4, s0
2967 ; GFX6-NEXT: s_mov_b32 s5, s1
2968 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
2969 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2970 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
2971 ; GFX6-NEXT: s_waitcnt vmcnt(0)
2972 ; GFX6-NEXT: buffer_wbinvl1
2973 ; GFX6-NEXT: s_endpgm
2975 ; GFX7-LABEL: global_system_seq_cst_monotonic_cmpxchg:
2976 ; GFX7: ; %bb.0: ; %entry
2977 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2978 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2979 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2980 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2981 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2982 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2983 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2984 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2985 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2986 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2987 ; GFX7-NEXT: s_waitcnt vmcnt(0)
2988 ; GFX7-NEXT: buffer_wbinvl1_vol
2989 ; GFX7-NEXT: s_endpgm
2991 ; GFX10-WGP-LABEL: global_system_seq_cst_monotonic_cmpxchg:
2992 ; GFX10-WGP: ; %bb.0: ; %entry
2993 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2994 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
2995 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2996 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
2997 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
2998 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2999 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3000 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3001 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3002 ; GFX10-WGP-NEXT: buffer_gl0_inv
3003 ; GFX10-WGP-NEXT: buffer_gl1_inv
3004 ; GFX10-WGP-NEXT: s_endpgm
3006 ; GFX10-CU-LABEL: global_system_seq_cst_monotonic_cmpxchg:
3007 ; GFX10-CU: ; %bb.0: ; %entry
3008 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3009 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3010 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3011 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3012 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3013 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3014 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3015 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3016 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3017 ; GFX10-CU-NEXT: buffer_gl0_inv
3018 ; GFX10-CU-NEXT: buffer_gl1_inv
3019 ; GFX10-CU-NEXT: s_endpgm
3021 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_monotonic_cmpxchg:
3022 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3023 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3024 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3025 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3026 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3027 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3028 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3029 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3030 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3031 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3032 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3033 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
3034 ; SKIP-CACHE-INV-NEXT: s_endpgm
3036 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_monotonic_cmpxchg:
3037 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3038 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3039 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3040 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3041 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3042 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3043 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3044 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3045 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3046 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3047 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3048 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3050 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_monotonic_cmpxchg:
3051 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3052 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3053 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3054 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3055 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3056 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3057 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3058 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3059 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3060 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3061 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3062 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3064 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_monotonic_cmpxchg:
3065 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3066 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3067 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3068 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3069 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3070 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3071 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3072 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3073 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3074 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3075 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3077 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_monotonic_cmpxchg:
3078 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3079 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3080 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3081 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3082 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3083 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3084 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3085 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3086 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3087 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3088 ; GFX940-TGSPLIT-NEXT: s_endpgm
3090 ; GFX11-WGP-LABEL: global_system_seq_cst_monotonic_cmpxchg:
3091 ; GFX11-WGP: ; %bb.0: ; %entry
3092 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3093 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3094 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3095 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3096 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3097 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3098 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3099 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3100 ; GFX11-WGP-NEXT: buffer_gl0_inv
3101 ; GFX11-WGP-NEXT: buffer_gl1_inv
3102 ; GFX11-WGP-NEXT: s_endpgm
3104 ; GFX11-CU-LABEL: global_system_seq_cst_monotonic_cmpxchg:
3105 ; GFX11-CU: ; %bb.0: ; %entry
3106 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3107 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3108 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3109 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3110 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3111 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3112 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3113 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3114 ; GFX11-CU-NEXT: buffer_gl0_inv
3115 ; GFX11-CU-NEXT: buffer_gl1_inv
3116 ; GFX11-CU-NEXT: s_endpgm
3117 i32 addrspace(1)* %out, i32 %in, i32 %old) {
3119 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
3120 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in seq_cst monotonic
3124 define amdgpu_kernel void @global_system_monotonic_acquire_cmpxchg(
3125 ; GFX6-LABEL: global_system_monotonic_acquire_cmpxchg:
3126 ; GFX6: ; %bb.0: ; %entry
3127 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3128 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3129 ; GFX6-NEXT: s_mov_b32 s6, -1
3130 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3131 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3132 ; GFX6-NEXT: s_mov_b32 s4, s0
3133 ; GFX6-NEXT: s_mov_b32 s5, s1
3134 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3135 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3136 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3137 ; GFX6-NEXT: buffer_wbinvl1
3138 ; GFX6-NEXT: s_endpgm
3140 ; GFX7-LABEL: global_system_monotonic_acquire_cmpxchg:
3141 ; GFX7: ; %bb.0: ; %entry
3142 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3143 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3144 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3145 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3146 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3147 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3148 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3149 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3150 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3151 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3152 ; GFX7-NEXT: buffer_wbinvl1_vol
3153 ; GFX7-NEXT: s_endpgm
3155 ; GFX10-WGP-LABEL: global_system_monotonic_acquire_cmpxchg:
3156 ; GFX10-WGP: ; %bb.0: ; %entry
3157 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3158 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3159 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3160 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3161 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3162 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3163 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3164 ; GFX10-WGP-NEXT: buffer_gl0_inv
3165 ; GFX10-WGP-NEXT: buffer_gl1_inv
3166 ; GFX10-WGP-NEXT: s_endpgm
3168 ; GFX10-CU-LABEL: global_system_monotonic_acquire_cmpxchg:
3169 ; GFX10-CU: ; %bb.0: ; %entry
3170 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3171 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3172 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3173 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3174 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3175 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3176 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3177 ; GFX10-CU-NEXT: buffer_gl0_inv
3178 ; GFX10-CU-NEXT: buffer_gl1_inv
3179 ; GFX10-CU-NEXT: s_endpgm
3181 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_acquire_cmpxchg:
3182 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3183 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3184 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3185 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3186 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3187 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3188 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3189 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3190 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3191 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3192 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
3193 ; SKIP-CACHE-INV-NEXT: s_endpgm
3195 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_acquire_cmpxchg:
3196 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3197 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3198 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3199 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3200 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3201 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3202 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3203 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3204 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3205 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3207 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_acquire_cmpxchg:
3208 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3209 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3210 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3211 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3212 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3213 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3214 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3215 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3216 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3217 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3219 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_acquire_cmpxchg:
3220 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3221 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3222 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3223 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3224 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3225 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3226 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3227 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3228 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3230 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_acquire_cmpxchg:
3231 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3232 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3233 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3234 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3235 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3236 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3237 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3238 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3239 ; GFX940-TGSPLIT-NEXT: s_endpgm
3241 ; GFX11-WGP-LABEL: global_system_monotonic_acquire_cmpxchg:
3242 ; GFX11-WGP: ; %bb.0: ; %entry
3243 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3244 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3245 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3246 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3247 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3248 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3249 ; GFX11-WGP-NEXT: buffer_gl0_inv
3250 ; GFX11-WGP-NEXT: buffer_gl1_inv
3251 ; GFX11-WGP-NEXT: s_endpgm
3253 ; GFX11-CU-LABEL: global_system_monotonic_acquire_cmpxchg:
3254 ; GFX11-CU: ; %bb.0: ; %entry
3255 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3256 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3257 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3258 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3259 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3260 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3261 ; GFX11-CU-NEXT: buffer_gl0_inv
3262 ; GFX11-CU-NEXT: buffer_gl1_inv
3263 ; GFX11-CU-NEXT: s_endpgm
3264 i32 addrspace(1)* %out, i32 %in, i32 %old) {
3266 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
3267 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in monotonic acquire
3271 define amdgpu_kernel void @global_system_acquire_acquire_cmpxchg(
3272 ; GFX6-LABEL: global_system_acquire_acquire_cmpxchg:
3273 ; GFX6: ; %bb.0: ; %entry
3274 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3275 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3276 ; GFX6-NEXT: s_mov_b32 s6, -1
3277 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3278 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3279 ; GFX6-NEXT: s_mov_b32 s4, s0
3280 ; GFX6-NEXT: s_mov_b32 s5, s1
3281 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3282 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3283 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3284 ; GFX6-NEXT: buffer_wbinvl1
3285 ; GFX6-NEXT: s_endpgm
3287 ; GFX7-LABEL: global_system_acquire_acquire_cmpxchg:
3288 ; GFX7: ; %bb.0: ; %entry
3289 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3290 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3291 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3292 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3293 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3294 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3295 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3296 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3297 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3298 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3299 ; GFX7-NEXT: buffer_wbinvl1_vol
3300 ; GFX7-NEXT: s_endpgm
3302 ; GFX10-WGP-LABEL: global_system_acquire_acquire_cmpxchg:
3303 ; GFX10-WGP: ; %bb.0: ; %entry
3304 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3305 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3306 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3307 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3308 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3309 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3310 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3311 ; GFX10-WGP-NEXT: buffer_gl0_inv
3312 ; GFX10-WGP-NEXT: buffer_gl1_inv
3313 ; GFX10-WGP-NEXT: s_endpgm
3315 ; GFX10-CU-LABEL: global_system_acquire_acquire_cmpxchg:
3316 ; GFX10-CU: ; %bb.0: ; %entry
3317 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3318 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3319 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3320 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3321 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3322 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3323 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3324 ; GFX10-CU-NEXT: buffer_gl0_inv
3325 ; GFX10-CU-NEXT: buffer_gl1_inv
3326 ; GFX10-CU-NEXT: s_endpgm
3328 ; SKIP-CACHE-INV-LABEL: global_system_acquire_acquire_cmpxchg:
3329 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3330 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3331 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3332 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3333 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3334 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3335 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3336 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3337 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3338 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3339 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
3340 ; SKIP-CACHE-INV-NEXT: s_endpgm
3342 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_acquire_cmpxchg:
3343 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3344 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3345 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3346 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3347 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3348 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3349 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3350 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3351 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3352 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3354 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_acquire_cmpxchg:
3355 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3356 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3357 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3358 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3359 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3360 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3361 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3362 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3363 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3364 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3366 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_acquire_cmpxchg:
3367 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3368 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3369 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3370 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3371 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3372 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3373 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3374 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3375 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3377 ; GFX940-TGSPLIT-LABEL: global_system_acquire_acquire_cmpxchg:
3378 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3379 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3380 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3381 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3382 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3383 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3384 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3385 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3386 ; GFX940-TGSPLIT-NEXT: s_endpgm
3388 ; GFX11-WGP-LABEL: global_system_acquire_acquire_cmpxchg:
3389 ; GFX11-WGP: ; %bb.0: ; %entry
3390 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3391 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3392 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3393 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3394 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3395 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3396 ; GFX11-WGP-NEXT: buffer_gl0_inv
3397 ; GFX11-WGP-NEXT: buffer_gl1_inv
3398 ; GFX11-WGP-NEXT: s_endpgm
3400 ; GFX11-CU-LABEL: global_system_acquire_acquire_cmpxchg:
3401 ; GFX11-CU: ; %bb.0: ; %entry
3402 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3403 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3404 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3405 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3406 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3407 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3408 ; GFX11-CU-NEXT: buffer_gl0_inv
3409 ; GFX11-CU-NEXT: buffer_gl1_inv
3410 ; GFX11-CU-NEXT: s_endpgm
3411 i32 addrspace(1)* %out, i32 %in, i32 %old) {
3413 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
3414 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acquire acquire
3418 define amdgpu_kernel void @global_system_release_acquire_cmpxchg(
3419 ; GFX6-LABEL: global_system_release_acquire_cmpxchg:
3420 ; GFX6: ; %bb.0: ; %entry
3421 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3422 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3423 ; GFX6-NEXT: s_mov_b32 s6, -1
3424 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3425 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3426 ; GFX6-NEXT: s_mov_b32 s4, s0
3427 ; GFX6-NEXT: s_mov_b32 s5, s1
3428 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3429 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3430 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3431 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3432 ; GFX6-NEXT: buffer_wbinvl1
3433 ; GFX6-NEXT: s_endpgm
3435 ; GFX7-LABEL: global_system_release_acquire_cmpxchg:
3436 ; GFX7: ; %bb.0: ; %entry
3437 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3438 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3439 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3440 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3441 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3442 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3443 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3444 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3445 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3446 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3447 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3448 ; GFX7-NEXT: buffer_wbinvl1_vol
3449 ; GFX7-NEXT: s_endpgm
3451 ; GFX10-WGP-LABEL: global_system_release_acquire_cmpxchg:
3452 ; GFX10-WGP: ; %bb.0: ; %entry
3453 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3454 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3455 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3456 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3457 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3458 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3459 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3460 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3461 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3462 ; GFX10-WGP-NEXT: buffer_gl0_inv
3463 ; GFX10-WGP-NEXT: buffer_gl1_inv
3464 ; GFX10-WGP-NEXT: s_endpgm
3466 ; GFX10-CU-LABEL: global_system_release_acquire_cmpxchg:
3467 ; GFX10-CU: ; %bb.0: ; %entry
3468 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3469 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3470 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3471 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3472 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3473 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3474 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3475 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3476 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3477 ; GFX10-CU-NEXT: buffer_gl0_inv
3478 ; GFX10-CU-NEXT: buffer_gl1_inv
3479 ; GFX10-CU-NEXT: s_endpgm
3481 ; SKIP-CACHE-INV-LABEL: global_system_release_acquire_cmpxchg:
3482 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3483 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3484 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3485 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3486 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3487 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3488 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3489 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3490 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3491 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3492 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3493 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
3494 ; SKIP-CACHE-INV-NEXT: s_endpgm
3496 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_acquire_cmpxchg:
3497 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3498 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3499 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3500 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3501 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3502 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3503 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3504 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3505 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3506 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3507 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3508 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3510 ; GFX90A-TGSPLIT-LABEL: global_system_release_acquire_cmpxchg:
3511 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3512 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3513 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3514 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3515 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3516 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3517 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3518 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3519 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3520 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3521 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3522 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3524 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_acquire_cmpxchg:
3525 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3526 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3527 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3528 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3529 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3530 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3531 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3532 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3533 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3534 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3535 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3537 ; GFX940-TGSPLIT-LABEL: global_system_release_acquire_cmpxchg:
3538 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3539 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3540 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3541 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3542 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3543 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3544 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3545 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3546 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3547 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3548 ; GFX940-TGSPLIT-NEXT: s_endpgm
3550 ; GFX11-WGP-LABEL: global_system_release_acquire_cmpxchg:
3551 ; GFX11-WGP: ; %bb.0: ; %entry
3552 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3553 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3554 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3555 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3556 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3557 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3558 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3559 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3560 ; GFX11-WGP-NEXT: buffer_gl0_inv
3561 ; GFX11-WGP-NEXT: buffer_gl1_inv
3562 ; GFX11-WGP-NEXT: s_endpgm
3564 ; GFX11-CU-LABEL: global_system_release_acquire_cmpxchg:
3565 ; GFX11-CU: ; %bb.0: ; %entry
3566 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3567 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3568 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3569 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3570 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3571 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3572 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3573 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3574 ; GFX11-CU-NEXT: buffer_gl0_inv
3575 ; GFX11-CU-NEXT: buffer_gl1_inv
3576 ; GFX11-CU-NEXT: s_endpgm
3577 i32 addrspace(1)* %out, i32 %in, i32 %old) {
3579 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
3580 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in release acquire
3584 define amdgpu_kernel void @global_system_acq_rel_acquire_cmpxchg(
3585 ; GFX6-LABEL: global_system_acq_rel_acquire_cmpxchg:
3586 ; GFX6: ; %bb.0: ; %entry
3587 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3588 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3589 ; GFX6-NEXT: s_mov_b32 s6, -1
3590 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3591 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3592 ; GFX6-NEXT: s_mov_b32 s4, s0
3593 ; GFX6-NEXT: s_mov_b32 s5, s1
3594 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3595 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3596 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3597 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3598 ; GFX6-NEXT: buffer_wbinvl1
3599 ; GFX6-NEXT: s_endpgm
3601 ; GFX7-LABEL: global_system_acq_rel_acquire_cmpxchg:
3602 ; GFX7: ; %bb.0: ; %entry
3603 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3604 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3605 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3606 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3607 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3608 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3609 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3610 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3611 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3612 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3613 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3614 ; GFX7-NEXT: buffer_wbinvl1_vol
3615 ; GFX7-NEXT: s_endpgm
3617 ; GFX10-WGP-LABEL: global_system_acq_rel_acquire_cmpxchg:
3618 ; GFX10-WGP: ; %bb.0: ; %entry
3619 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3620 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3621 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3622 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3623 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3624 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3625 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3626 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3627 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3628 ; GFX10-WGP-NEXT: buffer_gl0_inv
3629 ; GFX10-WGP-NEXT: buffer_gl1_inv
3630 ; GFX10-WGP-NEXT: s_endpgm
3632 ; GFX10-CU-LABEL: global_system_acq_rel_acquire_cmpxchg:
3633 ; GFX10-CU: ; %bb.0: ; %entry
3634 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3635 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3636 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3637 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3638 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3639 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3640 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3641 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3642 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3643 ; GFX10-CU-NEXT: buffer_gl0_inv
3644 ; GFX10-CU-NEXT: buffer_gl1_inv
3645 ; GFX10-CU-NEXT: s_endpgm
3647 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_acquire_cmpxchg:
3648 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3649 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3650 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3651 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3652 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3653 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3654 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3655 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3656 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3657 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3658 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3659 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
3660 ; SKIP-CACHE-INV-NEXT: s_endpgm
3662 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_acquire_cmpxchg:
3663 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3664 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3665 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3666 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3667 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3668 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3669 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3670 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3671 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3672 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3673 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3674 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3676 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_acquire_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: buffer_wbl2
3683 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3684 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3685 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3686 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3687 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3688 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3690 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_acquire_cmpxchg:
3691 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3692 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3693 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3694 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3695 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3696 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3697 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3698 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3699 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3700 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3701 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3703 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_acquire_cmpxchg:
3704 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3705 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3706 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3707 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3708 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3709 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3710 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3711 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3712 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3713 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3714 ; GFX940-TGSPLIT-NEXT: s_endpgm
3716 ; GFX11-WGP-LABEL: global_system_acq_rel_acquire_cmpxchg:
3717 ; GFX11-WGP: ; %bb.0: ; %entry
3718 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3719 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3720 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3721 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3722 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3723 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3724 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3725 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3726 ; GFX11-WGP-NEXT: buffer_gl0_inv
3727 ; GFX11-WGP-NEXT: buffer_gl1_inv
3728 ; GFX11-WGP-NEXT: s_endpgm
3730 ; GFX11-CU-LABEL: global_system_acq_rel_acquire_cmpxchg:
3731 ; GFX11-CU: ; %bb.0: ; %entry
3732 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3733 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3734 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3735 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3736 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3737 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3738 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3739 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3740 ; GFX11-CU-NEXT: buffer_gl0_inv
3741 ; GFX11-CU-NEXT: buffer_gl1_inv
3742 ; GFX11-CU-NEXT: s_endpgm
3743 i32 addrspace(1)* %out, i32 %in, i32 %old) {
3745 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
3746 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acq_rel acquire
3750 define amdgpu_kernel void @global_system_seq_cst_acquire_cmpxchg(
3751 ; GFX6-LABEL: global_system_seq_cst_acquire_cmpxchg:
3752 ; GFX6: ; %bb.0: ; %entry
3753 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3754 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3755 ; GFX6-NEXT: s_mov_b32 s6, -1
3756 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3757 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3758 ; GFX6-NEXT: s_mov_b32 s4, s0
3759 ; GFX6-NEXT: s_mov_b32 s5, s1
3760 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3761 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3762 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3763 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3764 ; GFX6-NEXT: buffer_wbinvl1
3765 ; GFX6-NEXT: s_endpgm
3767 ; GFX7-LABEL: global_system_seq_cst_acquire_cmpxchg:
3768 ; GFX7: ; %bb.0: ; %entry
3769 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3770 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3771 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3772 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3773 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3774 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3775 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3776 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3777 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3778 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3779 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3780 ; GFX7-NEXT: buffer_wbinvl1_vol
3781 ; GFX7-NEXT: s_endpgm
3783 ; GFX10-WGP-LABEL: global_system_seq_cst_acquire_cmpxchg:
3784 ; GFX10-WGP: ; %bb.0: ; %entry
3785 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3786 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3787 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3788 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3789 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3790 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3791 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3792 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3793 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3794 ; GFX10-WGP-NEXT: buffer_gl0_inv
3795 ; GFX10-WGP-NEXT: buffer_gl1_inv
3796 ; GFX10-WGP-NEXT: s_endpgm
3798 ; GFX10-CU-LABEL: global_system_seq_cst_acquire_cmpxchg:
3799 ; GFX10-CU: ; %bb.0: ; %entry
3800 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3801 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3802 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3803 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3804 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3805 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3806 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3807 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3808 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3809 ; GFX10-CU-NEXT: buffer_gl0_inv
3810 ; GFX10-CU-NEXT: buffer_gl1_inv
3811 ; GFX10-CU-NEXT: s_endpgm
3813 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_acquire_cmpxchg:
3814 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3815 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3816 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3817 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3818 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3819 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3820 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3821 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3822 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3823 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3824 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3825 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
3826 ; SKIP-CACHE-INV-NEXT: s_endpgm
3828 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_acquire_cmpxchg:
3829 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3830 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3831 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3832 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3833 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3834 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3835 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3836 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3837 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3838 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3839 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3840 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3842 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_acquire_cmpxchg:
3843 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3844 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3845 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3846 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3847 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
3848 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3849 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3850 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3851 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3852 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3853 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3854 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3856 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_acquire_cmpxchg:
3857 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3858 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3859 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3860 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3861 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3862 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3863 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3864 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3865 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
3866 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3867 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3869 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_acquire_cmpxchg:
3870 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3871 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3872 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3873 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3874 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
3875 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3876 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3877 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
3878 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3879 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3880 ; GFX940-TGSPLIT-NEXT: s_endpgm
3882 ; GFX11-WGP-LABEL: global_system_seq_cst_acquire_cmpxchg:
3883 ; GFX11-WGP: ; %bb.0: ; %entry
3884 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3885 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
3886 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3887 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3888 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3889 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3890 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3891 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3892 ; GFX11-WGP-NEXT: buffer_gl0_inv
3893 ; GFX11-WGP-NEXT: buffer_gl1_inv
3894 ; GFX11-WGP-NEXT: s_endpgm
3896 ; GFX11-CU-LABEL: global_system_seq_cst_acquire_cmpxchg:
3897 ; GFX11-CU: ; %bb.0: ; %entry
3898 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3899 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
3900 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3901 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
3902 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3903 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3904 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
3905 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3906 ; GFX11-CU-NEXT: buffer_gl0_inv
3907 ; GFX11-CU-NEXT: buffer_gl1_inv
3908 ; GFX11-CU-NEXT: s_endpgm
3909 i32 addrspace(1)* %out, i32 %in, i32 %old) {
3911 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
3912 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in seq_cst acquire
3916 define amdgpu_kernel void @global_system_seq_cst_seq_cst_cmpxchg(
3917 ; GFX6-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
3918 ; GFX6: ; %bb.0: ; %entry
3919 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3920 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
3921 ; GFX6-NEXT: s_mov_b32 s6, -1
3922 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3923 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
3924 ; GFX6-NEXT: s_mov_b32 s4, s0
3925 ; GFX6-NEXT: s_mov_b32 s5, s1
3926 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
3927 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3928 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3929 ; GFX6-NEXT: s_waitcnt vmcnt(0)
3930 ; GFX6-NEXT: buffer_wbinvl1
3931 ; GFX6-NEXT: s_endpgm
3933 ; GFX7-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
3934 ; GFX7: ; %bb.0: ; %entry
3935 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3936 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3937 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3938 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3939 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3940 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3941 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3942 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3943 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3944 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3945 ; GFX7-NEXT: s_waitcnt vmcnt(0)
3946 ; GFX7-NEXT: buffer_wbinvl1_vol
3947 ; GFX7-NEXT: s_endpgm
3949 ; GFX10-WGP-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
3950 ; GFX10-WGP: ; %bb.0: ; %entry
3951 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3952 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
3953 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3954 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
3955 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
3956 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3957 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3958 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3959 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3960 ; GFX10-WGP-NEXT: buffer_gl0_inv
3961 ; GFX10-WGP-NEXT: buffer_gl1_inv
3962 ; GFX10-WGP-NEXT: s_endpgm
3964 ; GFX10-CU-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
3965 ; GFX10-CU: ; %bb.0: ; %entry
3966 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3967 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
3968 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3969 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
3970 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
3971 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3972 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3973 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
3974 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3975 ; GFX10-CU-NEXT: buffer_gl0_inv
3976 ; GFX10-CU-NEXT: buffer_gl1_inv
3977 ; GFX10-CU-NEXT: s_endpgm
3979 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
3980 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3981 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3982 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
3983 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
3984 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3985 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3986 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
3987 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
3988 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
3989 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3990 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
3991 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
3992 ; SKIP-CACHE-INV-NEXT: s_endpgm
3994 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
3995 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3996 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3997 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
3998 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3999 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4000 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4001 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4002 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
4003 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4004 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4005 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4006 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4008 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
4009 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4010 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4011 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4012 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4013 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4014 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4015 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4016 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
4017 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4018 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4019 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4020 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4022 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
4023 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4024 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4025 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4026 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4027 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4028 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4029 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4030 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
4031 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4032 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4033 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4035 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
4036 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4037 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4038 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4039 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4040 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4041 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4042 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4043 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
4044 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4045 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4046 ; GFX940-TGSPLIT-NEXT: s_endpgm
4048 ; GFX11-WGP-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
4049 ; GFX11-WGP: ; %bb.0: ; %entry
4050 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4051 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4052 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4053 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4054 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4055 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4056 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
4057 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4058 ; GFX11-WGP-NEXT: buffer_gl0_inv
4059 ; GFX11-WGP-NEXT: buffer_gl1_inv
4060 ; GFX11-WGP-NEXT: s_endpgm
4062 ; GFX11-CU-LABEL: global_system_seq_cst_seq_cst_cmpxchg:
4063 ; GFX11-CU: ; %bb.0: ; %entry
4064 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4065 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4066 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4067 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4068 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4069 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4070 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
4071 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4072 ; GFX11-CU-NEXT: buffer_gl0_inv
4073 ; GFX11-CU-NEXT: buffer_gl1_inv
4074 ; GFX11-CU-NEXT: s_endpgm
4075 i32 addrspace(1)* %out, i32 %in, i32 %old) {
4077 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
4078 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in seq_cst seq_cst
4082 define amdgpu_kernel void @global_system_monotonic_monotonic_ret_cmpxchg(
4083 ; GFX6-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4084 ; GFX6: ; %bb.0: ; %entry
4085 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4086 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4087 ; GFX6-NEXT: s_mov_b32 s6, -1
4088 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4089 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4090 ; GFX6-NEXT: s_mov_b32 s4, s0
4091 ; GFX6-NEXT: s_mov_b32 s5, s1
4092 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4093 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4094 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4095 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4096 ; GFX6-NEXT: s_endpgm
4098 ; GFX7-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4099 ; GFX7: ; %bb.0: ; %entry
4100 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4101 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4102 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4103 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4104 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4105 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4106 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4107 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4108 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4109 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4110 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4111 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4112 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4113 ; GFX7-NEXT: s_endpgm
4115 ; GFX10-WGP-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4116 ; GFX10-WGP: ; %bb.0: ; %entry
4117 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4118 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4119 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4120 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4121 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4122 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4123 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4124 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4125 ; GFX10-WGP-NEXT: s_endpgm
4127 ; GFX10-CU-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4128 ; GFX10-CU: ; %bb.0: ; %entry
4129 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4130 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4131 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4132 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4133 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4134 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4135 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4136 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4137 ; GFX10-CU-NEXT: s_endpgm
4139 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4140 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4141 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4142 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4143 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4144 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4145 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4146 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4147 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4148 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4149 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4150 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4151 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4152 ; SKIP-CACHE-INV-NEXT: s_endpgm
4154 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4155 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4156 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4157 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4158 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4159 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4160 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4161 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4162 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4163 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4165 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4166 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4167 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4168 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4169 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4170 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4171 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4172 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4173 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4174 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4176 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4177 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4178 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4179 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4180 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4181 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4182 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4183 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4184 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4185 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4187 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4188 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4189 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4190 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4191 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4192 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4193 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4194 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4195 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4196 ; GFX940-TGSPLIT-NEXT: s_endpgm
4198 ; GFX11-WGP-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4199 ; GFX11-WGP: ; %bb.0: ; %entry
4200 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4201 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4202 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4203 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4204 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4205 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4206 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4207 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4208 ; GFX11-WGP-NEXT: s_endpgm
4210 ; GFX11-CU-LABEL: global_system_monotonic_monotonic_ret_cmpxchg:
4211 ; GFX11-CU: ; %bb.0: ; %entry
4212 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4213 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4214 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4215 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4216 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4217 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4218 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4219 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4220 ; GFX11-CU-NEXT: s_endpgm
4221 i32 addrspace(1)* %out, i32 %in, i32 %old) {
4223 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
4224 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in monotonic monotonic
4225 %val0 = extractvalue { i32, i1 } %val, 0
4226 store i32 %val0, i32 addrspace(1)* %out, align 4
4230 define amdgpu_kernel void @global_system_acquire_monotonic_ret_cmpxchg(
4231 ; GFX6-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4232 ; GFX6: ; %bb.0: ; %entry
4233 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4234 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4235 ; GFX6-NEXT: s_mov_b32 s6, -1
4236 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4237 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4238 ; GFX6-NEXT: s_mov_b32 s4, s0
4239 ; GFX6-NEXT: s_mov_b32 s5, s1
4240 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4241 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4242 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4243 ; GFX6-NEXT: buffer_wbinvl1
4244 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4245 ; GFX6-NEXT: s_endpgm
4247 ; GFX7-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4248 ; GFX7: ; %bb.0: ; %entry
4249 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4250 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4251 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4252 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4253 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4254 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4255 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4256 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4257 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4258 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4259 ; GFX7-NEXT: buffer_wbinvl1_vol
4260 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4261 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4262 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4263 ; GFX7-NEXT: s_endpgm
4265 ; GFX10-WGP-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4266 ; GFX10-WGP: ; %bb.0: ; %entry
4267 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4268 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4269 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4270 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4271 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4272 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4273 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4274 ; GFX10-WGP-NEXT: buffer_gl0_inv
4275 ; GFX10-WGP-NEXT: buffer_gl1_inv
4276 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4277 ; GFX10-WGP-NEXT: s_endpgm
4279 ; GFX10-CU-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4280 ; GFX10-CU: ; %bb.0: ; %entry
4281 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4282 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4283 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4284 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4285 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4286 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4287 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4288 ; GFX10-CU-NEXT: buffer_gl0_inv
4289 ; GFX10-CU-NEXT: buffer_gl1_inv
4290 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4291 ; GFX10-CU-NEXT: s_endpgm
4293 ; SKIP-CACHE-INV-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4294 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4295 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4296 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4297 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4298 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4299 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4300 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4301 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4302 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4303 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4304 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4305 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4306 ; SKIP-CACHE-INV-NEXT: s_endpgm
4308 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4309 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4310 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4311 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4312 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4313 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4314 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4315 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4316 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4317 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4318 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4319 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4321 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4322 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4323 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4324 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4325 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4326 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4327 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4328 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4329 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4330 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4331 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4332 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4334 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4335 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4336 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4337 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4338 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4339 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4340 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4341 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4342 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4343 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4344 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4346 ; GFX940-TGSPLIT-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4347 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4348 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4349 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4350 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4351 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4352 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4353 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4354 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4355 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4356 ; GFX940-TGSPLIT-NEXT: s_endpgm
4358 ; GFX11-WGP-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4359 ; GFX11-WGP: ; %bb.0: ; %entry
4360 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4361 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4362 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4363 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4364 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4365 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4366 ; GFX11-WGP-NEXT: buffer_gl0_inv
4367 ; GFX11-WGP-NEXT: buffer_gl1_inv
4368 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4369 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4370 ; GFX11-WGP-NEXT: s_endpgm
4372 ; GFX11-CU-LABEL: global_system_acquire_monotonic_ret_cmpxchg:
4373 ; GFX11-CU: ; %bb.0: ; %entry
4374 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4375 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4376 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4377 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4378 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4379 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4380 ; GFX11-CU-NEXT: buffer_gl0_inv
4381 ; GFX11-CU-NEXT: buffer_gl1_inv
4382 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4383 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4384 ; GFX11-CU-NEXT: s_endpgm
4385 i32 addrspace(1)* %out, i32 %in, i32 %old) {
4387 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
4388 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acquire monotonic
4389 %val0 = extractvalue { i32, i1 } %val, 0
4390 store i32 %val0, i32 addrspace(1)* %out, align 4
4394 define amdgpu_kernel void @global_system_acq_rel_monotonic_ret_cmpxchg(
4395 ; GFX6-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4396 ; GFX6: ; %bb.0: ; %entry
4397 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4398 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4399 ; GFX6-NEXT: s_mov_b32 s6, -1
4400 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4401 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4402 ; GFX6-NEXT: s_mov_b32 s4, s0
4403 ; GFX6-NEXT: s_mov_b32 s5, s1
4404 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4405 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4406 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4407 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4408 ; GFX6-NEXT: buffer_wbinvl1
4409 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4410 ; GFX6-NEXT: s_endpgm
4412 ; GFX7-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4413 ; GFX7: ; %bb.0: ; %entry
4414 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4415 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4416 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4417 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4418 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4419 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4420 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4421 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4422 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4423 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4424 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4425 ; GFX7-NEXT: buffer_wbinvl1_vol
4426 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4427 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4428 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4429 ; GFX7-NEXT: s_endpgm
4431 ; GFX10-WGP-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4432 ; GFX10-WGP: ; %bb.0: ; %entry
4433 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4434 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4435 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4436 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4437 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4438 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4439 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4440 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4441 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4442 ; GFX10-WGP-NEXT: buffer_gl0_inv
4443 ; GFX10-WGP-NEXT: buffer_gl1_inv
4444 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4445 ; GFX10-WGP-NEXT: s_endpgm
4447 ; GFX10-CU-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4448 ; GFX10-CU: ; %bb.0: ; %entry
4449 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4450 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4451 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4452 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4453 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4454 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4455 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4456 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4457 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4458 ; GFX10-CU-NEXT: buffer_gl0_inv
4459 ; GFX10-CU-NEXT: buffer_gl1_inv
4460 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4461 ; GFX10-CU-NEXT: s_endpgm
4463 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4464 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4465 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4466 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4467 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4468 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4469 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4470 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4471 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4472 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4473 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4474 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4475 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4476 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4477 ; SKIP-CACHE-INV-NEXT: s_endpgm
4479 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4480 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4481 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4482 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4483 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4484 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4485 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4486 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4487 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4488 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4489 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4490 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4491 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4492 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4494 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4495 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4496 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4497 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4498 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4499 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4500 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4501 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4502 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4503 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4504 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4505 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4506 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4507 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4509 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4510 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4511 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4512 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4513 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4514 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4515 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4516 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4517 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4518 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4519 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4520 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4521 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4523 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4524 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4525 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4526 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4527 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4528 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4529 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4530 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4531 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4532 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4533 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4534 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4535 ; GFX940-TGSPLIT-NEXT: s_endpgm
4537 ; GFX11-WGP-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4538 ; GFX11-WGP: ; %bb.0: ; %entry
4539 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4540 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4541 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4542 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4543 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4544 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4545 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4546 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4547 ; GFX11-WGP-NEXT: buffer_gl0_inv
4548 ; GFX11-WGP-NEXT: buffer_gl1_inv
4549 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4550 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4551 ; GFX11-WGP-NEXT: s_endpgm
4553 ; GFX11-CU-LABEL: global_system_acq_rel_monotonic_ret_cmpxchg:
4554 ; GFX11-CU: ; %bb.0: ; %entry
4555 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4556 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4557 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4558 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4559 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4560 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4561 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4562 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4563 ; GFX11-CU-NEXT: buffer_gl0_inv
4564 ; GFX11-CU-NEXT: buffer_gl1_inv
4565 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4566 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4567 ; GFX11-CU-NEXT: s_endpgm
4568 i32 addrspace(1)* %out, i32 %in, i32 %old) {
4570 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
4571 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acq_rel monotonic
4572 %val0 = extractvalue { i32, i1 } %val, 0
4573 store i32 %val0, i32 addrspace(1)* %out, align 4
4577 define amdgpu_kernel void @global_system_seq_cst_monotonic_ret_cmpxchg(
4578 ; GFX6-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4579 ; GFX6: ; %bb.0: ; %entry
4580 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4581 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4582 ; GFX6-NEXT: s_mov_b32 s6, -1
4583 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4584 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4585 ; GFX6-NEXT: s_mov_b32 s4, s0
4586 ; GFX6-NEXT: s_mov_b32 s5, s1
4587 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4588 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4589 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4590 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4591 ; GFX6-NEXT: buffer_wbinvl1
4592 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4593 ; GFX6-NEXT: s_endpgm
4595 ; GFX7-LABEL: global_system_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: s_waitcnt vmcnt(0) lgkmcnt(0)
4606 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4607 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4608 ; GFX7-NEXT: buffer_wbinvl1_vol
4609 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4610 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4611 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4612 ; GFX7-NEXT: s_endpgm
4614 ; GFX10-WGP-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4615 ; GFX10-WGP: ; %bb.0: ; %entry
4616 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4617 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4618 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4619 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4620 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4621 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4622 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4623 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4624 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4625 ; GFX10-WGP-NEXT: buffer_gl0_inv
4626 ; GFX10-WGP-NEXT: buffer_gl1_inv
4627 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4628 ; GFX10-WGP-NEXT: s_endpgm
4630 ; GFX10-CU-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4631 ; GFX10-CU: ; %bb.0: ; %entry
4632 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4633 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4634 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4635 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4636 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4637 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4638 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4639 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4640 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4641 ; GFX10-CU-NEXT: buffer_gl0_inv
4642 ; GFX10-CU-NEXT: buffer_gl1_inv
4643 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4644 ; GFX10-CU-NEXT: s_endpgm
4646 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4647 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4648 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4649 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4650 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4651 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4652 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4653 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4654 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4655 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4656 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4657 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4658 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4659 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4660 ; SKIP-CACHE-INV-NEXT: s_endpgm
4662 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4663 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4664 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4665 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4666 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4667 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4668 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4669 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4670 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4671 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4672 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4673 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4674 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4675 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4677 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4678 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4679 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4680 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4681 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4682 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4683 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4684 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4685 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4686 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4687 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4688 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4689 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4690 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4692 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4693 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4694 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4695 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4696 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4697 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4698 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4699 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4700 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4701 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4702 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4703 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4704 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4706 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4707 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4708 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4709 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4710 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4711 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4712 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4713 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4714 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4715 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4716 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4717 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4718 ; GFX940-TGSPLIT-NEXT: s_endpgm
4720 ; GFX11-WGP-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4721 ; GFX11-WGP: ; %bb.0: ; %entry
4722 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4723 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4724 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4725 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4726 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4727 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4728 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4729 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4730 ; GFX11-WGP-NEXT: buffer_gl0_inv
4731 ; GFX11-WGP-NEXT: buffer_gl1_inv
4732 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4733 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4734 ; GFX11-WGP-NEXT: s_endpgm
4736 ; GFX11-CU-LABEL: global_system_seq_cst_monotonic_ret_cmpxchg:
4737 ; GFX11-CU: ; %bb.0: ; %entry
4738 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4739 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4740 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4741 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4742 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4743 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4744 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4745 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4746 ; GFX11-CU-NEXT: buffer_gl0_inv
4747 ; GFX11-CU-NEXT: buffer_gl1_inv
4748 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4749 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4750 ; GFX11-CU-NEXT: s_endpgm
4751 i32 addrspace(1)* %out, i32 %in, i32 %old) {
4753 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
4754 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in seq_cst monotonic
4755 %val0 = extractvalue { i32, i1 } %val, 0
4756 store i32 %val0, i32 addrspace(1)* %out, align 4
4760 define amdgpu_kernel void @global_system_monotonic_acquire_ret_cmpxchg(
4761 ; GFX6-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4762 ; GFX6: ; %bb.0: ; %entry
4763 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4764 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4765 ; GFX6-NEXT: s_mov_b32 s6, -1
4766 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4767 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4768 ; GFX6-NEXT: s_mov_b32 s4, s0
4769 ; GFX6-NEXT: s_mov_b32 s5, s1
4770 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4771 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4772 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4773 ; GFX6-NEXT: buffer_wbinvl1
4774 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4775 ; GFX6-NEXT: s_endpgm
4777 ; GFX7-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4778 ; GFX7: ; %bb.0: ; %entry
4779 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4780 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4781 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4782 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4783 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4784 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4785 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4786 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4787 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4788 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4789 ; GFX7-NEXT: buffer_wbinvl1_vol
4790 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4791 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4792 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4793 ; GFX7-NEXT: s_endpgm
4795 ; GFX10-WGP-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4796 ; GFX10-WGP: ; %bb.0: ; %entry
4797 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4798 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4799 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4800 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4801 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4802 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4803 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4804 ; GFX10-WGP-NEXT: buffer_gl0_inv
4805 ; GFX10-WGP-NEXT: buffer_gl1_inv
4806 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4807 ; GFX10-WGP-NEXT: s_endpgm
4809 ; GFX10-CU-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4810 ; GFX10-CU: ; %bb.0: ; %entry
4811 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4812 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4813 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4814 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4815 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4816 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4817 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4818 ; GFX10-CU-NEXT: buffer_gl0_inv
4819 ; GFX10-CU-NEXT: buffer_gl1_inv
4820 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4821 ; GFX10-CU-NEXT: s_endpgm
4823 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4824 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4825 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4826 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4827 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4828 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4829 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4830 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4831 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4832 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4833 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4834 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4835 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
4836 ; SKIP-CACHE-INV-NEXT: s_endpgm
4838 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4839 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4840 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4841 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4842 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4843 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4844 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4845 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4846 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4847 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4848 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4849 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4851 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4852 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4853 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4854 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4855 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4856 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
4857 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4858 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4859 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4860 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4861 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4862 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4864 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4865 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4866 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4867 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4868 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4869 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4870 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4871 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
4872 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4873 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4874 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4876 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4877 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4878 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4879 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
4880 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4881 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
4882 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
4883 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4884 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4885 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
4886 ; GFX940-TGSPLIT-NEXT: s_endpgm
4888 ; GFX11-WGP-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4889 ; GFX11-WGP: ; %bb.0: ; %entry
4890 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4891 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
4892 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4893 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4894 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4895 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
4896 ; GFX11-WGP-NEXT: buffer_gl0_inv
4897 ; GFX11-WGP-NEXT: buffer_gl1_inv
4898 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
4899 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4900 ; GFX11-WGP-NEXT: s_endpgm
4902 ; GFX11-CU-LABEL: global_system_monotonic_acquire_ret_cmpxchg:
4903 ; GFX11-CU: ; %bb.0: ; %entry
4904 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4905 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
4906 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4907 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
4908 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
4909 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
4910 ; GFX11-CU-NEXT: buffer_gl0_inv
4911 ; GFX11-CU-NEXT: buffer_gl1_inv
4912 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
4913 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4914 ; GFX11-CU-NEXT: s_endpgm
4915 i32 addrspace(1)* %out, i32 %in, i32 %old) {
4917 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
4918 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in monotonic acquire
4919 %val0 = extractvalue { i32, i1 } %val, 0
4920 store i32 %val0, i32 addrspace(1)* %out, align 4
4924 define amdgpu_kernel void @global_system_acquire_acquire_ret_cmpxchg(
4925 ; GFX6-LABEL: global_system_acquire_acquire_ret_cmpxchg:
4926 ; GFX6: ; %bb.0: ; %entry
4927 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4928 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
4929 ; GFX6-NEXT: s_mov_b32 s6, -1
4930 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4931 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
4932 ; GFX6-NEXT: s_mov_b32 s4, s0
4933 ; GFX6-NEXT: s_mov_b32 s5, s1
4934 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
4935 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4936 ; GFX6-NEXT: s_waitcnt vmcnt(0)
4937 ; GFX6-NEXT: buffer_wbinvl1
4938 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
4939 ; GFX6-NEXT: s_endpgm
4941 ; GFX7-LABEL: global_system_acquire_acquire_ret_cmpxchg:
4942 ; GFX7: ; %bb.0: ; %entry
4943 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4944 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4945 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4946 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4947 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4948 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4949 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4950 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4951 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4952 ; GFX7-NEXT: s_waitcnt vmcnt(0)
4953 ; GFX7-NEXT: buffer_wbinvl1_vol
4954 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4955 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4956 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4957 ; GFX7-NEXT: s_endpgm
4959 ; GFX10-WGP-LABEL: global_system_acquire_acquire_ret_cmpxchg:
4960 ; GFX10-WGP: ; %bb.0: ; %entry
4961 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4962 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
4963 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4964 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
4965 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
4966 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4967 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
4968 ; GFX10-WGP-NEXT: buffer_gl0_inv
4969 ; GFX10-WGP-NEXT: buffer_gl1_inv
4970 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
4971 ; GFX10-WGP-NEXT: s_endpgm
4973 ; GFX10-CU-LABEL: global_system_acquire_acquire_ret_cmpxchg:
4974 ; GFX10-CU: ; %bb.0: ; %entry
4975 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4976 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
4977 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4978 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
4979 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
4980 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
4981 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
4982 ; GFX10-CU-NEXT: buffer_gl0_inv
4983 ; GFX10-CU-NEXT: buffer_gl1_inv
4984 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
4985 ; GFX10-CU-NEXT: s_endpgm
4987 ; SKIP-CACHE-INV-LABEL: global_system_acquire_acquire_ret_cmpxchg:
4988 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4989 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4990 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
4991 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
4992 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4993 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4994 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
4995 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
4996 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
4997 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
4998 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
4999 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5000 ; SKIP-CACHE-INV-NEXT: s_endpgm
5002 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_acquire_ret_cmpxchg:
5003 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5004 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5005 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5006 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5007 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5008 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5009 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5010 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5011 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5012 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5013 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5015 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_acquire_ret_cmpxchg:
5016 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5017 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5018 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5019 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5020 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5021 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5022 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5023 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5024 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5025 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5026 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5028 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_acquire_ret_cmpxchg:
5029 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5030 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5031 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5032 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5033 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5034 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5035 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5036 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5037 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5038 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5040 ; GFX940-TGSPLIT-LABEL: global_system_acquire_acquire_ret_cmpxchg:
5041 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5042 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5043 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5044 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5045 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5046 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5047 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5048 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5049 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5050 ; GFX940-TGSPLIT-NEXT: s_endpgm
5052 ; GFX11-WGP-LABEL: global_system_acquire_acquire_ret_cmpxchg:
5053 ; GFX11-WGP: ; %bb.0: ; %entry
5054 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5055 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5056 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5057 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5058 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5059 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5060 ; GFX11-WGP-NEXT: buffer_gl0_inv
5061 ; GFX11-WGP-NEXT: buffer_gl1_inv
5062 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5063 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5064 ; GFX11-WGP-NEXT: s_endpgm
5066 ; GFX11-CU-LABEL: global_system_acquire_acquire_ret_cmpxchg:
5067 ; GFX11-CU: ; %bb.0: ; %entry
5068 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5069 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5070 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5071 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5072 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5073 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5074 ; GFX11-CU-NEXT: buffer_gl0_inv
5075 ; GFX11-CU-NEXT: buffer_gl1_inv
5076 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5077 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5078 ; GFX11-CU-NEXT: s_endpgm
5079 i32 addrspace(1)* %out, i32 %in, i32 %old) {
5081 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
5082 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acquire acquire
5083 %val0 = extractvalue { i32, i1 } %val, 0
5084 store i32 %val0, i32 addrspace(1)* %out, align 4
5088 define amdgpu_kernel void @global_system_release_acquire_ret_cmpxchg(
5089 ; GFX6-LABEL: global_system_release_acquire_ret_cmpxchg:
5090 ; GFX6: ; %bb.0: ; %entry
5091 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5092 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5093 ; GFX6-NEXT: s_mov_b32 s6, -1
5094 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5095 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5096 ; GFX6-NEXT: s_mov_b32 s4, s0
5097 ; GFX6-NEXT: s_mov_b32 s5, s1
5098 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5099 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5100 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5101 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5102 ; GFX6-NEXT: buffer_wbinvl1
5103 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5104 ; GFX6-NEXT: s_endpgm
5106 ; GFX7-LABEL: global_system_release_acquire_ret_cmpxchg:
5107 ; GFX7: ; %bb.0: ; %entry
5108 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5109 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5110 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5111 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5112 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5113 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5114 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5115 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5116 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5117 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5118 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5119 ; GFX7-NEXT: buffer_wbinvl1_vol
5120 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5121 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5122 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5123 ; GFX7-NEXT: s_endpgm
5125 ; GFX10-WGP-LABEL: global_system_release_acquire_ret_cmpxchg:
5126 ; GFX10-WGP: ; %bb.0: ; %entry
5127 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5128 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5129 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5130 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5131 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5132 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5133 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5134 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5135 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5136 ; GFX10-WGP-NEXT: buffer_gl0_inv
5137 ; GFX10-WGP-NEXT: buffer_gl1_inv
5138 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5139 ; GFX10-WGP-NEXT: s_endpgm
5141 ; GFX10-CU-LABEL: global_system_release_acquire_ret_cmpxchg:
5142 ; GFX10-CU: ; %bb.0: ; %entry
5143 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5144 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5145 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5146 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5147 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5148 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5149 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5150 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5151 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5152 ; GFX10-CU-NEXT: buffer_gl0_inv
5153 ; GFX10-CU-NEXT: buffer_gl1_inv
5154 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5155 ; GFX10-CU-NEXT: s_endpgm
5157 ; SKIP-CACHE-INV-LABEL: global_system_release_acquire_ret_cmpxchg:
5158 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5159 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5160 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5161 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5162 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5163 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5164 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5165 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5166 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5167 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5168 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5169 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5170 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5171 ; SKIP-CACHE-INV-NEXT: s_endpgm
5173 ; GFX90A-NOTTGSPLIT-LABEL: global_system_release_acquire_ret_cmpxchg:
5174 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5175 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5176 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5177 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5178 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5179 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5180 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5181 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5182 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5183 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5184 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5185 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5186 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5188 ; GFX90A-TGSPLIT-LABEL: global_system_release_acquire_ret_cmpxchg:
5189 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5190 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5191 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5192 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5193 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5194 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5195 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5196 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5197 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5198 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5199 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5200 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5201 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5203 ; GFX940-NOTTGSPLIT-LABEL: global_system_release_acquire_ret_cmpxchg:
5204 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5205 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5206 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5207 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5208 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5209 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5210 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5211 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5212 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5213 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5214 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5215 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5217 ; GFX940-TGSPLIT-LABEL: global_system_release_acquire_ret_cmpxchg:
5218 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5219 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5220 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5221 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5222 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5223 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5224 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5225 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5226 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5227 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5228 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5229 ; GFX940-TGSPLIT-NEXT: s_endpgm
5231 ; GFX11-WGP-LABEL: global_system_release_acquire_ret_cmpxchg:
5232 ; GFX11-WGP: ; %bb.0: ; %entry
5233 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5234 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5235 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5236 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5237 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5238 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5239 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5240 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5241 ; GFX11-WGP-NEXT: buffer_gl0_inv
5242 ; GFX11-WGP-NEXT: buffer_gl1_inv
5243 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5244 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5245 ; GFX11-WGP-NEXT: s_endpgm
5247 ; GFX11-CU-LABEL: global_system_release_acquire_ret_cmpxchg:
5248 ; GFX11-CU: ; %bb.0: ; %entry
5249 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5250 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5251 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5252 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5253 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5254 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5255 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5256 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5257 ; GFX11-CU-NEXT: buffer_gl0_inv
5258 ; GFX11-CU-NEXT: buffer_gl1_inv
5259 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5260 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5261 ; GFX11-CU-NEXT: s_endpgm
5262 i32 addrspace(1)* %out, i32 %in, i32 %old) {
5264 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
5265 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in release acquire
5266 %val0 = extractvalue { i32, i1 } %val, 0
5267 store i32 %val0, i32 addrspace(1)* %out, align 4
5271 define amdgpu_kernel void @global_system_acq_rel_acquire_ret_cmpxchg(
5272 ; GFX6-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5273 ; GFX6: ; %bb.0: ; %entry
5274 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5275 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5276 ; GFX6-NEXT: s_mov_b32 s6, -1
5277 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5278 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5279 ; GFX6-NEXT: s_mov_b32 s4, s0
5280 ; GFX6-NEXT: s_mov_b32 s5, s1
5281 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5282 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5283 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5284 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5285 ; GFX6-NEXT: buffer_wbinvl1
5286 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5287 ; GFX6-NEXT: s_endpgm
5289 ; GFX7-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5290 ; GFX7: ; %bb.0: ; %entry
5291 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5292 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5293 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5294 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5295 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5296 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5297 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5298 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5299 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5300 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5301 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5302 ; GFX7-NEXT: buffer_wbinvl1_vol
5303 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5304 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5305 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5306 ; GFX7-NEXT: s_endpgm
5308 ; GFX10-WGP-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5309 ; GFX10-WGP: ; %bb.0: ; %entry
5310 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5311 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5312 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5313 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5314 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5315 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5316 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5317 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5318 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5319 ; GFX10-WGP-NEXT: buffer_gl0_inv
5320 ; GFX10-WGP-NEXT: buffer_gl1_inv
5321 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5322 ; GFX10-WGP-NEXT: s_endpgm
5324 ; GFX10-CU-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5325 ; GFX10-CU: ; %bb.0: ; %entry
5326 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5327 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5328 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5329 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5330 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5331 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5332 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5333 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5334 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5335 ; GFX10-CU-NEXT: buffer_gl0_inv
5336 ; GFX10-CU-NEXT: buffer_gl1_inv
5337 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5338 ; GFX10-CU-NEXT: s_endpgm
5340 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5341 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5342 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5343 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5344 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5345 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5346 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5347 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5348 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5349 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5350 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5351 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5352 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5353 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5354 ; SKIP-CACHE-INV-NEXT: s_endpgm
5356 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5357 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5358 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5359 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5360 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5361 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5362 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5363 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5364 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5365 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5366 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5367 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5368 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5369 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5371 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5372 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5373 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5374 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5375 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5376 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5377 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5378 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5379 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5380 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5381 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5382 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5383 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5384 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5386 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5387 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5388 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5389 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5390 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5391 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5392 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5393 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5394 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5395 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5396 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5397 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5398 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5400 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5401 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5402 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5403 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5404 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5405 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5406 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5407 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5408 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5409 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5410 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5411 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5412 ; GFX940-TGSPLIT-NEXT: s_endpgm
5414 ; GFX11-WGP-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5415 ; GFX11-WGP: ; %bb.0: ; %entry
5416 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5417 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5418 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5419 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5420 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5421 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5422 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5423 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5424 ; GFX11-WGP-NEXT: buffer_gl0_inv
5425 ; GFX11-WGP-NEXT: buffer_gl1_inv
5426 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5427 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5428 ; GFX11-WGP-NEXT: s_endpgm
5430 ; GFX11-CU-LABEL: global_system_acq_rel_acquire_ret_cmpxchg:
5431 ; GFX11-CU: ; %bb.0: ; %entry
5432 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5433 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5434 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5435 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5436 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5437 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5438 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5439 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5440 ; GFX11-CU-NEXT: buffer_gl0_inv
5441 ; GFX11-CU-NEXT: buffer_gl1_inv
5442 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5443 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5444 ; GFX11-CU-NEXT: s_endpgm
5445 i32 addrspace(1)* %out, i32 %in, i32 %old) {
5447 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
5448 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acq_rel acquire
5449 %val0 = extractvalue { i32, i1 } %val, 0
5450 store i32 %val0, i32 addrspace(1)* %out, align 4
5454 define amdgpu_kernel void @global_system_seq_cst_acquire_ret_cmpxchg(
5455 ; GFX6-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5456 ; GFX6: ; %bb.0: ; %entry
5457 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5458 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5459 ; GFX6-NEXT: s_mov_b32 s6, -1
5460 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5461 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5462 ; GFX6-NEXT: s_mov_b32 s4, s0
5463 ; GFX6-NEXT: s_mov_b32 s5, s1
5464 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5465 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5466 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5467 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5468 ; GFX6-NEXT: buffer_wbinvl1
5469 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5470 ; GFX6-NEXT: s_endpgm
5472 ; GFX7-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5473 ; GFX7: ; %bb.0: ; %entry
5474 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5475 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5476 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5477 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5478 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5479 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5480 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5481 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5482 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5483 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5484 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5485 ; GFX7-NEXT: buffer_wbinvl1_vol
5486 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5487 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5488 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5489 ; GFX7-NEXT: s_endpgm
5491 ; GFX10-WGP-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5492 ; GFX10-WGP: ; %bb.0: ; %entry
5493 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5494 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5495 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5496 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5497 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5498 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5499 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5500 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5501 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5502 ; GFX10-WGP-NEXT: buffer_gl0_inv
5503 ; GFX10-WGP-NEXT: buffer_gl1_inv
5504 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5505 ; GFX10-WGP-NEXT: s_endpgm
5507 ; GFX10-CU-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5508 ; GFX10-CU: ; %bb.0: ; %entry
5509 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5510 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5511 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5512 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5513 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5514 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5515 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5516 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5517 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5518 ; GFX10-CU-NEXT: buffer_gl0_inv
5519 ; GFX10-CU-NEXT: buffer_gl1_inv
5520 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5521 ; GFX10-CU-NEXT: s_endpgm
5523 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5524 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5525 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5526 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5527 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5528 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5529 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5530 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5531 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5532 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5533 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5534 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5535 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5536 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5537 ; SKIP-CACHE-INV-NEXT: s_endpgm
5539 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5540 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5541 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5542 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5543 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5544 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5545 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5546 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5547 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5548 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5549 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5550 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5551 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5552 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5554 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5555 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5556 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5557 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5558 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5559 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5560 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5561 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5562 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5563 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5564 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5565 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5566 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5567 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5569 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5570 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5571 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5572 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5573 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5574 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5575 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5576 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5577 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5578 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5579 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5580 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5581 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5583 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5584 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5585 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5586 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5587 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5588 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5589 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5590 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5591 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5592 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5593 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5594 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5595 ; GFX940-TGSPLIT-NEXT: s_endpgm
5597 ; GFX11-WGP-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5598 ; GFX11-WGP: ; %bb.0: ; %entry
5599 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5600 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5601 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5602 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5603 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5604 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5605 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5606 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5607 ; GFX11-WGP-NEXT: buffer_gl0_inv
5608 ; GFX11-WGP-NEXT: buffer_gl1_inv
5609 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5610 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5611 ; GFX11-WGP-NEXT: s_endpgm
5613 ; GFX11-CU-LABEL: global_system_seq_cst_acquire_ret_cmpxchg:
5614 ; GFX11-CU: ; %bb.0: ; %entry
5615 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5616 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5617 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5618 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5619 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5620 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5621 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5622 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5623 ; GFX11-CU-NEXT: buffer_gl0_inv
5624 ; GFX11-CU-NEXT: buffer_gl1_inv
5625 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5626 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5627 ; GFX11-CU-NEXT: s_endpgm
5628 i32 addrspace(1)* %out, i32 %in, i32 %old) {
5630 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
5631 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in seq_cst acquire
5632 %val0 = extractvalue { i32, i1 } %val, 0
5633 store i32 %val0, i32 addrspace(1)* %out, align 4
5637 define amdgpu_kernel void @global_system_monotonic_seq_cst_ret_cmpxchg(
5638 ; GFX6-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5639 ; GFX6: ; %bb.0: ; %entry
5640 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5641 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5642 ; GFX6-NEXT: s_mov_b32 s6, -1
5643 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5644 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5645 ; GFX6-NEXT: s_mov_b32 s4, s0
5646 ; GFX6-NEXT: s_mov_b32 s5, s1
5647 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5648 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5649 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5650 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5651 ; GFX6-NEXT: buffer_wbinvl1
5652 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5653 ; GFX6-NEXT: s_endpgm
5655 ; GFX7-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5656 ; GFX7: ; %bb.0: ; %entry
5657 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5658 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5659 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5660 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5661 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5662 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5663 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5664 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5665 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5666 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5667 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5668 ; GFX7-NEXT: buffer_wbinvl1_vol
5669 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5670 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5671 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5672 ; GFX7-NEXT: s_endpgm
5674 ; GFX10-WGP-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5675 ; GFX10-WGP: ; %bb.0: ; %entry
5676 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5677 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5678 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5679 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5680 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5681 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5682 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5683 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5684 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5685 ; GFX10-WGP-NEXT: buffer_gl0_inv
5686 ; GFX10-WGP-NEXT: buffer_gl1_inv
5687 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5688 ; GFX10-WGP-NEXT: s_endpgm
5690 ; GFX10-CU-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5691 ; GFX10-CU: ; %bb.0: ; %entry
5692 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5693 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5694 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5695 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5696 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5697 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5698 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5699 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5700 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5701 ; GFX10-CU-NEXT: buffer_gl0_inv
5702 ; GFX10-CU-NEXT: buffer_gl1_inv
5703 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5704 ; GFX10-CU-NEXT: s_endpgm
5706 ; SKIP-CACHE-INV-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5707 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5708 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5709 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5710 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5711 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5712 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5713 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5714 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5715 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5716 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5717 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5718 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5719 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5720 ; SKIP-CACHE-INV-NEXT: s_endpgm
5722 ; GFX90A-NOTTGSPLIT-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5723 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5724 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5725 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5726 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5727 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5728 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5729 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5730 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5731 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5732 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5733 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5734 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5735 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5737 ; GFX90A-TGSPLIT-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5738 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5739 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5740 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5741 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5742 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5743 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5744 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5745 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5746 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5747 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5748 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5749 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5750 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5752 ; GFX940-NOTTGSPLIT-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5753 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5754 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5755 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5756 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5757 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5758 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5759 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5760 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5761 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5762 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5763 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5764 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5766 ; GFX940-TGSPLIT-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5767 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5768 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5769 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5770 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5771 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5772 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5773 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5774 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5775 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5776 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5777 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5778 ; GFX940-TGSPLIT-NEXT: s_endpgm
5780 ; GFX11-WGP-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5781 ; GFX11-WGP: ; %bb.0: ; %entry
5782 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5783 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5784 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5785 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5786 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5787 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5788 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5789 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5790 ; GFX11-WGP-NEXT: buffer_gl0_inv
5791 ; GFX11-WGP-NEXT: buffer_gl1_inv
5792 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5793 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5794 ; GFX11-WGP-NEXT: s_endpgm
5796 ; GFX11-CU-LABEL: global_system_monotonic_seq_cst_ret_cmpxchg:
5797 ; GFX11-CU: ; %bb.0: ; %entry
5798 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5799 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5800 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5801 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5802 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5803 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5804 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5805 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5806 ; GFX11-CU-NEXT: buffer_gl0_inv
5807 ; GFX11-CU-NEXT: buffer_gl1_inv
5808 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5809 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5810 ; GFX11-CU-NEXT: s_endpgm
5811 i32 addrspace(1)* %out, i32 %in, i32 %old) {
5813 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
5814 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in monotonic seq_cst
5815 %val0 = extractvalue { i32, i1 } %val, 0
5816 store i32 %val0, i32 addrspace(1)* %out, align 4
5820 define amdgpu_kernel void @global_system_acquire_seq_cst_ret_cmpxchg(
5821 ; GFX6-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5822 ; GFX6: ; %bb.0: ; %entry
5823 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5824 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
5825 ; GFX6-NEXT: s_mov_b32 s6, -1
5826 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5827 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
5828 ; GFX6-NEXT: s_mov_b32 s4, s0
5829 ; GFX6-NEXT: s_mov_b32 s5, s1
5830 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
5831 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5832 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5833 ; GFX6-NEXT: s_waitcnt vmcnt(0)
5834 ; GFX6-NEXT: buffer_wbinvl1
5835 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
5836 ; GFX6-NEXT: s_endpgm
5838 ; GFX7-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5839 ; GFX7: ; %bb.0: ; %entry
5840 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5841 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5842 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5843 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5844 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5845 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5846 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5847 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5848 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5849 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5850 ; GFX7-NEXT: s_waitcnt vmcnt(0)
5851 ; GFX7-NEXT: buffer_wbinvl1_vol
5852 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5853 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5854 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5855 ; GFX7-NEXT: s_endpgm
5857 ; GFX10-WGP-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5858 ; GFX10-WGP: ; %bb.0: ; %entry
5859 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5860 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
5861 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5862 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
5863 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
5864 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5865 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5866 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5867 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
5868 ; GFX10-WGP-NEXT: buffer_gl0_inv
5869 ; GFX10-WGP-NEXT: buffer_gl1_inv
5870 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
5871 ; GFX10-WGP-NEXT: s_endpgm
5873 ; GFX10-CU-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5874 ; GFX10-CU: ; %bb.0: ; %entry
5875 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5876 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
5877 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5878 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
5879 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
5880 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5881 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5882 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5883 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
5884 ; GFX10-CU-NEXT: buffer_gl0_inv
5885 ; GFX10-CU-NEXT: buffer_gl1_inv
5886 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
5887 ; GFX10-CU-NEXT: s_endpgm
5889 ; SKIP-CACHE-INV-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5890 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5891 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5892 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
5893 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
5894 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5895 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5896 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
5897 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
5898 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
5899 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5900 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
5901 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
5902 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
5903 ; SKIP-CACHE-INV-NEXT: s_endpgm
5905 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5906 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5907 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5908 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5909 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5910 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5911 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5912 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5913 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5914 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5915 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5916 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5917 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5918 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5920 ; GFX90A-TGSPLIT-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5921 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5922 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5923 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5924 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5925 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
5926 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5927 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5928 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
5929 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5930 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5931 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5932 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5933 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5935 ; GFX940-NOTTGSPLIT-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5936 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5937 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5938 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5939 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5940 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5941 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5942 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5943 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5944 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
5945 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5946 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5947 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5949 ; GFX940-TGSPLIT-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5950 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5951 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5952 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
5953 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5954 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
5955 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5956 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5957 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
5958 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5959 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5960 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
5961 ; GFX940-TGSPLIT-NEXT: s_endpgm
5963 ; GFX11-WGP-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5964 ; GFX11-WGP: ; %bb.0: ; %entry
5965 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5966 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
5967 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5968 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5969 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5970 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5971 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5972 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
5973 ; GFX11-WGP-NEXT: buffer_gl0_inv
5974 ; GFX11-WGP-NEXT: buffer_gl1_inv
5975 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
5976 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5977 ; GFX11-WGP-NEXT: s_endpgm
5979 ; GFX11-CU-LABEL: global_system_acquire_seq_cst_ret_cmpxchg:
5980 ; GFX11-CU: ; %bb.0: ; %entry
5981 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5982 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
5983 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5984 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
5985 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5986 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5987 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
5988 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
5989 ; GFX11-CU-NEXT: buffer_gl0_inv
5990 ; GFX11-CU-NEXT: buffer_gl1_inv
5991 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
5992 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5993 ; GFX11-CU-NEXT: s_endpgm
5994 i32 addrspace(1)* %out, i32 %in, i32 %old) {
5996 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
5997 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acquire seq_cst
5998 %val0 = extractvalue { i32, i1 } %val, 0
5999 store i32 %val0, i32 addrspace(1)* %out, align 4
6003 define amdgpu_kernel void @global_system_relese_seq_cst_ret_cmpxchg(
6004 ; GFX6-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6005 ; GFX6: ; %bb.0: ; %entry
6006 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6007 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6008 ; GFX6-NEXT: s_mov_b32 s6, -1
6009 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6010 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6011 ; GFX6-NEXT: s_mov_b32 s4, s0
6012 ; GFX6-NEXT: s_mov_b32 s5, s1
6013 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
6014 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6015 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6016 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6017 ; GFX6-NEXT: buffer_wbinvl1
6018 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6019 ; GFX6-NEXT: s_endpgm
6021 ; GFX7-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6022 ; GFX7: ; %bb.0: ; %entry
6023 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6024 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6025 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6026 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6027 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6028 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6029 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6030 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6031 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6032 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6033 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6034 ; GFX7-NEXT: buffer_wbinvl1_vol
6035 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6036 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6037 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6038 ; GFX7-NEXT: s_endpgm
6040 ; GFX10-WGP-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6041 ; GFX10-WGP: ; %bb.0: ; %entry
6042 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6043 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
6044 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6045 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
6046 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
6047 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6048 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6049 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6050 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6051 ; GFX10-WGP-NEXT: buffer_gl0_inv
6052 ; GFX10-WGP-NEXT: buffer_gl1_inv
6053 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
6054 ; GFX10-WGP-NEXT: s_endpgm
6056 ; GFX10-CU-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6057 ; GFX10-CU: ; %bb.0: ; %entry
6058 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6059 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
6060 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6061 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
6062 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
6063 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6064 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6065 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6066 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6067 ; GFX10-CU-NEXT: buffer_gl0_inv
6068 ; GFX10-CU-NEXT: buffer_gl1_inv
6069 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
6070 ; GFX10-CU-NEXT: s_endpgm
6072 ; SKIP-CACHE-INV-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6073 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6074 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6075 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6076 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6077 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6078 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6079 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6080 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6081 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
6082 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6083 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6084 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6085 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6086 ; SKIP-CACHE-INV-NEXT: s_endpgm
6088 ; GFX90A-NOTTGSPLIT-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6089 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6090 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6091 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6092 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6093 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6094 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6095 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6096 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6097 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6098 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6099 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6100 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6101 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6103 ; GFX90A-TGSPLIT-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6104 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6105 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6106 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6107 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6108 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6109 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6110 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6111 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6112 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6113 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6114 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6115 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6116 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6118 ; GFX940-NOTTGSPLIT-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6119 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6120 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6121 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6122 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6123 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6124 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6125 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6126 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
6127 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6128 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6129 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6130 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6132 ; GFX940-TGSPLIT-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6133 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6134 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6135 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6136 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6137 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6138 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6139 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6140 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
6141 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6142 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6143 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6144 ; GFX940-TGSPLIT-NEXT: s_endpgm
6146 ; GFX11-WGP-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6147 ; GFX11-WGP: ; %bb.0: ; %entry
6148 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6149 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
6150 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6151 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6152 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6153 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6154 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6155 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6156 ; GFX11-WGP-NEXT: buffer_gl0_inv
6157 ; GFX11-WGP-NEXT: buffer_gl1_inv
6158 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
6159 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6160 ; GFX11-WGP-NEXT: s_endpgm
6162 ; GFX11-CU-LABEL: global_system_relese_seq_cst_ret_cmpxchg:
6163 ; GFX11-CU: ; %bb.0: ; %entry
6164 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6165 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
6166 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6167 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6168 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6169 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6170 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6171 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6172 ; GFX11-CU-NEXT: buffer_gl0_inv
6173 ; GFX11-CU-NEXT: buffer_gl1_inv
6174 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
6175 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6176 ; GFX11-CU-NEXT: s_endpgm
6177 i32 addrspace(1)* %out, i32 %in, i32 %old) {
6179 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
6180 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in release seq_cst
6181 %val0 = extractvalue { i32, i1 } %val, 0
6182 store i32 %val0, i32 addrspace(1)* %out, align 4
6186 define amdgpu_kernel void @global_system_acq_rel_seq_cst_ret_cmpxchg(
6187 ; GFX6-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6188 ; GFX6: ; %bb.0: ; %entry
6189 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6190 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6191 ; GFX6-NEXT: s_mov_b32 s6, -1
6192 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6193 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6194 ; GFX6-NEXT: s_mov_b32 s4, s0
6195 ; GFX6-NEXT: s_mov_b32 s5, s1
6196 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
6197 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6198 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6199 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6200 ; GFX6-NEXT: buffer_wbinvl1
6201 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6202 ; GFX6-NEXT: s_endpgm
6204 ; GFX7-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6205 ; GFX7: ; %bb.0: ; %entry
6206 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6207 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6208 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6209 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6210 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6211 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6212 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6213 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6214 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6215 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6216 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6217 ; GFX7-NEXT: buffer_wbinvl1_vol
6218 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6219 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6220 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6221 ; GFX7-NEXT: s_endpgm
6223 ; GFX10-WGP-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6224 ; GFX10-WGP: ; %bb.0: ; %entry
6225 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6226 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
6227 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6228 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
6229 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
6230 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6231 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6232 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6233 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6234 ; GFX10-WGP-NEXT: buffer_gl0_inv
6235 ; GFX10-WGP-NEXT: buffer_gl1_inv
6236 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
6237 ; GFX10-WGP-NEXT: s_endpgm
6239 ; GFX10-CU-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6240 ; GFX10-CU: ; %bb.0: ; %entry
6241 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6242 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
6243 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6244 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
6245 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
6246 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6247 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6248 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6249 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6250 ; GFX10-CU-NEXT: buffer_gl0_inv
6251 ; GFX10-CU-NEXT: buffer_gl1_inv
6252 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
6253 ; GFX10-CU-NEXT: s_endpgm
6255 ; SKIP-CACHE-INV-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6256 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6257 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6258 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6259 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6260 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6261 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6262 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6263 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6264 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
6265 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6266 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6267 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6268 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6269 ; SKIP-CACHE-INV-NEXT: s_endpgm
6271 ; GFX90A-NOTTGSPLIT-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6272 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6273 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6274 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6275 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6276 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6277 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6278 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6279 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6280 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6281 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6282 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6283 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6284 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6286 ; GFX90A-TGSPLIT-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6287 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6288 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6289 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6290 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6291 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6292 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6293 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6294 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6295 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6296 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6297 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6298 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6299 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6301 ; GFX940-NOTTGSPLIT-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6302 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6303 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6304 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6305 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6306 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6307 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6308 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6309 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
6310 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6311 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6312 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6313 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6315 ; GFX940-TGSPLIT-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6316 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6317 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6318 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6319 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6320 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6321 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6322 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6323 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
6324 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6325 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6326 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6327 ; GFX940-TGSPLIT-NEXT: s_endpgm
6329 ; GFX11-WGP-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
6330 ; GFX11-WGP: ; %bb.0: ; %entry
6331 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6332 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
6333 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6334 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6335 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6336 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6337 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6338 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6339 ; GFX11-WGP-NEXT: buffer_gl0_inv
6340 ; GFX11-WGP-NEXT: buffer_gl1_inv
6341 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
6342 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6343 ; GFX11-WGP-NEXT: s_endpgm
6345 ; GFX11-CU-LABEL: global_system_acq_rel_seq_cst_ret_cmpxchg:
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 v2, 0
6349 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6350 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6351 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6352 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6353 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6354 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6355 ; GFX11-CU-NEXT: buffer_gl0_inv
6356 ; GFX11-CU-NEXT: buffer_gl1_inv
6357 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
6358 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6359 ; GFX11-CU-NEXT: s_endpgm
6360 i32 addrspace(1)* %out, i32 %in, i32 %old) {
6362 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
6363 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in acq_rel seq_cst
6364 %val0 = extractvalue { i32, i1 } %val, 0
6365 store i32 %val0, i32 addrspace(1)* %out, align 4
6369 define amdgpu_kernel void @global_system_seq_cst_seq_cst_ret_cmpxchg(
6370 ; GFX6-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6371 ; GFX6: ; %bb.0: ; %entry
6372 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6373 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6374 ; GFX6-NEXT: s_mov_b32 s6, -1
6375 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6376 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
6377 ; GFX6-NEXT: s_mov_b32 s4, s0
6378 ; GFX6-NEXT: s_mov_b32 s5, s1
6379 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
6380 ; GFX6-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6381 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6382 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6383 ; GFX6-NEXT: buffer_wbinvl1
6384 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6385 ; GFX6-NEXT: s_endpgm
6387 ; GFX7-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6388 ; GFX7: ; %bb.0: ; %entry
6389 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6390 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6391 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6392 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6393 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6394 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6395 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6396 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6397 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6398 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6399 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6400 ; GFX7-NEXT: buffer_wbinvl1_vol
6401 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6402 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6403 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6404 ; GFX7-NEXT: s_endpgm
6406 ; GFX10-WGP-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6407 ; GFX10-WGP: ; %bb.0: ; %entry
6408 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6409 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
6410 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6411 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
6412 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
6413 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6414 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6415 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6416 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6417 ; GFX10-WGP-NEXT: buffer_gl0_inv
6418 ; GFX10-WGP-NEXT: buffer_gl1_inv
6419 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
6420 ; GFX10-WGP-NEXT: s_endpgm
6422 ; GFX10-CU-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6423 ; GFX10-CU: ; %bb.0: ; %entry
6424 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6425 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
6426 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6427 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
6428 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
6429 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6430 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6431 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6432 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6433 ; GFX10-CU-NEXT: buffer_gl0_inv
6434 ; GFX10-CU-NEXT: buffer_gl1_inv
6435 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
6436 ; GFX10-CU-NEXT: s_endpgm
6438 ; SKIP-CACHE-INV-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6439 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6440 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6441 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6442 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6443 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6444 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
6445 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6446 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6447 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
6448 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6449 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
6450 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6451 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6452 ; SKIP-CACHE-INV-NEXT: s_endpgm
6454 ; GFX90A-NOTTGSPLIT-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6455 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6456 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6457 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6458 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6459 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6460 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6461 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6462 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6463 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6464 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6465 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6466 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6467 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6469 ; GFX90A-TGSPLIT-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6470 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6471 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6472 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6473 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6474 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
6475 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6476 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6477 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
6478 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6479 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6480 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6481 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6482 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6484 ; GFX940-NOTTGSPLIT-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6485 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6486 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6487 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6488 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6489 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6490 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6491 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6492 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
6493 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6494 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6495 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6496 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6498 ; GFX940-TGSPLIT-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6499 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6500 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6501 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
6502 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6503 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
6504 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6505 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6506 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
6507 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6508 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6509 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
6510 ; GFX940-TGSPLIT-NEXT: s_endpgm
6512 ; GFX11-WGP-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6513 ; GFX11-WGP: ; %bb.0: ; %entry
6514 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6515 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
6516 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6517 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6518 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6519 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6520 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6521 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6522 ; GFX11-WGP-NEXT: buffer_gl0_inv
6523 ; GFX11-WGP-NEXT: buffer_gl1_inv
6524 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
6525 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6526 ; GFX11-WGP-NEXT: s_endpgm
6528 ; GFX11-CU-LABEL: global_system_seq_cst_seq_cst_ret_cmpxchg:
6529 ; GFX11-CU: ; %bb.0: ; %entry
6530 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6531 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
6532 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6533 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
6534 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6535 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6536 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
6537 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6538 ; GFX11-CU-NEXT: buffer_gl0_inv
6539 ; GFX11-CU-NEXT: buffer_gl1_inv
6540 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
6541 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6542 ; GFX11-CU-NEXT: s_endpgm
6543 i32 addrspace(1)* %out, i32 %in, i32 %old) {
6545 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
6546 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in seq_cst seq_cst
6547 %val0 = extractvalue { i32, i1 } %val, 0
6548 store i32 %val0, i32 addrspace(1)* %out, align 4
6552 define amdgpu_kernel void @global_system_one_as_unordered_load(
6553 ; GFX6-LABEL: global_system_one_as_unordered_load:
6554 ; GFX6: ; %bb.0: ; %entry
6555 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6556 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6557 ; GFX6-NEXT: s_mov_b32 s6, -1
6558 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6559 ; GFX6-NEXT: s_mov_b32 s4, s0
6560 ; GFX6-NEXT: s_mov_b32 s5, s1
6561 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0
6562 ; GFX6-NEXT: s_mov_b32 s4, s2
6563 ; GFX6-NEXT: s_mov_b32 s5, s3
6564 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6565 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6566 ; GFX6-NEXT: s_endpgm
6568 ; GFX7-LABEL: global_system_one_as_unordered_load:
6569 ; GFX7: ; %bb.0: ; %entry
6570 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6571 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6572 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6573 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6574 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
6575 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
6576 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
6577 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6578 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6579 ; GFX7-NEXT: s_endpgm
6581 ; GFX10-WGP-LABEL: global_system_one_as_unordered_load:
6582 ; GFX10-WGP: ; %bb.0: ; %entry
6583 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6584 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6585 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6586 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1]
6587 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6588 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
6589 ; GFX10-WGP-NEXT: s_endpgm
6591 ; GFX10-CU-LABEL: global_system_one_as_unordered_load:
6592 ; GFX10-CU: ; %bb.0: ; %entry
6593 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6594 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6595 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6596 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1]
6597 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6598 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
6599 ; GFX10-CU-NEXT: s_endpgm
6601 ; SKIP-CACHE-INV-LABEL: global_system_one_as_unordered_load:
6602 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6603 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6604 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6605 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6606 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6607 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6608 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6609 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0
6610 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
6611 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
6612 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6613 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6614 ; SKIP-CACHE-INV-NEXT: s_endpgm
6616 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_unordered_load:
6617 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6618 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6619 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6620 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6621 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6622 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6623 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6624 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6626 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_unordered_load:
6627 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6628 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6629 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6630 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6631 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6632 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6633 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6634 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6636 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_unordered_load:
6637 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6638 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6639 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6640 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6641 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6642 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6643 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6644 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6646 ; GFX940-TGSPLIT-LABEL: global_system_one_as_unordered_load:
6647 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6648 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6649 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6650 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6651 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1]
6652 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6653 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6654 ; GFX940-TGSPLIT-NEXT: s_endpgm
6656 ; GFX11-WGP-LABEL: global_system_one_as_unordered_load:
6657 ; GFX11-WGP: ; %bb.0: ; %entry
6658 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6659 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6660 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6661 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1]
6662 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6663 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
6664 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6665 ; GFX11-WGP-NEXT: s_endpgm
6667 ; GFX11-CU-LABEL: global_system_one_as_unordered_load:
6668 ; GFX11-CU: ; %bb.0: ; %entry
6669 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6670 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6671 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6672 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1]
6673 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6674 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
6675 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6676 ; GFX11-CU-NEXT: s_endpgm
6677 i32 addrspace(1)* %in, i32 addrspace(1)* %out) {
6679 %val = load atomic i32, i32 addrspace(1)* %in syncscope("one-as") unordered, align 4
6680 store i32 %val, i32 addrspace(1)* %out
6684 define amdgpu_kernel void @global_system_one_as_monotonic_load(
6685 ; GFX6-LABEL: global_system_one_as_monotonic_load:
6686 ; GFX6: ; %bb.0: ; %entry
6687 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6688 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6689 ; GFX6-NEXT: s_mov_b32 s6, -1
6690 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6691 ; GFX6-NEXT: s_mov_b32 s4, s0
6692 ; GFX6-NEXT: s_mov_b32 s5, s1
6693 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
6694 ; GFX6-NEXT: s_mov_b32 s4, s2
6695 ; GFX6-NEXT: s_mov_b32 s5, s3
6696 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6697 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6698 ; GFX6-NEXT: s_endpgm
6700 ; GFX7-LABEL: global_system_one_as_monotonic_load:
6701 ; GFX7: ; %bb.0: ; %entry
6702 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6703 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6704 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6705 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6706 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
6707 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
6708 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
6709 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6710 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6711 ; GFX7-NEXT: s_endpgm
6713 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_load:
6714 ; GFX10-WGP: ; %bb.0: ; %entry
6715 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6716 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6717 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6718 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
6719 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6720 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
6721 ; GFX10-WGP-NEXT: s_endpgm
6723 ; GFX10-CU-LABEL: global_system_one_as_monotonic_load:
6724 ; GFX10-CU: ; %bb.0: ; %entry
6725 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6726 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6727 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6728 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
6729 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6730 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
6731 ; GFX10-CU-NEXT: s_endpgm
6733 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_load:
6734 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6735 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6736 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6737 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6738 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6739 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6740 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6741 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
6742 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
6743 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
6744 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6745 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6746 ; SKIP-CACHE-INV-NEXT: s_endpgm
6748 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_load:
6749 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6750 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6751 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6752 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6753 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
6754 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6755 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6756 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6758 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_load:
6759 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6760 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6761 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6762 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6763 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
6764 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6765 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6766 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6768 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_load:
6769 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6770 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6771 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6772 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6773 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
6774 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6775 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6776 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6778 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_load:
6779 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6780 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6781 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6782 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6783 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
6784 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6785 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6786 ; GFX940-TGSPLIT-NEXT: s_endpgm
6788 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_load:
6789 ; GFX11-WGP: ; %bb.0: ; %entry
6790 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6791 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6792 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6793 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1] glc
6794 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6795 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
6796 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6797 ; GFX11-WGP-NEXT: s_endpgm
6799 ; GFX11-CU-LABEL: global_system_one_as_monotonic_load:
6800 ; GFX11-CU: ; %bb.0: ; %entry
6801 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6802 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6803 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6804 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1] glc
6805 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6806 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
6807 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6808 ; GFX11-CU-NEXT: s_endpgm
6809 i32 addrspace(1)* %in, i32 addrspace(1)* %out) {
6811 %val = load atomic i32, i32 addrspace(1)* %in syncscope("one-as") monotonic, align 4
6812 store i32 %val, i32 addrspace(1)* %out
6816 define amdgpu_kernel void @global_system_one_as_acquire_load(
6817 ; GFX6-LABEL: global_system_one_as_acquire_load:
6818 ; GFX6: ; %bb.0: ; %entry
6819 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6820 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6821 ; GFX6-NEXT: s_mov_b32 s6, -1
6822 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6823 ; GFX6-NEXT: s_mov_b32 s4, s0
6824 ; GFX6-NEXT: s_mov_b32 s5, s1
6825 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
6826 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6827 ; GFX6-NEXT: buffer_wbinvl1
6828 ; GFX6-NEXT: s_mov_b32 s4, s2
6829 ; GFX6-NEXT: s_mov_b32 s5, s3
6830 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6831 ; GFX6-NEXT: s_endpgm
6833 ; GFX7-LABEL: global_system_one_as_acquire_load:
6834 ; GFX7: ; %bb.0: ; %entry
6835 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6836 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6837 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6838 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6839 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
6840 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6841 ; GFX7-NEXT: buffer_wbinvl1_vol
6842 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
6843 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
6844 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6845 ; GFX7-NEXT: s_endpgm
6847 ; GFX10-WGP-LABEL: global_system_one_as_acquire_load:
6848 ; GFX10-WGP: ; %bb.0: ; %entry
6849 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6850 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
6851 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6852 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
6853 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
6854 ; GFX10-WGP-NEXT: buffer_gl0_inv
6855 ; GFX10-WGP-NEXT: buffer_gl1_inv
6856 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
6857 ; GFX10-WGP-NEXT: s_endpgm
6859 ; GFX10-CU-LABEL: global_system_one_as_acquire_load:
6860 ; GFX10-CU: ; %bb.0: ; %entry
6861 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6862 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
6863 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6864 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
6865 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
6866 ; GFX10-CU-NEXT: buffer_gl0_inv
6867 ; GFX10-CU-NEXT: buffer_gl1_inv
6868 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
6869 ; GFX10-CU-NEXT: s_endpgm
6871 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_load:
6872 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6873 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6874 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
6875 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
6876 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6877 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
6878 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
6879 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
6880 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
6881 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
6882 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
6883 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
6884 ; SKIP-CACHE-INV-NEXT: s_endpgm
6886 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_load:
6887 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6888 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6889 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6890 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6891 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
6892 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6893 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6894 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6895 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6896 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6898 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_load:
6899 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6900 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6901 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6902 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6903 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
6904 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6905 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6906 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6907 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6908 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6910 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_load:
6911 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6912 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6913 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6914 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6915 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
6916 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
6917 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6918 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6919 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6921 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_load:
6922 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6923 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6924 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
6925 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6926 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
6927 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6928 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6929 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
6930 ; GFX940-TGSPLIT-NEXT: s_endpgm
6932 ; GFX11-WGP-LABEL: global_system_one_as_acquire_load:
6933 ; GFX11-WGP: ; %bb.0: ; %entry
6934 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6935 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
6936 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6937 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1] glc
6938 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
6939 ; GFX11-WGP-NEXT: buffer_gl0_inv
6940 ; GFX11-WGP-NEXT: buffer_gl1_inv
6941 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
6942 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6943 ; GFX11-WGP-NEXT: s_endpgm
6945 ; GFX11-CU-LABEL: global_system_one_as_acquire_load:
6946 ; GFX11-CU: ; %bb.0: ; %entry
6947 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6948 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
6949 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6950 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1] glc
6951 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
6952 ; GFX11-CU-NEXT: buffer_gl0_inv
6953 ; GFX11-CU-NEXT: buffer_gl1_inv
6954 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
6955 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6956 ; GFX11-CU-NEXT: s_endpgm
6957 i32 addrspace(1)* %in, i32 addrspace(1)* %out) {
6959 %val = load atomic i32, i32 addrspace(1)* %in syncscope("one-as") acquire, align 4
6960 store i32 %val, i32 addrspace(1)* %out
6964 define amdgpu_kernel void @global_system_one_as_seq_cst_load(
6965 ; GFX6-LABEL: global_system_one_as_seq_cst_load:
6966 ; GFX6: ; %bb.0: ; %entry
6967 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6968 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
6969 ; GFX6-NEXT: s_mov_b32 s6, -1
6970 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6971 ; GFX6-NEXT: s_mov_b32 s4, s0
6972 ; GFX6-NEXT: s_mov_b32 s5, s1
6973 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6974 ; GFX6-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
6975 ; GFX6-NEXT: s_waitcnt vmcnt(0)
6976 ; GFX6-NEXT: buffer_wbinvl1
6977 ; GFX6-NEXT: s_mov_b32 s4, s2
6978 ; GFX6-NEXT: s_mov_b32 s5, s3
6979 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
6980 ; GFX6-NEXT: s_endpgm
6982 ; GFX7-LABEL: global_system_one_as_seq_cst_load:
6983 ; GFX7: ; %bb.0: ; %entry
6984 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6985 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6986 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6987 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6988 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6989 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
6990 ; GFX7-NEXT: s_waitcnt vmcnt(0)
6991 ; GFX7-NEXT: buffer_wbinvl1_vol
6992 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
6993 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
6994 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6995 ; GFX7-NEXT: s_endpgm
6997 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_load:
6998 ; GFX10-WGP: ; %bb.0: ; %entry
6999 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7000 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7001 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7002 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7003 ; GFX10-WGP-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
7004 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7005 ; GFX10-WGP-NEXT: buffer_gl0_inv
7006 ; GFX10-WGP-NEXT: buffer_gl1_inv
7007 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[2:3]
7008 ; GFX10-WGP-NEXT: s_endpgm
7010 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_load:
7011 ; GFX10-CU: ; %bb.0: ; %entry
7012 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7013 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7014 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7015 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7016 ; GFX10-CU-NEXT: global_load_dword v1, v0, s[0:1] glc dlc
7017 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7018 ; GFX10-CU-NEXT: buffer_gl0_inv
7019 ; GFX10-CU-NEXT: buffer_gl1_inv
7020 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[2:3]
7021 ; GFX10-CU-NEXT: s_endpgm
7023 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_load:
7024 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7025 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7026 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
7027 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
7028 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7029 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
7030 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
7031 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7032 ; SKIP-CACHE-INV-NEXT: buffer_load_dword v0, off, s[4:7], 0 glc
7033 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7034 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s2
7035 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s3
7036 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
7037 ; SKIP-CACHE-INV-NEXT: s_endpgm
7039 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_load:
7040 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7041 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7042 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7043 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7044 ; GFX90A-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
7045 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7046 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7047 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7048 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
7049 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7051 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_load:
7052 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7053 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7054 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7055 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7056 ; GFX90A-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] glc
7057 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7058 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7059 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7060 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
7061 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7063 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_load:
7064 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7065 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7066 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7067 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7068 ; GFX940-NOTTGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
7069 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7070 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7071 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
7072 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7074 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_load:
7075 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7076 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7077 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7078 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7079 ; GFX940-TGSPLIT-NEXT: global_load_dword v1, v0, s[0:1] sc0 sc1
7080 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7081 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7082 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
7083 ; GFX940-TGSPLIT-NEXT: s_endpgm
7085 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_load:
7086 ; GFX11-WGP: ; %bb.0: ; %entry
7087 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7088 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, 0
7089 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7090 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7091 ; GFX11-WGP-NEXT: global_load_b32 v1, v0, s[0:1] glc
7092 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7093 ; GFX11-WGP-NEXT: buffer_gl0_inv
7094 ; GFX11-WGP-NEXT: buffer_gl1_inv
7095 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[2:3]
7096 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7097 ; GFX11-WGP-NEXT: s_endpgm
7099 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_load:
7100 ; GFX11-CU: ; %bb.0: ; %entry
7101 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7102 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, 0
7103 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7104 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
7105 ; GFX11-CU-NEXT: global_load_b32 v1, v0, s[0:1] glc
7106 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7107 ; GFX11-CU-NEXT: buffer_gl0_inv
7108 ; GFX11-CU-NEXT: buffer_gl1_inv
7109 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[2:3]
7110 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7111 ; GFX11-CU-NEXT: s_endpgm
7112 i32 addrspace(1)* %in, i32 addrspace(1)* %out) {
7114 %val = load atomic i32, i32 addrspace(1)* %in syncscope("one-as") seq_cst, align 4
7115 store i32 %val, i32 addrspace(1)* %out
7119 define amdgpu_kernel void @global_system_one_as_unordered_store(
7120 ; GFX6-LABEL: global_system_one_as_unordered_store:
7121 ; GFX6: ; %bb.0: ; %entry
7122 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
7123 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7124 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7125 ; GFX6-NEXT: s_mov_b32 s2, -1
7126 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7127 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7128 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
7129 ; GFX6-NEXT: s_endpgm
7131 ; GFX7-LABEL: global_system_one_as_unordered_store:
7132 ; GFX7: ; %bb.0: ; %entry
7133 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7134 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7135 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7136 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7137 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7138 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7139 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7140 ; GFX7-NEXT: s_endpgm
7142 ; GFX10-WGP-LABEL: global_system_one_as_unordered_store:
7143 ; GFX10-WGP: ; %bb.0: ; %entry
7144 ; GFX10-WGP-NEXT: s_clause 0x1
7145 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7146 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7147 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7148 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7149 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7150 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
7151 ; GFX10-WGP-NEXT: s_endpgm
7153 ; GFX10-CU-LABEL: global_system_one_as_unordered_store:
7154 ; GFX10-CU: ; %bb.0: ; %entry
7155 ; GFX10-CU-NEXT: s_clause 0x1
7156 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7157 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7158 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7159 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7160 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7161 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
7162 ; GFX10-CU-NEXT: s_endpgm
7164 ; SKIP-CACHE-INV-LABEL: global_system_one_as_unordered_store:
7165 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7166 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
7167 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
7168 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7169 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7170 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7171 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7172 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7173 ; SKIP-CACHE-INV-NEXT: s_endpgm
7175 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_unordered_store:
7176 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7177 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7178 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7179 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7180 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7181 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7182 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7183 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7185 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_unordered_store:
7186 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7187 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7188 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7189 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7190 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7191 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7192 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7193 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7195 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_unordered_store:
7196 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7197 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7198 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7199 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7200 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7201 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7202 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
7203 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7205 ; GFX940-TGSPLIT-LABEL: global_system_one_as_unordered_store:
7206 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7207 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7208 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7209 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7210 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7211 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7212 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
7213 ; GFX940-TGSPLIT-NEXT: s_endpgm
7215 ; GFX11-WGP-LABEL: global_system_one_as_unordered_store:
7216 ; GFX11-WGP: ; %bb.0: ; %entry
7217 ; GFX11-WGP-NEXT: s_clause 0x1
7218 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
7219 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7220 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7221 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7222 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7223 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7224 ; GFX11-WGP-NEXT: s_endpgm
7226 ; GFX11-CU-LABEL: global_system_one_as_unordered_store:
7227 ; GFX11-CU: ; %bb.0: ; %entry
7228 ; GFX11-CU-NEXT: s_clause 0x1
7229 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
7230 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7231 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7232 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7233 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7234 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7235 ; GFX11-CU-NEXT: s_endpgm
7236 i32 %in, i32 addrspace(1)* %out) {
7238 store atomic i32 %in, i32 addrspace(1)* %out syncscope("one-as") unordered, align 4
7242 define amdgpu_kernel void @global_system_one_as_monotonic_store(
7243 ; GFX6-LABEL: global_system_one_as_monotonic_store:
7244 ; GFX6: ; %bb.0: ; %entry
7245 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
7246 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7247 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7248 ; GFX6-NEXT: s_mov_b32 s2, -1
7249 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7250 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7251 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
7252 ; GFX6-NEXT: s_endpgm
7254 ; GFX7-LABEL: global_system_one_as_monotonic_store:
7255 ; GFX7: ; %bb.0: ; %entry
7256 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7257 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7258 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7259 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7260 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7261 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7262 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7263 ; GFX7-NEXT: s_endpgm
7265 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_store:
7266 ; GFX10-WGP: ; %bb.0: ; %entry
7267 ; GFX10-WGP-NEXT: s_clause 0x1
7268 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7269 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7270 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7271 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7272 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7273 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
7274 ; GFX10-WGP-NEXT: s_endpgm
7276 ; GFX10-CU-LABEL: global_system_one_as_monotonic_store:
7277 ; GFX10-CU: ; %bb.0: ; %entry
7278 ; GFX10-CU-NEXT: s_clause 0x1
7279 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7280 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7281 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7282 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7283 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7284 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
7285 ; GFX10-CU-NEXT: s_endpgm
7287 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_store:
7288 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7289 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
7290 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
7291 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7292 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7293 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7294 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7295 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7296 ; SKIP-CACHE-INV-NEXT: s_endpgm
7298 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_store:
7299 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7300 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7301 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7302 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7303 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7304 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7305 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7306 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7308 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_store:
7309 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7310 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7311 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7312 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7313 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7314 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7315 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7316 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7318 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_store:
7319 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7320 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7321 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7322 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7323 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7324 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7325 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7326 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7328 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_store:
7329 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7330 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7331 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7332 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7333 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7334 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7335 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7336 ; GFX940-TGSPLIT-NEXT: s_endpgm
7338 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_store:
7339 ; GFX11-WGP: ; %bb.0: ; %entry
7340 ; GFX11-WGP-NEXT: s_clause 0x1
7341 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
7342 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7343 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7344 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7345 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7346 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7347 ; GFX11-WGP-NEXT: s_endpgm
7349 ; GFX11-CU-LABEL: global_system_one_as_monotonic_store:
7350 ; GFX11-CU: ; %bb.0: ; %entry
7351 ; GFX11-CU-NEXT: s_clause 0x1
7352 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
7353 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7354 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7355 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7356 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7357 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7358 ; GFX11-CU-NEXT: s_endpgm
7359 i32 %in, i32 addrspace(1)* %out) {
7361 store atomic i32 %in, i32 addrspace(1)* %out syncscope("one-as") monotonic, align 4
7365 define amdgpu_kernel void @global_system_one_as_release_store(
7366 ; GFX6-LABEL: global_system_one_as_release_store:
7367 ; GFX6: ; %bb.0: ; %entry
7368 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
7369 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7370 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7371 ; GFX6-NEXT: s_mov_b32 s2, -1
7372 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7373 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7374 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7375 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
7376 ; GFX6-NEXT: s_endpgm
7378 ; GFX7-LABEL: global_system_one_as_release_store:
7379 ; GFX7: ; %bb.0: ; %entry
7380 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7381 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7382 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7383 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7384 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7385 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7386 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7387 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7388 ; GFX7-NEXT: s_endpgm
7390 ; GFX10-WGP-LABEL: global_system_one_as_release_store:
7391 ; GFX10-WGP: ; %bb.0: ; %entry
7392 ; GFX10-WGP-NEXT: s_clause 0x1
7393 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7394 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7395 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7396 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7397 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7398 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7399 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7400 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
7401 ; GFX10-WGP-NEXT: s_endpgm
7403 ; GFX10-CU-LABEL: global_system_one_as_release_store:
7404 ; GFX10-CU: ; %bb.0: ; %entry
7405 ; GFX10-CU-NEXT: s_clause 0x1
7406 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7407 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7408 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7409 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7410 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7411 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7412 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7413 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
7414 ; GFX10-CU-NEXT: s_endpgm
7416 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_store:
7417 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7418 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
7419 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
7420 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7421 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7422 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7423 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7424 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7425 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7426 ; SKIP-CACHE-INV-NEXT: s_endpgm
7428 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_store:
7429 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7430 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7431 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7432 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7433 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7434 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7435 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
7436 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7437 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7438 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7440 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_store:
7441 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7442 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7443 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7444 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7445 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7446 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7447 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
7448 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7449 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7450 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7452 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_store:
7453 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7454 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7455 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7456 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7457 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7458 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7459 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7460 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7461 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7462 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7464 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_store:
7465 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7466 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7467 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7468 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7469 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7470 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7471 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7472 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7473 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7474 ; GFX940-TGSPLIT-NEXT: s_endpgm
7476 ; GFX11-WGP-LABEL: global_system_one_as_release_store:
7477 ; GFX11-WGP: ; %bb.0: ; %entry
7478 ; GFX11-WGP-NEXT: s_clause 0x1
7479 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
7480 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7481 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7482 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7483 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7484 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7485 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7486 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7487 ; GFX11-WGP-NEXT: s_endpgm
7489 ; GFX11-CU-LABEL: global_system_one_as_release_store:
7490 ; GFX11-CU: ; %bb.0: ; %entry
7491 ; GFX11-CU-NEXT: s_clause 0x1
7492 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
7493 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7494 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7495 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7496 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7497 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
7498 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7499 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7500 ; GFX11-CU-NEXT: s_endpgm
7501 i32 %in, i32 addrspace(1)* %out) {
7503 store atomic i32 %in, i32 addrspace(1)* %out syncscope("one-as") release, align 4
7507 define amdgpu_kernel void @global_system_one_as_seq_cst_store(
7508 ; GFX6-LABEL: global_system_one_as_seq_cst_store:
7509 ; GFX6: ; %bb.0: ; %entry
7510 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x0
7511 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7512 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7513 ; GFX6-NEXT: s_mov_b32 s2, -1
7514 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7515 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7516 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7517 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
7518 ; GFX6-NEXT: s_endpgm
7520 ; GFX7-LABEL: global_system_one_as_seq_cst_store:
7521 ; GFX7: ; %bb.0: ; %entry
7522 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7523 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7524 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7525 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7526 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7527 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7528 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7529 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7530 ; GFX7-NEXT: s_endpgm
7532 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_store:
7533 ; GFX10-WGP: ; %bb.0: ; %entry
7534 ; GFX10-WGP-NEXT: s_clause 0x1
7535 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7536 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7537 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7538 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7539 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7540 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7541 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7542 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
7543 ; GFX10-WGP-NEXT: s_endpgm
7545 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_store:
7546 ; GFX10-CU: ; %bb.0: ; %entry
7547 ; GFX10-CU-NEXT: s_clause 0x1
7548 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7549 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7550 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7551 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7552 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7553 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7554 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7555 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
7556 ; GFX10-CU-NEXT: s_endpgm
7558 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_store:
7559 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7560 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x0
7561 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x2
7562 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7563 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7564 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7565 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7566 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7567 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
7568 ; SKIP-CACHE-INV-NEXT: s_endpgm
7570 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_store:
7571 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7572 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7573 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7574 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7575 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7576 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7577 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
7578 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7579 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7580 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7582 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_store:
7583 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7584 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7585 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7586 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7587 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7588 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7589 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
7590 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7591 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
7592 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7594 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_store:
7595 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7596 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7597 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7598 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7599 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7600 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7601 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7602 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7603 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7604 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7606 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_store:
7607 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7608 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7609 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7610 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7611 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7612 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7613 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7614 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7615 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3] sc0 sc1
7616 ; GFX940-TGSPLIT-NEXT: s_endpgm
7618 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_store:
7619 ; GFX11-WGP: ; %bb.0: ; %entry
7620 ; GFX11-WGP-NEXT: s_clause 0x1
7621 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x0
7622 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7623 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7624 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7625 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7626 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7627 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
7628 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7629 ; GFX11-WGP-NEXT: s_endpgm
7631 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_store:
7632 ; GFX11-CU: ; %bb.0: ; %entry
7633 ; GFX11-CU-NEXT: s_clause 0x1
7634 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x0
7635 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x8
7636 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7637 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7638 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7639 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
7640 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
7641 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7642 ; GFX11-CU-NEXT: s_endpgm
7643 i32 %in, i32 addrspace(1)* %out) {
7645 store atomic i32 %in, i32 addrspace(1)* %out syncscope("one-as") seq_cst, align 4
7649 define amdgpu_kernel void @global_system_one_as_monotonic_atomicrmw(
7650 ; GFX6-LABEL: global_system_one_as_monotonic_atomicrmw:
7651 ; GFX6: ; %bb.0: ; %entry
7652 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
7653 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7654 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7655 ; GFX6-NEXT: s_mov_b32 s2, -1
7656 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7657 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7658 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7659 ; GFX6-NEXT: s_endpgm
7661 ; GFX7-LABEL: global_system_one_as_monotonic_atomicrmw:
7662 ; GFX7: ; %bb.0: ; %entry
7663 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7664 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
7665 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7666 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7667 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7668 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7669 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
7670 ; GFX7-NEXT: s_endpgm
7672 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_atomicrmw:
7673 ; GFX10-WGP: ; %bb.0: ; %entry
7674 ; GFX10-WGP-NEXT: s_clause 0x1
7675 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
7676 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7677 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7678 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7679 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7680 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
7681 ; GFX10-WGP-NEXT: s_endpgm
7683 ; GFX10-CU-LABEL: global_system_one_as_monotonic_atomicrmw:
7684 ; GFX10-CU: ; %bb.0: ; %entry
7685 ; GFX10-CU-NEXT: s_clause 0x1
7686 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
7687 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7688 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7689 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7690 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7691 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
7692 ; GFX10-CU-NEXT: s_endpgm
7694 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_atomicrmw:
7695 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7696 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
7697 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7698 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7699 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7700 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7701 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7702 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7703 ; SKIP-CACHE-INV-NEXT: s_endpgm
7705 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_atomicrmw:
7706 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7707 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7708 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7709 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7710 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7711 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7712 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7713 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7715 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_atomicrmw:
7716 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7717 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7718 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7719 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7720 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7721 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7722 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7723 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7725 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_atomicrmw:
7726 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7727 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7728 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7729 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7730 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7731 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7732 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
7733 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7735 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_atomicrmw:
7736 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7737 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7738 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7739 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7740 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7741 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7742 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
7743 ; GFX940-TGSPLIT-NEXT: s_endpgm
7745 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_atomicrmw:
7746 ; GFX11-WGP: ; %bb.0: ; %entry
7747 ; GFX11-WGP-NEXT: s_clause 0x1
7748 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
7749 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7750 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7751 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7752 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7753 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7754 ; GFX11-WGP-NEXT: s_endpgm
7756 ; GFX11-CU-LABEL: global_system_one_as_monotonic_atomicrmw:
7757 ; GFX11-CU: ; %bb.0: ; %entry
7758 ; GFX11-CU-NEXT: s_clause 0x1
7759 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
7760 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7761 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7762 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7763 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7764 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7765 ; GFX11-CU-NEXT: s_endpgm
7766 i32 addrspace(1)* %out, i32 %in) {
7768 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in syncscope("one-as") monotonic
7772 define amdgpu_kernel void @global_system_one_as_acquire_atomicrmw(
7773 ; GFX6-LABEL: global_system_one_as_acquire_atomicrmw:
7774 ; GFX6: ; %bb.0: ; %entry
7775 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
7776 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7777 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7778 ; GFX6-NEXT: s_mov_b32 s2, -1
7779 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7780 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7781 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7782 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7783 ; GFX6-NEXT: buffer_wbinvl1
7784 ; GFX6-NEXT: s_endpgm
7786 ; GFX7-LABEL: global_system_one_as_acquire_atomicrmw:
7787 ; GFX7: ; %bb.0: ; %entry
7788 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7789 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
7790 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7791 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7792 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7793 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7794 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
7795 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7796 ; GFX7-NEXT: buffer_wbinvl1_vol
7797 ; GFX7-NEXT: s_endpgm
7799 ; GFX10-WGP-LABEL: global_system_one_as_acquire_atomicrmw:
7800 ; GFX10-WGP: ; %bb.0: ; %entry
7801 ; GFX10-WGP-NEXT: s_clause 0x1
7802 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
7803 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7804 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7805 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7806 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7807 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
7808 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7809 ; GFX10-WGP-NEXT: buffer_gl0_inv
7810 ; GFX10-WGP-NEXT: buffer_gl1_inv
7811 ; GFX10-WGP-NEXT: s_endpgm
7813 ; GFX10-CU-LABEL: global_system_one_as_acquire_atomicrmw:
7814 ; GFX10-CU: ; %bb.0: ; %entry
7815 ; GFX10-CU-NEXT: s_clause 0x1
7816 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
7817 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7818 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7819 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7820 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7821 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
7822 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7823 ; GFX10-CU-NEXT: buffer_gl0_inv
7824 ; GFX10-CU-NEXT: buffer_gl1_inv
7825 ; GFX10-CU-NEXT: s_endpgm
7827 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_atomicrmw:
7828 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7829 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
7830 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7831 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7832 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7833 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7834 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7835 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7836 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7837 ; SKIP-CACHE-INV-NEXT: s_endpgm
7839 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_atomicrmw:
7840 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7841 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7842 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7843 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7844 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7845 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7846 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7847 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7848 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7849 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7850 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7852 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_atomicrmw:
7853 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7854 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7855 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7856 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7857 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7858 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7859 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7860 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7861 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7862 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7863 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7865 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_atomicrmw:
7866 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7867 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7868 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7869 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7870 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7871 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7872 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
7873 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7874 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7875 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7877 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_atomicrmw:
7878 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7879 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
7880 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
7881 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7882 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7883 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
7884 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
7885 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7886 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7887 ; GFX940-TGSPLIT-NEXT: s_endpgm
7889 ; GFX11-WGP-LABEL: global_system_one_as_acquire_atomicrmw:
7890 ; GFX11-WGP: ; %bb.0: ; %entry
7891 ; GFX11-WGP-NEXT: s_clause 0x1
7892 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
7893 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7894 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7895 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7896 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7897 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7898 ; GFX11-WGP-NEXT: buffer_gl0_inv
7899 ; GFX11-WGP-NEXT: buffer_gl1_inv
7900 ; GFX11-WGP-NEXT: s_endpgm
7902 ; GFX11-CU-LABEL: global_system_one_as_acquire_atomicrmw:
7903 ; GFX11-CU: ; %bb.0: ; %entry
7904 ; GFX11-CU-NEXT: s_clause 0x1
7905 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
7906 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
7907 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7908 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
7909 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
7910 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
7911 ; GFX11-CU-NEXT: buffer_gl0_inv
7912 ; GFX11-CU-NEXT: buffer_gl1_inv
7913 ; GFX11-CU-NEXT: s_endpgm
7914 i32 addrspace(1)* %out, i32 %in) {
7916 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in syncscope("one-as") acquire
7920 define amdgpu_kernel void @global_system_one_as_release_atomicrmw(
7921 ; GFX6-LABEL: global_system_one_as_release_atomicrmw:
7922 ; GFX6: ; %bb.0: ; %entry
7923 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
7924 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7925 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
7926 ; GFX6-NEXT: s_mov_b32 s2, -1
7927 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7928 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
7929 ; GFX6-NEXT: s_waitcnt vmcnt(0)
7930 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7931 ; GFX6-NEXT: s_endpgm
7933 ; GFX7-LABEL: global_system_one_as_release_atomicrmw:
7934 ; GFX7: ; %bb.0: ; %entry
7935 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7936 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
7937 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7938 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7939 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7940 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7941 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7942 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
7943 ; GFX7-NEXT: s_endpgm
7945 ; GFX10-WGP-LABEL: global_system_one_as_release_atomicrmw:
7946 ; GFX10-WGP: ; %bb.0: ; %entry
7947 ; GFX10-WGP-NEXT: s_clause 0x1
7948 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
7949 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7950 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
7951 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7952 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
7953 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7954 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7955 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
7956 ; GFX10-WGP-NEXT: s_endpgm
7958 ; GFX10-CU-LABEL: global_system_one_as_release_atomicrmw:
7959 ; GFX10-CU: ; %bb.0: ; %entry
7960 ; GFX10-CU-NEXT: s_clause 0x1
7961 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
7962 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7963 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
7964 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7965 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
7966 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7967 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7968 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
7969 ; GFX10-CU-NEXT: s_endpgm
7971 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_atomicrmw:
7972 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7973 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
7974 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
7975 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
7976 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
7977 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7978 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7979 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7980 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
7981 ; SKIP-CACHE-INV-NEXT: s_endpgm
7983 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_atomicrmw:
7984 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7985 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7986 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7987 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
7988 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7989 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7990 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
7991 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7992 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
7993 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7995 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_atomicrmw:
7996 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7997 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
7998 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
7999 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8000 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8001 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8002 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8003 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8004 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
8005 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8007 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_atomicrmw:
8008 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8009 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8010 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8011 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8012 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8013 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8014 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8015 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8016 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
8017 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8019 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_atomicrmw:
8020 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8021 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8022 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8023 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8024 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8025 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8026 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8027 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8028 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
8029 ; GFX940-TGSPLIT-NEXT: s_endpgm
8031 ; GFX11-WGP-LABEL: global_system_one_as_release_atomicrmw:
8032 ; GFX11-WGP: ; %bb.0: ; %entry
8033 ; GFX11-WGP-NEXT: s_clause 0x1
8034 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
8035 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8036 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8037 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8038 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8039 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8040 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
8041 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8042 ; GFX11-WGP-NEXT: s_endpgm
8044 ; GFX11-CU-LABEL: global_system_one_as_release_atomicrmw:
8045 ; GFX11-CU: ; %bb.0: ; %entry
8046 ; GFX11-CU-NEXT: s_clause 0x1
8047 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
8048 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8049 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8050 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8051 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8052 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8053 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
8054 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8055 ; GFX11-CU-NEXT: s_endpgm
8056 i32 addrspace(1)* %out, i32 %in) {
8058 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in syncscope("one-as") release
8062 define amdgpu_kernel void @global_system_one_as_acq_rel_atomicrmw(
8063 ; GFX6-LABEL: global_system_one_as_acq_rel_atomicrmw:
8064 ; GFX6: ; %bb.0: ; %entry
8065 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
8066 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8067 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
8068 ; GFX6-NEXT: s_mov_b32 s2, -1
8069 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8070 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
8071 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8072 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
8073 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8074 ; GFX6-NEXT: buffer_wbinvl1
8075 ; GFX6-NEXT: s_endpgm
8077 ; GFX7-LABEL: global_system_one_as_acq_rel_atomicrmw:
8078 ; GFX7: ; %bb.0: ; %entry
8079 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8080 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8081 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8082 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8083 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8084 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8085 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8086 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8087 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8088 ; GFX7-NEXT: buffer_wbinvl1_vol
8089 ; GFX7-NEXT: s_endpgm
8091 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_atomicrmw:
8092 ; GFX10-WGP: ; %bb.0: ; %entry
8093 ; GFX10-WGP-NEXT: s_clause 0x1
8094 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8095 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8096 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8097 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8098 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8099 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8100 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8101 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
8102 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8103 ; GFX10-WGP-NEXT: buffer_gl0_inv
8104 ; GFX10-WGP-NEXT: buffer_gl1_inv
8105 ; GFX10-WGP-NEXT: s_endpgm
8107 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_atomicrmw:
8108 ; GFX10-CU: ; %bb.0: ; %entry
8109 ; GFX10-CU-NEXT: s_clause 0x1
8110 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8111 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8112 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8113 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8114 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8115 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8116 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8117 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
8118 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8119 ; GFX10-CU-NEXT: buffer_gl0_inv
8120 ; GFX10-CU-NEXT: buffer_gl1_inv
8121 ; GFX10-CU-NEXT: s_endpgm
8123 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_atomicrmw:
8124 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8125 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
8126 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
8127 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
8128 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
8129 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8130 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
8131 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8132 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
8133 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8134 ; SKIP-CACHE-INV-NEXT: s_endpgm
8136 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_atomicrmw:
8137 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8138 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8139 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8140 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8141 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8142 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8143 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8144 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8145 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
8146 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8147 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8148 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8149 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8151 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_atomicrmw:
8152 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8153 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8154 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8155 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8156 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8157 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8158 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8159 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8160 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
8161 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8162 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8163 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8164 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8166 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_atomicrmw:
8167 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8168 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8169 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8170 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8171 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8172 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8173 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8174 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8175 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
8176 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8177 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8178 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8180 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_atomicrmw:
8181 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8182 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8183 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8184 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8185 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8186 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8187 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8188 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8189 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
8190 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8191 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8192 ; GFX940-TGSPLIT-NEXT: s_endpgm
8194 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_atomicrmw:
8195 ; GFX11-WGP: ; %bb.0: ; %entry
8196 ; GFX11-WGP-NEXT: s_clause 0x1
8197 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
8198 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8199 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8200 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8201 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8202 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8203 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
8204 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8205 ; GFX11-WGP-NEXT: buffer_gl0_inv
8206 ; GFX11-WGP-NEXT: buffer_gl1_inv
8207 ; GFX11-WGP-NEXT: s_endpgm
8209 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_atomicrmw:
8210 ; GFX11-CU: ; %bb.0: ; %entry
8211 ; GFX11-CU-NEXT: s_clause 0x1
8212 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
8213 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8214 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8215 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8216 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8217 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8218 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
8219 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8220 ; GFX11-CU-NEXT: buffer_gl0_inv
8221 ; GFX11-CU-NEXT: buffer_gl1_inv
8222 ; GFX11-CU-NEXT: s_endpgm
8223 i32 addrspace(1)* %out, i32 %in) {
8225 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in syncscope("one-as") acq_rel
8229 define amdgpu_kernel void @global_system_one_as_seq_cst_atomicrmw(
8230 ; GFX6-LABEL: global_system_one_as_seq_cst_atomicrmw:
8231 ; GFX6: ; %bb.0: ; %entry
8232 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
8233 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8234 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
8235 ; GFX6-NEXT: s_mov_b32 s2, -1
8236 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8237 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
8238 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8239 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
8240 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8241 ; GFX6-NEXT: buffer_wbinvl1
8242 ; GFX6-NEXT: s_endpgm
8244 ; GFX7-LABEL: global_system_one_as_seq_cst_atomicrmw:
8245 ; GFX7: ; %bb.0: ; %entry
8246 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8247 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8248 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8249 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8250 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8251 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8252 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8253 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8254 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8255 ; GFX7-NEXT: buffer_wbinvl1_vol
8256 ; GFX7-NEXT: s_endpgm
8258 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_atomicrmw:
8259 ; GFX10-WGP: ; %bb.0: ; %entry
8260 ; GFX10-WGP-NEXT: s_clause 0x1
8261 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8262 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8263 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8264 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8265 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8266 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8267 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8268 ; GFX10-WGP-NEXT: global_atomic_swap v0, v1, s[0:1]
8269 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8270 ; GFX10-WGP-NEXT: buffer_gl0_inv
8271 ; GFX10-WGP-NEXT: buffer_gl1_inv
8272 ; GFX10-WGP-NEXT: s_endpgm
8274 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_atomicrmw:
8275 ; GFX10-CU: ; %bb.0: ; %entry
8276 ; GFX10-CU-NEXT: s_clause 0x1
8277 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8278 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8279 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8280 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8281 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8282 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8283 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8284 ; GFX10-CU-NEXT: global_atomic_swap v0, v1, s[0:1]
8285 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8286 ; GFX10-CU-NEXT: buffer_gl0_inv
8287 ; GFX10-CU-NEXT: buffer_gl1_inv
8288 ; GFX10-CU-NEXT: s_endpgm
8290 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_atomicrmw:
8291 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8292 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
8293 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
8294 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
8295 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
8296 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8297 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
8298 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8299 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0
8300 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8301 ; SKIP-CACHE-INV-NEXT: s_endpgm
8303 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_atomicrmw:
8304 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8305 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8306 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8307 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8308 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8309 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8310 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8311 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8312 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
8313 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8314 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8315 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8316 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8318 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_atomicrmw:
8319 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8320 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8321 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8322 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8323 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8324 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8325 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8326 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8327 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[0:1]
8328 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8329 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8330 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8331 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8333 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_atomicrmw:
8334 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8335 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8336 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8337 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8338 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8339 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8340 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8341 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8342 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
8343 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8344 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8345 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8347 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_atomicrmw:
8348 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8349 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8350 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8351 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8352 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8353 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8354 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8355 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8356 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v0, v1, s[2:3] sc1
8357 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8358 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8359 ; GFX940-TGSPLIT-NEXT: s_endpgm
8361 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_atomicrmw:
8362 ; GFX11-WGP: ; %bb.0: ; %entry
8363 ; GFX11-WGP-NEXT: s_clause 0x1
8364 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
8365 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8366 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8367 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8368 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8369 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8370 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
8371 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8372 ; GFX11-WGP-NEXT: buffer_gl0_inv
8373 ; GFX11-WGP-NEXT: buffer_gl1_inv
8374 ; GFX11-WGP-NEXT: s_endpgm
8376 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_atomicrmw:
8377 ; GFX11-CU: ; %bb.0: ; %entry
8378 ; GFX11-CU-NEXT: s_clause 0x1
8379 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
8380 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8381 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8382 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8383 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8384 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8385 ; GFX11-CU-NEXT: global_atomic_swap_b32 v0, v1, s[0:1]
8386 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8387 ; GFX11-CU-NEXT: buffer_gl0_inv
8388 ; GFX11-CU-NEXT: buffer_gl1_inv
8389 ; GFX11-CU-NEXT: s_endpgm
8390 i32 addrspace(1)* %out, i32 %in) {
8392 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in syncscope("one-as") seq_cst
8396 define amdgpu_kernel void @global_system_one_as_acquire_ret_atomicrmw(
8397 ; GFX6-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8398 ; GFX6: ; %bb.0: ; %entry
8399 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
8400 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8401 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
8402 ; GFX6-NEXT: s_mov_b32 s2, -1
8403 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8404 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
8405 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8406 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8407 ; GFX6-NEXT: buffer_wbinvl1
8408 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
8409 ; GFX6-NEXT: s_endpgm
8411 ; GFX7-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8412 ; GFX7: ; %bb.0: ; %entry
8413 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8414 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8415 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8416 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8417 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8418 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8419 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8420 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8421 ; GFX7-NEXT: buffer_wbinvl1_vol
8422 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8423 ; GFX7-NEXT: s_endpgm
8425 ; GFX10-WGP-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8426 ; GFX10-WGP: ; %bb.0: ; %entry
8427 ; GFX10-WGP-NEXT: s_clause 0x1
8428 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8429 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8430 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8431 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8432 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8433 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8434 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8435 ; GFX10-WGP-NEXT: buffer_gl0_inv
8436 ; GFX10-WGP-NEXT: buffer_gl1_inv
8437 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
8438 ; GFX10-WGP-NEXT: s_endpgm
8440 ; GFX10-CU-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8441 ; GFX10-CU: ; %bb.0: ; %entry
8442 ; GFX10-CU-NEXT: s_clause 0x1
8443 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8444 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8445 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8446 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8447 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8448 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8449 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8450 ; GFX10-CU-NEXT: buffer_gl0_inv
8451 ; GFX10-CU-NEXT: buffer_gl1_inv
8452 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
8453 ; GFX10-CU-NEXT: s_endpgm
8455 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8456 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8457 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
8458 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
8459 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
8460 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
8461 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8462 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
8463 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8464 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8465 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
8466 ; SKIP-CACHE-INV-NEXT: s_endpgm
8468 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8469 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8470 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8471 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8472 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8473 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8474 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8475 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8476 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8477 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8478 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8479 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8480 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8482 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8483 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8484 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8485 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8486 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8487 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8488 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8489 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8490 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8491 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8492 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8493 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8494 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8496 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8497 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8498 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8499 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8500 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8501 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8502 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8503 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
8504 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8505 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8506 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
8507 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8509 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8510 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8511 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8512 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8513 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8514 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8515 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8516 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
8517 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8518 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8519 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
8520 ; GFX940-TGSPLIT-NEXT: s_endpgm
8522 ; GFX11-WGP-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8523 ; GFX11-WGP: ; %bb.0: ; %entry
8524 ; GFX11-WGP-NEXT: s_clause 0x1
8525 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
8526 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8527 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8528 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8529 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8530 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8531 ; GFX11-WGP-NEXT: buffer_gl0_inv
8532 ; GFX11-WGP-NEXT: buffer_gl1_inv
8533 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8534 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8535 ; GFX11-WGP-NEXT: s_endpgm
8537 ; GFX11-CU-LABEL: global_system_one_as_acquire_ret_atomicrmw:
8538 ; GFX11-CU: ; %bb.0: ; %entry
8539 ; GFX11-CU-NEXT: s_clause 0x1
8540 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
8541 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8542 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8543 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8544 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8545 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8546 ; GFX11-CU-NEXT: buffer_gl0_inv
8547 ; GFX11-CU-NEXT: buffer_gl1_inv
8548 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8549 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8550 ; GFX11-CU-NEXT: s_endpgm
8551 i32 addrspace(1)* %out, i32 %in) {
8553 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in syncscope("one-as") acquire
8554 store i32 %val, i32 addrspace(1)* %out, align 4
8558 define amdgpu_kernel void @global_system_one_as_acq_rel_ret_atomicrmw(
8559 ; GFX6-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8560 ; GFX6: ; %bb.0: ; %entry
8561 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
8562 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8563 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
8564 ; GFX6-NEXT: s_mov_b32 s2, -1
8565 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8566 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
8567 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8568 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8569 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8570 ; GFX6-NEXT: buffer_wbinvl1
8571 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
8572 ; GFX6-NEXT: s_endpgm
8574 ; GFX7-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8575 ; GFX7: ; %bb.0: ; %entry
8576 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8577 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8578 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8579 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8580 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8581 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8582 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8583 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8584 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8585 ; GFX7-NEXT: buffer_wbinvl1_vol
8586 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8587 ; GFX7-NEXT: s_endpgm
8589 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8590 ; GFX10-WGP: ; %bb.0: ; %entry
8591 ; GFX10-WGP-NEXT: s_clause 0x1
8592 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8593 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8594 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8595 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8596 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8597 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8598 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8599 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8600 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8601 ; GFX10-WGP-NEXT: buffer_gl0_inv
8602 ; GFX10-WGP-NEXT: buffer_gl1_inv
8603 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
8604 ; GFX10-WGP-NEXT: s_endpgm
8606 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8607 ; GFX10-CU: ; %bb.0: ; %entry
8608 ; GFX10-CU-NEXT: s_clause 0x1
8609 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8610 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8611 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8612 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8613 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8614 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8615 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8616 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8617 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8618 ; GFX10-CU-NEXT: buffer_gl0_inv
8619 ; GFX10-CU-NEXT: buffer_gl1_inv
8620 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
8621 ; GFX10-CU-NEXT: s_endpgm
8623 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8624 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8625 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
8626 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
8627 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
8628 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
8629 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8630 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
8631 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8632 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8633 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8634 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
8635 ; SKIP-CACHE-INV-NEXT: s_endpgm
8637 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8638 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8639 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8640 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8641 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8642 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8643 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8644 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8645 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8646 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8647 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8648 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8649 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8650 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8651 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8653 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8654 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8655 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8656 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8657 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8658 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8659 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8660 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8661 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8662 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8663 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8664 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8665 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8666 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8667 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8669 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8670 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8671 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8672 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8673 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8674 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8675 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8676 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8677 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8678 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
8679 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8680 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8681 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
8682 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8684 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8685 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8686 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8687 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8688 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8689 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8690 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8691 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8692 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8693 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
8694 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8695 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8696 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
8697 ; GFX940-TGSPLIT-NEXT: s_endpgm
8699 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8700 ; GFX11-WGP: ; %bb.0: ; %entry
8701 ; GFX11-WGP-NEXT: s_clause 0x1
8702 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
8703 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8704 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8705 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8706 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8707 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8708 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8709 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8710 ; GFX11-WGP-NEXT: buffer_gl0_inv
8711 ; GFX11-WGP-NEXT: buffer_gl1_inv
8712 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8713 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8714 ; GFX11-WGP-NEXT: s_endpgm
8716 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_ret_atomicrmw:
8717 ; GFX11-CU: ; %bb.0: ; %entry
8718 ; GFX11-CU-NEXT: s_clause 0x1
8719 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
8720 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8721 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8722 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8723 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8724 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8725 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8726 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8727 ; GFX11-CU-NEXT: buffer_gl0_inv
8728 ; GFX11-CU-NEXT: buffer_gl1_inv
8729 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8730 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8731 ; GFX11-CU-NEXT: s_endpgm
8732 i32 addrspace(1)* %out, i32 %in) {
8734 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in syncscope("one-as") acq_rel
8735 store i32 %val, i32 addrspace(1)* %out, align 4
8739 define amdgpu_kernel void @global_system_one_as_seq_cst_ret_atomicrmw(
8740 ; GFX6-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8741 ; GFX6: ; %bb.0: ; %entry
8742 ; GFX6-NEXT: s_load_dword s6, s[4:5], 0x2
8743 ; GFX6-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8744 ; GFX6-NEXT: s_mov_b32 s3, 0x100f000
8745 ; GFX6-NEXT: s_mov_b32 s2, -1
8746 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8747 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
8748 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8749 ; GFX6-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8750 ; GFX6-NEXT: s_waitcnt vmcnt(0)
8751 ; GFX6-NEXT: buffer_wbinvl1
8752 ; GFX6-NEXT: buffer_store_dword v0, off, s[0:3], 0
8753 ; GFX6-NEXT: s_endpgm
8755 ; GFX7-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8756 ; GFX7: ; %bb.0: ; %entry
8757 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8758 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8759 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8760 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8761 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8762 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8763 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8764 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8765 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8766 ; GFX7-NEXT: buffer_wbinvl1_vol
8767 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8768 ; GFX7-NEXT: s_endpgm
8770 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8771 ; GFX10-WGP: ; %bb.0: ; %entry
8772 ; GFX10-WGP-NEXT: s_clause 0x1
8773 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8774 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8775 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, 0
8776 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8777 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s2
8778 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8779 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8780 ; GFX10-WGP-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8781 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8782 ; GFX10-WGP-NEXT: buffer_gl0_inv
8783 ; GFX10-WGP-NEXT: buffer_gl1_inv
8784 ; GFX10-WGP-NEXT: global_store_dword v0, v1, s[0:1]
8785 ; GFX10-WGP-NEXT: s_endpgm
8787 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8788 ; GFX10-CU: ; %bb.0: ; %entry
8789 ; GFX10-CU-NEXT: s_clause 0x1
8790 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8791 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8792 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, 0
8793 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8794 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s2
8795 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8796 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8797 ; GFX10-CU-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8798 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8799 ; GFX10-CU-NEXT: buffer_gl0_inv
8800 ; GFX10-CU-NEXT: buffer_gl1_inv
8801 ; GFX10-CU-NEXT: global_store_dword v0, v1, s[0:1]
8802 ; GFX10-CU-NEXT: s_endpgm
8804 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8805 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8806 ; SKIP-CACHE-INV-NEXT: s_load_dword s4, s[0:1], 0x2
8807 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x0
8808 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s3, 0xf000
8809 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s2, -1
8810 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8811 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
8812 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8813 ; SKIP-CACHE-INV-NEXT: buffer_atomic_swap v0, off, s[0:3], 0 glc
8814 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8815 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[0:3], 0
8816 ; SKIP-CACHE-INV-NEXT: s_endpgm
8818 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8819 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8820 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8821 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8822 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8823 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8824 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8825 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8826 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8827 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8828 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8829 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8830 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8831 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8832 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8834 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8835 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8836 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8837 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8838 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8839 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8840 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8841 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8842 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8843 ; GFX90A-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[0:1] glc
8844 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8845 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8846 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8847 ; GFX90A-TGSPLIT-NEXT: global_store_dword v0, v1, s[0:1]
8848 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8850 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8851 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8852 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8853 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8854 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8855 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8856 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8857 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8858 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8859 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
8860 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8861 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8862 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
8863 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8865 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8866 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8867 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8868 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8869 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, 0
8870 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8871 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
8872 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8873 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8874 ; GFX940-TGSPLIT-NEXT: global_atomic_swap v1, v0, v1, s[2:3] sc0 sc1
8875 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8876 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8877 ; GFX940-TGSPLIT-NEXT: global_store_dword v0, v1, s[2:3]
8878 ; GFX940-TGSPLIT-NEXT: s_endpgm
8880 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8881 ; GFX11-WGP: ; %bb.0: ; %entry
8882 ; GFX11-WGP-NEXT: s_clause 0x1
8883 ; GFX11-WGP-NEXT: s_load_b32 s2, s[0:1], 0x8
8884 ; GFX11-WGP-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8885 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8886 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8887 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8888 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8889 ; GFX11-WGP-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8890 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8891 ; GFX11-WGP-NEXT: buffer_gl0_inv
8892 ; GFX11-WGP-NEXT: buffer_gl1_inv
8893 ; GFX11-WGP-NEXT: global_store_b32 v0, v1, s[0:1]
8894 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8895 ; GFX11-WGP-NEXT: s_endpgm
8897 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_ret_atomicrmw:
8898 ; GFX11-CU: ; %bb.0: ; %entry
8899 ; GFX11-CU-NEXT: s_clause 0x1
8900 ; GFX11-CU-NEXT: s_load_b32 s2, s[0:1], 0x8
8901 ; GFX11-CU-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
8902 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8903 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, s2
8904 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8905 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8906 ; GFX11-CU-NEXT: global_atomic_swap_b32 v1, v0, v1, s[0:1] glc
8907 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8908 ; GFX11-CU-NEXT: buffer_gl0_inv
8909 ; GFX11-CU-NEXT: buffer_gl1_inv
8910 ; GFX11-CU-NEXT: global_store_b32 v0, v1, s[0:1]
8911 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8912 ; GFX11-CU-NEXT: s_endpgm
8913 i32 addrspace(1)* %out, i32 %in) {
8915 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in syncscope("one-as") seq_cst
8916 store i32 %val, i32 addrspace(1)* %out, align 4
8920 define amdgpu_kernel void @global_system_one_as_monotonic_monotonic_cmpxchg(
8921 ; GFX6-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
8922 ; GFX6: ; %bb.0: ; %entry
8923 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8924 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
8925 ; GFX6-NEXT: s_mov_b32 s6, -1
8926 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8927 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
8928 ; GFX6-NEXT: s_mov_b32 s4, s0
8929 ; GFX6-NEXT: s_mov_b32 s5, s1
8930 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
8931 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8932 ; GFX6-NEXT: s_endpgm
8934 ; GFX7-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
8935 ; GFX7: ; %bb.0: ; %entry
8936 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8937 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8938 ; GFX7-NEXT: s_add_u32 s0, s0, 16
8939 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
8940 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8941 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8942 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8943 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
8944 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
8945 ; GFX7-NEXT: s_endpgm
8947 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
8948 ; GFX10-WGP: ; %bb.0: ; %entry
8949 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8950 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
8951 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8952 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
8953 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
8954 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8955 ; GFX10-WGP-NEXT: s_endpgm
8957 ; GFX10-CU-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
8958 ; GFX10-CU: ; %bb.0: ; %entry
8959 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8960 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
8961 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8962 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
8963 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
8964 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8965 ; GFX10-CU-NEXT: s_endpgm
8967 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
8968 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8969 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
8970 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
8971 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
8972 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8973 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8974 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
8975 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
8976 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8977 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
8978 ; SKIP-CACHE-INV-NEXT: s_endpgm
8980 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
8981 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8982 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8983 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8984 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8985 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8986 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8987 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8989 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
8990 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8991 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
8992 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
8993 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8994 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
8995 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
8996 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8998 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
8999 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9000 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9001 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9002 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9003 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9004 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9005 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9007 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
9008 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9009 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9010 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9011 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9012 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9013 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9014 ; GFX940-TGSPLIT-NEXT: s_endpgm
9016 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
9017 ; GFX11-WGP: ; %bb.0: ; %entry
9018 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9019 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9020 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9021 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9022 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9023 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9024 ; GFX11-WGP-NEXT: s_endpgm
9026 ; GFX11-CU-LABEL: global_system_one_as_monotonic_monotonic_cmpxchg:
9027 ; GFX11-CU: ; %bb.0: ; %entry
9028 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9029 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9030 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9031 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9032 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9033 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9034 ; GFX11-CU-NEXT: s_endpgm
9035 i32 addrspace(1)* %out, i32 %in, i32 %old) {
9037 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
9038 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") monotonic monotonic
9042 define amdgpu_kernel void @global_system_one_as_acquire_monotonic_cmpxchg(
9043 ; GFX6-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9044 ; GFX6: ; %bb.0: ; %entry
9045 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9046 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9047 ; GFX6-NEXT: s_mov_b32 s6, -1
9048 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9049 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9050 ; GFX6-NEXT: s_mov_b32 s4, s0
9051 ; GFX6-NEXT: s_mov_b32 s5, s1
9052 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9053 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9054 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9055 ; GFX6-NEXT: buffer_wbinvl1
9056 ; GFX6-NEXT: s_endpgm
9058 ; GFX7-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9059 ; GFX7: ; %bb.0: ; %entry
9060 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9061 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9062 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9063 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9064 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9065 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9066 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9067 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9068 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9069 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9070 ; GFX7-NEXT: buffer_wbinvl1_vol
9071 ; GFX7-NEXT: s_endpgm
9073 ; GFX10-WGP-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9074 ; GFX10-WGP: ; %bb.0: ; %entry
9075 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9076 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9077 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9078 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9079 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9080 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9081 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9082 ; GFX10-WGP-NEXT: buffer_gl0_inv
9083 ; GFX10-WGP-NEXT: buffer_gl1_inv
9084 ; GFX10-WGP-NEXT: s_endpgm
9086 ; GFX10-CU-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9087 ; GFX10-CU: ; %bb.0: ; %entry
9088 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9089 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9090 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9091 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9092 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9093 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9094 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9095 ; GFX10-CU-NEXT: buffer_gl0_inv
9096 ; GFX10-CU-NEXT: buffer_gl1_inv
9097 ; GFX10-CU-NEXT: s_endpgm
9099 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9100 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9101 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9102 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9103 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9104 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9105 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9106 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9107 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9108 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9109 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9110 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9111 ; SKIP-CACHE-INV-NEXT: s_endpgm
9113 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9114 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9115 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9116 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9117 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9118 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9119 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9120 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9121 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9122 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9123 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9125 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9126 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9127 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9128 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9129 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9130 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9131 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9132 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9133 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9134 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9135 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9137 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9138 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9139 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9140 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9141 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9142 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9143 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9144 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9145 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9146 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9148 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9149 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9150 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9151 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9152 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9153 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9154 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9155 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9156 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9157 ; GFX940-TGSPLIT-NEXT: s_endpgm
9159 ; GFX11-WGP-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9160 ; GFX11-WGP: ; %bb.0: ; %entry
9161 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9162 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9163 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9164 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9165 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9166 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9167 ; GFX11-WGP-NEXT: buffer_gl0_inv
9168 ; GFX11-WGP-NEXT: buffer_gl1_inv
9169 ; GFX11-WGP-NEXT: s_endpgm
9171 ; GFX11-CU-LABEL: global_system_one_as_acquire_monotonic_cmpxchg:
9172 ; GFX11-CU: ; %bb.0: ; %entry
9173 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9174 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9175 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9176 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9177 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9178 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9179 ; GFX11-CU-NEXT: buffer_gl0_inv
9180 ; GFX11-CU-NEXT: buffer_gl1_inv
9181 ; GFX11-CU-NEXT: s_endpgm
9182 i32 addrspace(1)* %out, i32 %in, i32 %old) {
9184 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
9185 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acquire monotonic
9189 define amdgpu_kernel void @global_system_one_as_release_monotonic_cmpxchg(
9190 ; GFX6-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9191 ; GFX6: ; %bb.0: ; %entry
9192 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9193 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9194 ; GFX6-NEXT: s_mov_b32 s6, -1
9195 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9196 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9197 ; GFX6-NEXT: s_mov_b32 s4, s0
9198 ; GFX6-NEXT: s_mov_b32 s5, s1
9199 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9200 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9201 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9202 ; GFX6-NEXT: s_endpgm
9204 ; GFX7-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9205 ; GFX7: ; %bb.0: ; %entry
9206 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9207 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9208 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9209 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9210 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9211 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9212 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9213 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9214 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9215 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9216 ; GFX7-NEXT: s_endpgm
9218 ; GFX10-WGP-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9219 ; GFX10-WGP: ; %bb.0: ; %entry
9220 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9221 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9222 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9223 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9224 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9225 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9226 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9227 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9228 ; GFX10-WGP-NEXT: s_endpgm
9230 ; GFX10-CU-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9231 ; GFX10-CU: ; %bb.0: ; %entry
9232 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9233 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9234 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9235 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9236 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9237 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9238 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9239 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9240 ; GFX10-CU-NEXT: s_endpgm
9242 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9243 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9244 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9245 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9246 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9247 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9248 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9249 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9250 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9251 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9252 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9253 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9254 ; SKIP-CACHE-INV-NEXT: s_endpgm
9256 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9257 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9258 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9259 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9260 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9261 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9262 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9263 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9264 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9265 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9267 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9268 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9269 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9270 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9271 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9272 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9273 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9274 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9275 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9276 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9278 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9279 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9280 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9281 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9282 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9283 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9284 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9285 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9286 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9287 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9289 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_monotonic_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: buffer_wbl2 sc0 sc1
9296 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9297 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9298 ; GFX940-TGSPLIT-NEXT: s_endpgm
9300 ; GFX11-WGP-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9301 ; GFX11-WGP: ; %bb.0: ; %entry
9302 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9303 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9304 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9305 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9306 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9307 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9308 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9309 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9310 ; GFX11-WGP-NEXT: s_endpgm
9312 ; GFX11-CU-LABEL: global_system_one_as_release_monotonic_cmpxchg:
9313 ; GFX11-CU: ; %bb.0: ; %entry
9314 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9315 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9316 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9317 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9318 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9319 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9320 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9321 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9322 ; GFX11-CU-NEXT: s_endpgm
9323 i32 addrspace(1)* %out, i32 %in, i32 %old) {
9325 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
9326 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") release monotonic
9330 define amdgpu_kernel void @global_system_one_as_acq_rel_monotonic_cmpxchg(
9331 ; GFX6-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9332 ; GFX6: ; %bb.0: ; %entry
9333 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9334 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9335 ; GFX6-NEXT: s_mov_b32 s6, -1
9336 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9337 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9338 ; GFX6-NEXT: s_mov_b32 s4, s0
9339 ; GFX6-NEXT: s_mov_b32 s5, s1
9340 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9341 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9342 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9343 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9344 ; GFX6-NEXT: buffer_wbinvl1
9345 ; GFX6-NEXT: s_endpgm
9347 ; GFX7-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9348 ; GFX7: ; %bb.0: ; %entry
9349 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9350 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9351 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9352 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9353 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9354 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9355 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9356 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9357 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9358 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9359 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9360 ; GFX7-NEXT: buffer_wbinvl1_vol
9361 ; GFX7-NEXT: s_endpgm
9363 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9364 ; GFX10-WGP: ; %bb.0: ; %entry
9365 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9366 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9367 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9368 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9369 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9370 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9371 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9372 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9373 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9374 ; GFX10-WGP-NEXT: buffer_gl0_inv
9375 ; GFX10-WGP-NEXT: buffer_gl1_inv
9376 ; GFX10-WGP-NEXT: s_endpgm
9378 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9379 ; GFX10-CU: ; %bb.0: ; %entry
9380 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9381 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9382 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9383 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9384 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9385 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9386 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9387 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9388 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9389 ; GFX10-CU-NEXT: buffer_gl0_inv
9390 ; GFX10-CU-NEXT: buffer_gl1_inv
9391 ; GFX10-CU-NEXT: s_endpgm
9393 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9394 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9395 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9396 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9397 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9398 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9399 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9400 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9401 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9402 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9403 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9404 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9405 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9406 ; SKIP-CACHE-INV-NEXT: s_endpgm
9408 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9409 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9410 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9411 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9412 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9413 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9414 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9415 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9416 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9417 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9418 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9419 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9420 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9422 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9423 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9424 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9425 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9426 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9427 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9428 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9429 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9430 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9431 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9432 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9433 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9434 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9436 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9437 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9438 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9439 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9440 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9441 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9442 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9443 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9444 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9445 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9446 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9447 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9449 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9450 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9451 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9452 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9453 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9454 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9455 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9456 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9457 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9458 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9459 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9460 ; GFX940-TGSPLIT-NEXT: s_endpgm
9462 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9463 ; GFX11-WGP: ; %bb.0: ; %entry
9464 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9465 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9466 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9467 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9468 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9469 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9470 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9471 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9472 ; GFX11-WGP-NEXT: buffer_gl0_inv
9473 ; GFX11-WGP-NEXT: buffer_gl1_inv
9474 ; GFX11-WGP-NEXT: s_endpgm
9476 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_monotonic_cmpxchg:
9477 ; GFX11-CU: ; %bb.0: ; %entry
9478 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9479 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9480 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9481 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9482 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9483 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9484 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9485 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9486 ; GFX11-CU-NEXT: buffer_gl0_inv
9487 ; GFX11-CU-NEXT: buffer_gl1_inv
9488 ; GFX11-CU-NEXT: s_endpgm
9489 i32 addrspace(1)* %out, i32 %in, i32 %old) {
9491 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
9492 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel monotonic
9496 define amdgpu_kernel void @global_system_one_as_seq_cst_monotonic_cmpxchg(
9497 ; GFX6-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9498 ; GFX6: ; %bb.0: ; %entry
9499 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9500 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9501 ; GFX6-NEXT: s_mov_b32 s6, -1
9502 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9503 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9504 ; GFX6-NEXT: s_mov_b32 s4, s0
9505 ; GFX6-NEXT: s_mov_b32 s5, s1
9506 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9507 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9508 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9509 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9510 ; GFX6-NEXT: buffer_wbinvl1
9511 ; GFX6-NEXT: s_endpgm
9513 ; GFX7-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9514 ; GFX7: ; %bb.0: ; %entry
9515 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9516 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9517 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9518 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9519 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9520 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9521 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9522 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9523 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9524 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9525 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9526 ; GFX7-NEXT: buffer_wbinvl1_vol
9527 ; GFX7-NEXT: s_endpgm
9529 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9530 ; GFX10-WGP: ; %bb.0: ; %entry
9531 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9532 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9533 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9534 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9535 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9536 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9537 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9538 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9539 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9540 ; GFX10-WGP-NEXT: buffer_gl0_inv
9541 ; GFX10-WGP-NEXT: buffer_gl1_inv
9542 ; GFX10-WGP-NEXT: s_endpgm
9544 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9545 ; GFX10-CU: ; %bb.0: ; %entry
9546 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9547 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9548 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9549 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9550 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9551 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9552 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9553 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9554 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9555 ; GFX10-CU-NEXT: buffer_gl0_inv
9556 ; GFX10-CU-NEXT: buffer_gl1_inv
9557 ; GFX10-CU-NEXT: s_endpgm
9559 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9560 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9561 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9562 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9563 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9564 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9565 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9566 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9567 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9568 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9569 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9570 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9571 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9572 ; SKIP-CACHE-INV-NEXT: s_endpgm
9574 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9575 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9576 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9577 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9578 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9579 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9580 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9581 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9582 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9583 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9584 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9585 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9586 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9588 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9589 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9590 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9591 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9592 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9593 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9594 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9595 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9596 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9597 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9598 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9599 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9600 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9602 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9603 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9604 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9605 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9606 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9607 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9608 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9609 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9610 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9611 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9612 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9613 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9615 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9616 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9617 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9618 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9619 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9620 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9621 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9622 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9623 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9624 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9625 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9626 ; GFX940-TGSPLIT-NEXT: s_endpgm
9628 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9629 ; GFX11-WGP: ; %bb.0: ; %entry
9630 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9631 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9632 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9633 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9634 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9635 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9636 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9637 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9638 ; GFX11-WGP-NEXT: buffer_gl0_inv
9639 ; GFX11-WGP-NEXT: buffer_gl1_inv
9640 ; GFX11-WGP-NEXT: s_endpgm
9642 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_monotonic_cmpxchg:
9643 ; GFX11-CU: ; %bb.0: ; %entry
9644 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9645 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9646 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9647 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9648 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9649 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9650 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9651 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9652 ; GFX11-CU-NEXT: buffer_gl0_inv
9653 ; GFX11-CU-NEXT: buffer_gl1_inv
9654 ; GFX11-CU-NEXT: s_endpgm
9655 i32 addrspace(1)* %out, i32 %in, i32 %old) {
9657 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
9658 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst monotonic
9662 define amdgpu_kernel void @global_system_one_as_monotonic_acquire_cmpxchg(
9663 ; GFX6-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9664 ; GFX6: ; %bb.0: ; %entry
9665 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9666 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9667 ; GFX6-NEXT: s_mov_b32 s6, -1
9668 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9669 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9670 ; GFX6-NEXT: s_mov_b32 s4, s0
9671 ; GFX6-NEXT: s_mov_b32 s5, s1
9672 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9673 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9674 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9675 ; GFX6-NEXT: buffer_wbinvl1
9676 ; GFX6-NEXT: s_endpgm
9678 ; GFX7-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9679 ; GFX7: ; %bb.0: ; %entry
9680 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9681 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9682 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9683 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9684 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9685 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9686 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9687 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9688 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9689 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9690 ; GFX7-NEXT: buffer_wbinvl1_vol
9691 ; GFX7-NEXT: s_endpgm
9693 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9694 ; GFX10-WGP: ; %bb.0: ; %entry
9695 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9696 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9697 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9698 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9699 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9700 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9701 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9702 ; GFX10-WGP-NEXT: buffer_gl0_inv
9703 ; GFX10-WGP-NEXT: buffer_gl1_inv
9704 ; GFX10-WGP-NEXT: s_endpgm
9706 ; GFX10-CU-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9707 ; GFX10-CU: ; %bb.0: ; %entry
9708 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9709 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9710 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9711 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9712 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9713 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9714 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9715 ; GFX10-CU-NEXT: buffer_gl0_inv
9716 ; GFX10-CU-NEXT: buffer_gl1_inv
9717 ; GFX10-CU-NEXT: s_endpgm
9719 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9720 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9721 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9722 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9723 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9724 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9725 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9726 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9727 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9728 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9729 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9730 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9731 ; SKIP-CACHE-INV-NEXT: s_endpgm
9733 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9734 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9735 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9736 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9737 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9738 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9739 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9740 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9741 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9742 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9743 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9745 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9746 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9747 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9748 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9749 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9750 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9751 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9752 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9753 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9754 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9755 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9757 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9758 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9759 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9760 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9761 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9762 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9763 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9764 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9765 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9766 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9768 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9769 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9770 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9771 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9772 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9773 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9774 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9775 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9776 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9777 ; GFX940-TGSPLIT-NEXT: s_endpgm
9779 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9780 ; GFX11-WGP: ; %bb.0: ; %entry
9781 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9782 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9783 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9784 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9785 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9786 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9787 ; GFX11-WGP-NEXT: buffer_gl0_inv
9788 ; GFX11-WGP-NEXT: buffer_gl1_inv
9789 ; GFX11-WGP-NEXT: s_endpgm
9791 ; GFX11-CU-LABEL: global_system_one_as_monotonic_acquire_cmpxchg:
9792 ; GFX11-CU: ; %bb.0: ; %entry
9793 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9794 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9795 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9796 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9797 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9798 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9799 ; GFX11-CU-NEXT: buffer_gl0_inv
9800 ; GFX11-CU-NEXT: buffer_gl1_inv
9801 ; GFX11-CU-NEXT: s_endpgm
9802 i32 addrspace(1)* %out, i32 %in, i32 %old) {
9804 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
9805 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") monotonic acquire
9809 define amdgpu_kernel void @global_system_one_as_acquire_acquire_cmpxchg(
9810 ; GFX6-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9811 ; GFX6: ; %bb.0: ; %entry
9812 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9813 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9814 ; GFX6-NEXT: s_mov_b32 s6, -1
9815 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9816 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9817 ; GFX6-NEXT: s_mov_b32 s4, s0
9818 ; GFX6-NEXT: s_mov_b32 s5, s1
9819 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9820 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9821 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9822 ; GFX6-NEXT: buffer_wbinvl1
9823 ; GFX6-NEXT: s_endpgm
9825 ; GFX7-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9826 ; GFX7: ; %bb.0: ; %entry
9827 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9828 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9829 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9830 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9831 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9832 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9833 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9834 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9835 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9836 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9837 ; GFX7-NEXT: buffer_wbinvl1_vol
9838 ; GFX7-NEXT: s_endpgm
9840 ; GFX10-WGP-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9841 ; GFX10-WGP: ; %bb.0: ; %entry
9842 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9843 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9844 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9845 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9846 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9847 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9848 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9849 ; GFX10-WGP-NEXT: buffer_gl0_inv
9850 ; GFX10-WGP-NEXT: buffer_gl1_inv
9851 ; GFX10-WGP-NEXT: s_endpgm
9853 ; GFX10-CU-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9854 ; GFX10-CU: ; %bb.0: ; %entry
9855 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9856 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
9857 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9858 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
9859 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
9860 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9861 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9862 ; GFX10-CU-NEXT: buffer_gl0_inv
9863 ; GFX10-CU-NEXT: buffer_gl1_inv
9864 ; GFX10-CU-NEXT: s_endpgm
9866 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9867 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9868 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9869 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
9870 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
9871 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9872 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9873 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
9874 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
9875 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9876 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9877 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9878 ; SKIP-CACHE-INV-NEXT: s_endpgm
9880 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9881 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9882 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9883 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9884 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9885 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9886 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9887 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9888 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9889 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9890 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9892 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9893 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9894 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9895 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9896 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9897 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
9898 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9899 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9900 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9901 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9902 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9904 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9905 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9906 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9907 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9908 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9909 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9910 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9911 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9912 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9913 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9915 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9916 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9917 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9918 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
9919 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9920 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9921 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
9922 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9923 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9924 ; GFX940-TGSPLIT-NEXT: s_endpgm
9926 ; GFX11-WGP-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9927 ; GFX11-WGP: ; %bb.0: ; %entry
9928 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9929 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
9930 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9931 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9932 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9933 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9934 ; GFX11-WGP-NEXT: buffer_gl0_inv
9935 ; GFX11-WGP-NEXT: buffer_gl1_inv
9936 ; GFX11-WGP-NEXT: s_endpgm
9938 ; GFX11-CU-LABEL: global_system_one_as_acquire_acquire_cmpxchg:
9939 ; GFX11-CU: ; %bb.0: ; %entry
9940 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9941 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
9942 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9943 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9944 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
9945 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9946 ; GFX11-CU-NEXT: buffer_gl0_inv
9947 ; GFX11-CU-NEXT: buffer_gl1_inv
9948 ; GFX11-CU-NEXT: s_endpgm
9949 i32 addrspace(1)* %out, i32 %in, i32 %old) {
9951 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
9952 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acquire acquire
9956 define amdgpu_kernel void @global_system_one_as_release_acquire_cmpxchg(
9957 ; GFX6-LABEL: global_system_one_as_release_acquire_cmpxchg:
9958 ; GFX6: ; %bb.0: ; %entry
9959 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9960 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
9961 ; GFX6-NEXT: s_mov_b32 s6, -1
9962 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9963 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
9964 ; GFX6-NEXT: s_mov_b32 s4, s0
9965 ; GFX6-NEXT: s_mov_b32 s5, s1
9966 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
9967 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9968 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
9969 ; GFX6-NEXT: s_waitcnt vmcnt(0)
9970 ; GFX6-NEXT: buffer_wbinvl1
9971 ; GFX6-NEXT: s_endpgm
9973 ; GFX7-LABEL: global_system_one_as_release_acquire_cmpxchg:
9974 ; GFX7: ; %bb.0: ; %entry
9975 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9976 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9977 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9978 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9979 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9980 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9981 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9982 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9983 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9984 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9985 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9986 ; GFX7-NEXT: buffer_wbinvl1_vol
9987 ; GFX7-NEXT: s_endpgm
9989 ; GFX10-WGP-LABEL: global_system_one_as_release_acquire_cmpxchg:
9990 ; GFX10-WGP: ; %bb.0: ; %entry
9991 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9992 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
9993 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9994 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
9995 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
9996 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9997 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9998 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
9999 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10000 ; GFX10-WGP-NEXT: buffer_gl0_inv
10001 ; GFX10-WGP-NEXT: buffer_gl1_inv
10002 ; GFX10-WGP-NEXT: s_endpgm
10004 ; GFX10-CU-LABEL: global_system_one_as_release_acquire_cmpxchg:
10005 ; GFX10-CU: ; %bb.0: ; %entry
10006 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10007 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10008 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10009 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10010 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10011 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10012 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10013 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10014 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10015 ; GFX10-CU-NEXT: buffer_gl0_inv
10016 ; GFX10-CU-NEXT: buffer_gl1_inv
10017 ; GFX10-CU-NEXT: s_endpgm
10019 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_acquire_cmpxchg:
10020 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10021 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10022 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10023 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10024 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10025 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10026 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10027 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10028 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10029 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10030 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10031 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10032 ; SKIP-CACHE-INV-NEXT: s_endpgm
10034 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_acquire_cmpxchg:
10035 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10036 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10037 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10038 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10039 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10040 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10041 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10042 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10043 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10044 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10045 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10046 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10048 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_acquire_cmpxchg:
10049 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10050 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10051 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10052 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10053 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10054 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10055 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10056 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10057 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10058 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10059 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10060 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10062 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_acquire_cmpxchg:
10063 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10064 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10065 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10066 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10067 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10068 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10069 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10070 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10071 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10072 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10073 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10075 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_acquire_cmpxchg:
10076 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10077 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10078 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10079 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10080 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10081 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10082 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10083 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10084 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10085 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10086 ; GFX940-TGSPLIT-NEXT: s_endpgm
10088 ; GFX11-WGP-LABEL: global_system_one_as_release_acquire_cmpxchg:
10089 ; GFX11-WGP: ; %bb.0: ; %entry
10090 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10091 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10092 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10093 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10094 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10095 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10096 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10097 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10098 ; GFX11-WGP-NEXT: buffer_gl0_inv
10099 ; GFX11-WGP-NEXT: buffer_gl1_inv
10100 ; GFX11-WGP-NEXT: s_endpgm
10102 ; GFX11-CU-LABEL: global_system_one_as_release_acquire_cmpxchg:
10103 ; GFX11-CU: ; %bb.0: ; %entry
10104 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10105 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10106 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10107 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10108 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10109 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10110 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10111 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10112 ; GFX11-CU-NEXT: buffer_gl0_inv
10113 ; GFX11-CU-NEXT: buffer_gl1_inv
10114 ; GFX11-CU-NEXT: s_endpgm
10115 i32 addrspace(1)* %out, i32 %in, i32 %old) {
10117 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
10118 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") release acquire
10122 define amdgpu_kernel void @global_system_one_as_acq_rel_acquire_cmpxchg(
10123 ; GFX6-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10124 ; GFX6: ; %bb.0: ; %entry
10125 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10126 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10127 ; GFX6-NEXT: s_mov_b32 s6, -1
10128 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10129 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10130 ; GFX6-NEXT: s_mov_b32 s4, s0
10131 ; GFX6-NEXT: s_mov_b32 s5, s1
10132 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10133 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10134 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10135 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10136 ; GFX6-NEXT: buffer_wbinvl1
10137 ; GFX6-NEXT: s_endpgm
10139 ; GFX7-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10140 ; GFX7: ; %bb.0: ; %entry
10141 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10142 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10143 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10144 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10145 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10146 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10147 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10148 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10149 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10150 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10151 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10152 ; GFX7-NEXT: buffer_wbinvl1_vol
10153 ; GFX7-NEXT: s_endpgm
10155 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10156 ; GFX10-WGP: ; %bb.0: ; %entry
10157 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10158 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10159 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10160 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10161 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10162 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10163 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10164 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10165 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10166 ; GFX10-WGP-NEXT: buffer_gl0_inv
10167 ; GFX10-WGP-NEXT: buffer_gl1_inv
10168 ; GFX10-WGP-NEXT: s_endpgm
10170 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10171 ; GFX10-CU: ; %bb.0: ; %entry
10172 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10173 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10174 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10175 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10176 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10177 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10178 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10179 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10180 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10181 ; GFX10-CU-NEXT: buffer_gl0_inv
10182 ; GFX10-CU-NEXT: buffer_gl1_inv
10183 ; GFX10-CU-NEXT: s_endpgm
10185 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10186 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10187 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10188 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10189 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10190 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10191 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10192 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10193 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10194 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10195 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10196 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10197 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10198 ; SKIP-CACHE-INV-NEXT: s_endpgm
10200 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10201 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10202 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10203 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10204 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10205 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10206 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10207 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10208 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10209 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10210 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10211 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10212 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10214 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10215 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10216 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10217 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10218 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10219 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10220 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10221 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10222 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10223 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10224 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10225 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10226 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10228 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10229 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10230 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10231 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10232 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10233 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10234 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10235 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10236 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10237 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10238 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10239 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10241 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10242 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10243 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10244 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10245 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10246 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10247 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10248 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10249 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10250 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10251 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10252 ; GFX940-TGSPLIT-NEXT: s_endpgm
10254 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10255 ; GFX11-WGP: ; %bb.0: ; %entry
10256 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10257 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10258 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10259 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10260 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10261 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10262 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10263 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10264 ; GFX11-WGP-NEXT: buffer_gl0_inv
10265 ; GFX11-WGP-NEXT: buffer_gl1_inv
10266 ; GFX11-WGP-NEXT: s_endpgm
10268 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_acquire_cmpxchg:
10269 ; GFX11-CU: ; %bb.0: ; %entry
10270 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10271 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10272 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10273 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10274 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10275 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10276 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10277 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10278 ; GFX11-CU-NEXT: buffer_gl0_inv
10279 ; GFX11-CU-NEXT: buffer_gl1_inv
10280 ; GFX11-CU-NEXT: s_endpgm
10281 i32 addrspace(1)* %out, i32 %in, i32 %old) {
10283 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
10284 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel acquire
10288 define amdgpu_kernel void @global_system_one_as_seq_cst_acquire_cmpxchg(
10289 ; GFX6-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10290 ; GFX6: ; %bb.0: ; %entry
10291 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10292 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10293 ; GFX6-NEXT: s_mov_b32 s6, -1
10294 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10295 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10296 ; GFX6-NEXT: s_mov_b32 s4, s0
10297 ; GFX6-NEXT: s_mov_b32 s5, s1
10298 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10299 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10300 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10301 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10302 ; GFX6-NEXT: buffer_wbinvl1
10303 ; GFX6-NEXT: s_endpgm
10305 ; GFX7-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10306 ; GFX7: ; %bb.0: ; %entry
10307 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10308 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10309 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10310 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10311 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10312 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10313 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10314 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10315 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10316 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10317 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10318 ; GFX7-NEXT: buffer_wbinvl1_vol
10319 ; GFX7-NEXT: s_endpgm
10321 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10322 ; GFX10-WGP: ; %bb.0: ; %entry
10323 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10324 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10325 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10326 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10327 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10328 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10329 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10330 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10331 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10332 ; GFX10-WGP-NEXT: buffer_gl0_inv
10333 ; GFX10-WGP-NEXT: buffer_gl1_inv
10334 ; GFX10-WGP-NEXT: s_endpgm
10336 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10337 ; GFX10-CU: ; %bb.0: ; %entry
10338 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10339 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10340 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10341 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10342 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10343 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10344 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10345 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10346 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10347 ; GFX10-CU-NEXT: buffer_gl0_inv
10348 ; GFX10-CU-NEXT: buffer_gl1_inv
10349 ; GFX10-CU-NEXT: s_endpgm
10351 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10352 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10353 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10354 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10355 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10356 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10357 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10358 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10359 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10360 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10361 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10362 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10363 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10364 ; SKIP-CACHE-INV-NEXT: s_endpgm
10366 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10367 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10368 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10369 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10370 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10371 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10372 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10373 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10374 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10375 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10376 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10377 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10378 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10380 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10381 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10382 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10383 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10384 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10385 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10386 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10387 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10388 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10389 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10390 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10391 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10392 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10394 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10395 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10396 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10397 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10398 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10399 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10400 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10401 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10402 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10403 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10404 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10405 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10407 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10408 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10409 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10410 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10411 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10412 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10413 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10414 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10415 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10416 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10417 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10418 ; GFX940-TGSPLIT-NEXT: s_endpgm
10420 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10421 ; GFX11-WGP: ; %bb.0: ; %entry
10422 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10423 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10424 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10425 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10426 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10427 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10428 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10429 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10430 ; GFX11-WGP-NEXT: buffer_gl0_inv
10431 ; GFX11-WGP-NEXT: buffer_gl1_inv
10432 ; GFX11-WGP-NEXT: s_endpgm
10434 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_acquire_cmpxchg:
10435 ; GFX11-CU: ; %bb.0: ; %entry
10436 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10437 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10438 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10439 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10440 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10441 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10442 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10443 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10444 ; GFX11-CU-NEXT: buffer_gl0_inv
10445 ; GFX11-CU-NEXT: buffer_gl1_inv
10446 ; GFX11-CU-NEXT: s_endpgm
10447 i32 addrspace(1)* %out, i32 %in, i32 %old) {
10449 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
10450 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst acquire
10454 define amdgpu_kernel void @global_system_one_as_monotonic_seq_cst_cmpxchg(
10455 ; GFX6-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10456 ; GFX6: ; %bb.0: ; %entry
10457 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10458 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10459 ; GFX6-NEXT: s_mov_b32 s6, -1
10460 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10461 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10462 ; GFX6-NEXT: s_mov_b32 s4, s0
10463 ; GFX6-NEXT: s_mov_b32 s5, s1
10464 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10465 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10466 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10467 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10468 ; GFX6-NEXT: buffer_wbinvl1
10469 ; GFX6-NEXT: s_endpgm
10471 ; GFX7-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10472 ; GFX7: ; %bb.0: ; %entry
10473 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10474 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10475 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10476 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10477 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10478 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10479 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10480 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10481 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10482 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10483 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10484 ; GFX7-NEXT: buffer_wbinvl1_vol
10485 ; GFX7-NEXT: s_endpgm
10487 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10488 ; GFX10-WGP: ; %bb.0: ; %entry
10489 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10490 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10491 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10492 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10493 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10494 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10495 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10496 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10497 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10498 ; GFX10-WGP-NEXT: buffer_gl0_inv
10499 ; GFX10-WGP-NEXT: buffer_gl1_inv
10500 ; GFX10-WGP-NEXT: s_endpgm
10502 ; GFX10-CU-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10503 ; GFX10-CU: ; %bb.0: ; %entry
10504 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10505 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10506 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10507 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10508 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10509 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10510 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10511 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10512 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10513 ; GFX10-CU-NEXT: buffer_gl0_inv
10514 ; GFX10-CU-NEXT: buffer_gl1_inv
10515 ; GFX10-CU-NEXT: s_endpgm
10517 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10518 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10519 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10520 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10521 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10522 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10523 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10524 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10525 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10526 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10527 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10528 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10529 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10530 ; SKIP-CACHE-INV-NEXT: s_endpgm
10532 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10533 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10534 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10535 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10536 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10537 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10538 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10539 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10540 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10541 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10542 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10543 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10544 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10546 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10547 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10548 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10549 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10550 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10551 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10552 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10553 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10554 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10555 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10556 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10557 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10558 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10560 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10561 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10562 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10563 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10564 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10565 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10566 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10567 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10568 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10569 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10570 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10571 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10573 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10574 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10575 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10576 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10577 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10578 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10579 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10580 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10581 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10582 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10583 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10584 ; GFX940-TGSPLIT-NEXT: s_endpgm
10586 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10587 ; GFX11-WGP: ; %bb.0: ; %entry
10588 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10589 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10590 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10591 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10592 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10593 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10594 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10595 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10596 ; GFX11-WGP-NEXT: buffer_gl0_inv
10597 ; GFX11-WGP-NEXT: buffer_gl1_inv
10598 ; GFX11-WGP-NEXT: s_endpgm
10600 ; GFX11-CU-LABEL: global_system_one_as_monotonic_seq_cst_cmpxchg:
10601 ; GFX11-CU: ; %bb.0: ; %entry
10602 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10603 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10604 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10605 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10606 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10607 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10608 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10609 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10610 ; GFX11-CU-NEXT: buffer_gl0_inv
10611 ; GFX11-CU-NEXT: buffer_gl1_inv
10612 ; GFX11-CU-NEXT: s_endpgm
10613 i32 addrspace(1)* %out, i32 %in, i32 %old) {
10615 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
10616 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") monotonic seq_cst
10620 define amdgpu_kernel void @global_system_one_as_acquire_seq_cst_cmpxchg(
10621 ; GFX6-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10622 ; GFX6: ; %bb.0: ; %entry
10623 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10624 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10625 ; GFX6-NEXT: s_mov_b32 s6, -1
10626 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10627 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10628 ; GFX6-NEXT: s_mov_b32 s4, s0
10629 ; GFX6-NEXT: s_mov_b32 s5, s1
10630 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10631 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10632 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10633 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10634 ; GFX6-NEXT: buffer_wbinvl1
10635 ; GFX6-NEXT: s_endpgm
10637 ; GFX7-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10638 ; GFX7: ; %bb.0: ; %entry
10639 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10640 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10641 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10642 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10643 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10644 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10645 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10646 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10647 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10648 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10649 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10650 ; GFX7-NEXT: buffer_wbinvl1_vol
10651 ; GFX7-NEXT: s_endpgm
10653 ; GFX10-WGP-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10654 ; GFX10-WGP: ; %bb.0: ; %entry
10655 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10656 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10657 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10658 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10659 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10660 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10661 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10662 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10663 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10664 ; GFX10-WGP-NEXT: buffer_gl0_inv
10665 ; GFX10-WGP-NEXT: buffer_gl1_inv
10666 ; GFX10-WGP-NEXT: s_endpgm
10668 ; GFX10-CU-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10669 ; GFX10-CU: ; %bb.0: ; %entry
10670 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10671 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10672 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10673 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10674 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10675 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10676 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10677 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10678 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10679 ; GFX10-CU-NEXT: buffer_gl0_inv
10680 ; GFX10-CU-NEXT: buffer_gl1_inv
10681 ; GFX10-CU-NEXT: s_endpgm
10683 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10684 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10685 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10686 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10687 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10688 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10689 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10690 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10691 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10692 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10693 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10694 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10695 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10696 ; SKIP-CACHE-INV-NEXT: s_endpgm
10698 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10699 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10700 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10701 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10702 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10703 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10704 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10705 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10706 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10707 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10708 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10709 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10710 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10712 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10713 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10714 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10715 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10716 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10717 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10718 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10719 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10720 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10721 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10722 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10723 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10724 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10726 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10727 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10728 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10729 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10730 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10731 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10732 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10733 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10734 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10735 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10736 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10737 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10739 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10740 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10741 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10742 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10743 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10744 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10745 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10746 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10747 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10748 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10749 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10750 ; GFX940-TGSPLIT-NEXT: s_endpgm
10752 ; GFX11-WGP-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10753 ; GFX11-WGP: ; %bb.0: ; %entry
10754 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10755 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10756 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10757 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10758 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10759 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10760 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10761 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10762 ; GFX11-WGP-NEXT: buffer_gl0_inv
10763 ; GFX11-WGP-NEXT: buffer_gl1_inv
10764 ; GFX11-WGP-NEXT: s_endpgm
10766 ; GFX11-CU-LABEL: global_system_one_as_acquire_seq_cst_cmpxchg:
10767 ; GFX11-CU: ; %bb.0: ; %entry
10768 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10769 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10770 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10771 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10772 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10773 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10774 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10775 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10776 ; GFX11-CU-NEXT: buffer_gl0_inv
10777 ; GFX11-CU-NEXT: buffer_gl1_inv
10778 ; GFX11-CU-NEXT: s_endpgm
10779 i32 addrspace(1)* %out, i32 %in, i32 %old) {
10781 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
10782 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acquire seq_cst
10786 define amdgpu_kernel void @global_system_one_as_release_seq_cst_cmpxchg(
10787 ; GFX6-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10788 ; GFX6: ; %bb.0: ; %entry
10789 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10790 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10791 ; GFX6-NEXT: s_mov_b32 s6, -1
10792 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10793 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10794 ; GFX6-NEXT: s_mov_b32 s4, s0
10795 ; GFX6-NEXT: s_mov_b32 s5, s1
10796 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10797 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10798 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10799 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10800 ; GFX6-NEXT: buffer_wbinvl1
10801 ; GFX6-NEXT: s_endpgm
10803 ; GFX7-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10804 ; GFX7: ; %bb.0: ; %entry
10805 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10806 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10807 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10808 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10809 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10810 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10811 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10812 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10813 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10814 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10815 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10816 ; GFX7-NEXT: buffer_wbinvl1_vol
10817 ; GFX7-NEXT: s_endpgm
10819 ; GFX10-WGP-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10820 ; GFX10-WGP: ; %bb.0: ; %entry
10821 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10822 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10823 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10824 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10825 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10826 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10827 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10828 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10829 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10830 ; GFX10-WGP-NEXT: buffer_gl0_inv
10831 ; GFX10-WGP-NEXT: buffer_gl1_inv
10832 ; GFX10-WGP-NEXT: s_endpgm
10834 ; GFX10-CU-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10835 ; GFX10-CU: ; %bb.0: ; %entry
10836 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10837 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
10838 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10839 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
10840 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
10841 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10842 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10843 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10844 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10845 ; GFX10-CU-NEXT: buffer_gl0_inv
10846 ; GFX10-CU-NEXT: buffer_gl1_inv
10847 ; GFX10-CU-NEXT: s_endpgm
10849 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10850 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10851 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10852 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
10853 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
10854 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10855 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
10856 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
10857 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
10858 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
10859 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10860 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10861 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10862 ; SKIP-CACHE-INV-NEXT: s_endpgm
10864 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10865 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10866 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10867 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10868 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10869 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10870 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10871 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10872 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10873 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10874 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10875 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10876 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10878 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10879 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10880 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10881 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10882 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10883 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
10884 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10885 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10886 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10887 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10888 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10889 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10890 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10892 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10893 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10894 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10895 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10896 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10897 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10898 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10899 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10900 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10901 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10902 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10903 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10905 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10906 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10907 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10908 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
10909 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10910 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
10911 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10912 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10913 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
10914 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10915 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10916 ; GFX940-TGSPLIT-NEXT: s_endpgm
10918 ; GFX11-WGP-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10919 ; GFX11-WGP: ; %bb.0: ; %entry
10920 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10921 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
10922 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10923 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10924 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10925 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10926 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10927 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10928 ; GFX11-WGP-NEXT: buffer_gl0_inv
10929 ; GFX11-WGP-NEXT: buffer_gl1_inv
10930 ; GFX11-WGP-NEXT: s_endpgm
10932 ; GFX11-CU-LABEL: global_system_one_as_release_seq_cst_cmpxchg:
10933 ; GFX11-CU: ; %bb.0: ; %entry
10934 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10935 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
10936 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10937 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
10938 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10939 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10940 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
10941 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10942 ; GFX11-CU-NEXT: buffer_gl0_inv
10943 ; GFX11-CU-NEXT: buffer_gl1_inv
10944 ; GFX11-CU-NEXT: s_endpgm
10945 i32 addrspace(1)* %out, i32 %in, i32 %old) {
10947 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
10948 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") release seq_cst
10952 define amdgpu_kernel void @global_system_one_as_acq_rel_seq_cst_cmpxchg(
10953 ; GFX6-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
10954 ; GFX6: ; %bb.0: ; %entry
10955 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10956 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
10957 ; GFX6-NEXT: s_mov_b32 s6, -1
10958 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10959 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
10960 ; GFX6-NEXT: s_mov_b32 s4, s0
10961 ; GFX6-NEXT: s_mov_b32 s5, s1
10962 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
10963 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10964 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
10965 ; GFX6-NEXT: s_waitcnt vmcnt(0)
10966 ; GFX6-NEXT: buffer_wbinvl1
10967 ; GFX6-NEXT: s_endpgm
10969 ; GFX7-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
10970 ; GFX7: ; %bb.0: ; %entry
10971 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10972 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10973 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10974 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10975 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10976 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10977 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10978 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10979 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10980 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10981 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10982 ; GFX7-NEXT: buffer_wbinvl1_vol
10983 ; GFX7-NEXT: s_endpgm
10985 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
10986 ; GFX10-WGP: ; %bb.0: ; %entry
10987 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10988 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
10989 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10990 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
10991 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
10992 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10993 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10994 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
10995 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10996 ; GFX10-WGP-NEXT: buffer_gl0_inv
10997 ; GFX10-WGP-NEXT: buffer_gl1_inv
10998 ; GFX10-WGP-NEXT: s_endpgm
11000 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
11001 ; GFX10-CU: ; %bb.0: ; %entry
11002 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11003 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11004 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11005 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11006 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11007 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11008 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11009 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
11010 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11011 ; GFX10-CU-NEXT: buffer_gl0_inv
11012 ; GFX10-CU-NEXT: buffer_gl1_inv
11013 ; GFX10-CU-NEXT: s_endpgm
11015 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
11016 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11017 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11018 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11019 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11020 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11021 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11022 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11023 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11024 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11025 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11026 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
11027 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11028 ; SKIP-CACHE-INV-NEXT: s_endpgm
11030 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
11031 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11032 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11033 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11034 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11035 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11036 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11037 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11038 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
11039 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11040 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11041 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11042 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11044 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
11045 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11046 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11047 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11048 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11049 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11050 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11051 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11052 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
11053 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11054 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11055 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11056 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11058 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
11059 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11060 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11061 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11062 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11063 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11064 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11065 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11066 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
11067 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11068 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11069 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11071 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
11072 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11073 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11074 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11075 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11076 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11077 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11078 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11079 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
11080 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11081 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11082 ; GFX940-TGSPLIT-NEXT: s_endpgm
11084 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
11085 ; GFX11-WGP: ; %bb.0: ; %entry
11086 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11087 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11088 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11089 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11090 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11091 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11092 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
11093 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11094 ; GFX11-WGP-NEXT: buffer_gl0_inv
11095 ; GFX11-WGP-NEXT: buffer_gl1_inv
11096 ; GFX11-WGP-NEXT: s_endpgm
11098 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_seq_cst_cmpxchg:
11099 ; GFX11-CU: ; %bb.0: ; %entry
11100 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11101 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11102 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11103 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11104 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11105 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11106 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
11107 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11108 ; GFX11-CU-NEXT: buffer_gl0_inv
11109 ; GFX11-CU-NEXT: buffer_gl1_inv
11110 ; GFX11-CU-NEXT: s_endpgm
11111 i32 addrspace(1)* %out, i32 %in, i32 %old) {
11113 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
11114 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel seq_cst
11118 define amdgpu_kernel void @global_system_one_as_seq_cst_seq_cst_cmpxchg(
11119 ; GFX6-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11120 ; GFX6: ; %bb.0: ; %entry
11121 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11122 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11123 ; GFX6-NEXT: s_mov_b32 s6, -1
11124 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11125 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11126 ; GFX6-NEXT: s_mov_b32 s4, s0
11127 ; GFX6-NEXT: s_mov_b32 s5, s1
11128 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11129 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11130 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
11131 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11132 ; GFX6-NEXT: buffer_wbinvl1
11133 ; GFX6-NEXT: s_endpgm
11135 ; GFX7-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11136 ; GFX7: ; %bb.0: ; %entry
11137 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11138 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11139 ; GFX7-NEXT: s_add_u32 s0, s0, 16
11140 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
11141 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11142 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11143 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11144 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11145 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11146 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11147 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11148 ; GFX7-NEXT: buffer_wbinvl1_vol
11149 ; GFX7-NEXT: s_endpgm
11151 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11152 ; GFX10-WGP: ; %bb.0: ; %entry
11153 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11154 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11155 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11156 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11157 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11158 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11159 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11160 ; GFX10-WGP-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
11161 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11162 ; GFX10-WGP-NEXT: buffer_gl0_inv
11163 ; GFX10-WGP-NEXT: buffer_gl1_inv
11164 ; GFX10-WGP-NEXT: s_endpgm
11166 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11167 ; GFX10-CU: ; %bb.0: ; %entry
11168 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11169 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11170 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11171 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11172 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11173 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11174 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11175 ; GFX10-CU-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
11176 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11177 ; GFX10-CU-NEXT: buffer_gl0_inv
11178 ; GFX10-CU-NEXT: buffer_gl1_inv
11179 ; GFX10-CU-NEXT: s_endpgm
11181 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11182 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11183 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11184 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11185 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11186 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11187 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11188 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11189 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11190 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11191 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11192 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16
11193 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11194 ; SKIP-CACHE-INV-NEXT: s_endpgm
11196 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11197 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11198 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11199 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11200 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11201 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11202 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11203 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11204 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
11205 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11206 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11207 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11208 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11210 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11211 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11212 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11213 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11214 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11215 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11216 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11217 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11218 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16
11219 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11220 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11221 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11222 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11224 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11225 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11226 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11227 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11228 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11229 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11230 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11231 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11232 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
11233 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11234 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11235 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11237 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11238 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11239 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11240 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11241 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11242 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11243 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11244 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11245 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v2, v[0:1], s[0:1] offset:16 sc1
11246 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11247 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11248 ; GFX940-TGSPLIT-NEXT: s_endpgm
11250 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11251 ; GFX11-WGP: ; %bb.0: ; %entry
11252 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11253 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11254 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11255 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11256 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11257 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11258 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
11259 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11260 ; GFX11-WGP-NEXT: buffer_gl0_inv
11261 ; GFX11-WGP-NEXT: buffer_gl1_inv
11262 ; GFX11-WGP-NEXT: s_endpgm
11264 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_seq_cst_cmpxchg:
11265 ; GFX11-CU: ; %bb.0: ; %entry
11266 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11267 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11268 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11269 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11270 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11271 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11272 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v2, v[0:1], s[0:1] offset:16
11273 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11274 ; GFX11-CU-NEXT: buffer_gl0_inv
11275 ; GFX11-CU-NEXT: buffer_gl1_inv
11276 ; GFX11-CU-NEXT: s_endpgm
11277 i32 addrspace(1)* %out, i32 %in, i32 %old) {
11279 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
11280 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst seq_cst
11284 define amdgpu_kernel void @global_system_one_as_monotonic_monotonic_ret_cmpxchg(
11285 ; GFX6-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11286 ; GFX6: ; %bb.0: ; %entry
11287 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11288 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11289 ; GFX6-NEXT: s_mov_b32 s6, -1
11290 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11291 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11292 ; GFX6-NEXT: s_mov_b32 s4, s0
11293 ; GFX6-NEXT: s_mov_b32 s5, s1
11294 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11295 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11296 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11297 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11298 ; GFX6-NEXT: s_endpgm
11300 ; GFX7-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11301 ; GFX7: ; %bb.0: ; %entry
11302 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11303 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11304 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11305 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11306 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11307 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11308 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11309 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11310 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11311 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11312 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11313 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11314 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11315 ; GFX7-NEXT: s_endpgm
11317 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11318 ; GFX10-WGP: ; %bb.0: ; %entry
11319 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11320 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11321 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11322 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11323 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11324 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11325 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11326 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11327 ; GFX10-WGP-NEXT: s_endpgm
11329 ; GFX10-CU-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11330 ; GFX10-CU: ; %bb.0: ; %entry
11331 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11332 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11333 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11334 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11335 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11336 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11337 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11338 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11339 ; GFX10-CU-NEXT: s_endpgm
11341 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11342 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11343 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11344 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11345 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11346 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11347 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11348 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11349 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11350 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11351 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11352 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11353 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11354 ; SKIP-CACHE-INV-NEXT: s_endpgm
11356 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11357 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11358 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11359 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11360 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11361 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11362 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11363 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11364 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11365 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11367 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11368 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11369 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11370 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11371 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11372 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11373 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11374 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11375 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11376 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11378 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11379 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11380 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11381 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11382 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11383 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11384 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
11385 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11386 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11387 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11389 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11390 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11391 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11392 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11393 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11394 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11395 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
11396 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11397 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11398 ; GFX940-TGSPLIT-NEXT: s_endpgm
11400 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11401 ; GFX11-WGP: ; %bb.0: ; %entry
11402 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11403 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11404 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11405 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11406 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11407 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11408 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11409 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11410 ; GFX11-WGP-NEXT: s_endpgm
11412 ; GFX11-CU-LABEL: global_system_one_as_monotonic_monotonic_ret_cmpxchg:
11413 ; GFX11-CU: ; %bb.0: ; %entry
11414 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11415 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11416 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11417 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11418 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11419 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11420 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11421 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11422 ; GFX11-CU-NEXT: s_endpgm
11423 i32 addrspace(1)* %out, i32 %in, i32 %old) {
11425 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
11426 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") monotonic monotonic
11427 %val0 = extractvalue { i32, i1 } %val, 0
11428 store i32 %val0, i32 addrspace(1)* %out, align 4
11432 define amdgpu_kernel void @global_system_one_as_acquire_monotonic_ret_cmpxchg(
11433 ; GFX6-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11434 ; GFX6: ; %bb.0: ; %entry
11435 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11436 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11437 ; GFX6-NEXT: s_mov_b32 s6, -1
11438 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11439 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11440 ; GFX6-NEXT: s_mov_b32 s4, s0
11441 ; GFX6-NEXT: s_mov_b32 s5, s1
11442 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11443 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11444 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11445 ; GFX6-NEXT: buffer_wbinvl1
11446 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11447 ; GFX6-NEXT: s_endpgm
11449 ; GFX7-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11450 ; GFX7: ; %bb.0: ; %entry
11451 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11452 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11453 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11454 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11455 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11456 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11457 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11458 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11459 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11460 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11461 ; GFX7-NEXT: buffer_wbinvl1_vol
11462 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11463 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11464 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11465 ; GFX7-NEXT: s_endpgm
11467 ; GFX10-WGP-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11468 ; GFX10-WGP: ; %bb.0: ; %entry
11469 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11470 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11471 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11472 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11473 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11474 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11475 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11476 ; GFX10-WGP-NEXT: buffer_gl0_inv
11477 ; GFX10-WGP-NEXT: buffer_gl1_inv
11478 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11479 ; GFX10-WGP-NEXT: s_endpgm
11481 ; GFX10-CU-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11482 ; GFX10-CU: ; %bb.0: ; %entry
11483 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11484 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11485 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11486 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11487 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11488 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11489 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11490 ; GFX10-CU-NEXT: buffer_gl0_inv
11491 ; GFX10-CU-NEXT: buffer_gl1_inv
11492 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11493 ; GFX10-CU-NEXT: s_endpgm
11495 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11496 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11497 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11498 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11499 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11500 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11501 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11502 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11503 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11504 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11505 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11506 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11507 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11508 ; SKIP-CACHE-INV-NEXT: s_endpgm
11510 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11511 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11512 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11513 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11514 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11515 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11516 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11517 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11518 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11519 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11520 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11521 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11523 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11524 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11525 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11526 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11527 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11528 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11529 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11530 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11531 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11532 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11533 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11534 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11536 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11537 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11538 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11539 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11540 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11541 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11542 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
11543 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11544 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11545 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11546 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11548 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11549 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11550 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11551 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11552 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11553 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11554 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
11555 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11556 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11557 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11558 ; GFX940-TGSPLIT-NEXT: s_endpgm
11560 ; GFX11-WGP-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11561 ; GFX11-WGP: ; %bb.0: ; %entry
11562 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11563 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11564 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11565 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11566 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11567 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11568 ; GFX11-WGP-NEXT: buffer_gl0_inv
11569 ; GFX11-WGP-NEXT: buffer_gl1_inv
11570 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11571 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11572 ; GFX11-WGP-NEXT: s_endpgm
11574 ; GFX11-CU-LABEL: global_system_one_as_acquire_monotonic_ret_cmpxchg:
11575 ; GFX11-CU: ; %bb.0: ; %entry
11576 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11577 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11578 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11579 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11580 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11581 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11582 ; GFX11-CU-NEXT: buffer_gl0_inv
11583 ; GFX11-CU-NEXT: buffer_gl1_inv
11584 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11585 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11586 ; GFX11-CU-NEXT: s_endpgm
11587 i32 addrspace(1)* %out, i32 %in, i32 %old) {
11589 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
11590 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acquire monotonic
11591 %val0 = extractvalue { i32, i1 } %val, 0
11592 store i32 %val0, i32 addrspace(1)* %out, align 4
11596 define amdgpu_kernel void @global_system_one_as_release_monotonic_ret_cmpxchg(
11597 ; GFX6-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11598 ; GFX6: ; %bb.0: ; %entry
11599 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11600 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11601 ; GFX6-NEXT: s_mov_b32 s6, -1
11602 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11603 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11604 ; GFX6-NEXT: s_mov_b32 s4, s0
11605 ; GFX6-NEXT: s_mov_b32 s5, s1
11606 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11607 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11608 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11609 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11610 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11611 ; GFX6-NEXT: s_endpgm
11613 ; GFX7-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11614 ; GFX7: ; %bb.0: ; %entry
11615 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11616 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11617 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11618 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11619 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11620 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11621 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11622 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11623 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11624 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11625 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11626 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11627 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11628 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11629 ; GFX7-NEXT: s_endpgm
11631 ; GFX10-WGP-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11632 ; GFX10-WGP: ; %bb.0: ; %entry
11633 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11634 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11635 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11636 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11637 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11638 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11639 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11640 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11641 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11642 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11643 ; GFX10-WGP-NEXT: s_endpgm
11645 ; GFX10-CU-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11646 ; GFX10-CU: ; %bb.0: ; %entry
11647 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11648 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11649 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11650 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11651 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11652 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11653 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11654 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11655 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11656 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11657 ; GFX10-CU-NEXT: s_endpgm
11659 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11660 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11661 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11662 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11663 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11664 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11665 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11666 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11667 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11668 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11669 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11670 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11671 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11672 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11673 ; SKIP-CACHE-INV-NEXT: s_endpgm
11675 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11676 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11677 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11678 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11679 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11680 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11681 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11682 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11683 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11684 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11685 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11686 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11688 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11689 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11690 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11691 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11692 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11693 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11694 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11695 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11696 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11697 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11698 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11699 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11701 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11702 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11703 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11704 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11705 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11706 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11707 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11708 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11709 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
11710 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11711 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11712 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11714 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11715 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11716 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11717 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11718 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11719 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11720 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11721 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11722 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
11723 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11724 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11725 ; GFX940-TGSPLIT-NEXT: s_endpgm
11727 ; GFX11-WGP-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11728 ; GFX11-WGP: ; %bb.0: ; %entry
11729 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11730 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11731 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11732 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11733 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11734 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11735 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11736 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11737 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11738 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11739 ; GFX11-WGP-NEXT: s_endpgm
11741 ; GFX11-CU-LABEL: global_system_one_as_release_monotonic_ret_cmpxchg:
11742 ; GFX11-CU: ; %bb.0: ; %entry
11743 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11744 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11745 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11746 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11747 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11748 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11749 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11750 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11751 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11752 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11753 ; GFX11-CU-NEXT: s_endpgm
11754 i32 addrspace(1)* %out, i32 %in, i32 %old) {
11756 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
11757 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") release monotonic
11758 %val0 = extractvalue { i32, i1 } %val, 0
11759 store i32 %val0, i32 addrspace(1)* %out, align 4
11763 define amdgpu_kernel void @global_system_one_as_acq_rel_monotonic_ret_cmpxchg(
11764 ; GFX6-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11765 ; GFX6: ; %bb.0: ; %entry
11766 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11767 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11768 ; GFX6-NEXT: s_mov_b32 s6, -1
11769 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11770 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11771 ; GFX6-NEXT: s_mov_b32 s4, s0
11772 ; GFX6-NEXT: s_mov_b32 s5, s1
11773 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11774 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11775 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11776 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11777 ; GFX6-NEXT: buffer_wbinvl1
11778 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11779 ; GFX6-NEXT: s_endpgm
11781 ; GFX7-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11782 ; GFX7: ; %bb.0: ; %entry
11783 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11784 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11785 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11786 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11787 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11788 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11789 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11790 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11791 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11792 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11793 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11794 ; GFX7-NEXT: buffer_wbinvl1_vol
11795 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11796 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11797 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11798 ; GFX7-NEXT: s_endpgm
11800 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11801 ; GFX10-WGP: ; %bb.0: ; %entry
11802 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11803 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11804 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11805 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11806 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11807 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11808 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11809 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11810 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11811 ; GFX10-WGP-NEXT: buffer_gl0_inv
11812 ; GFX10-WGP-NEXT: buffer_gl1_inv
11813 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11814 ; GFX10-WGP-NEXT: s_endpgm
11816 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11817 ; GFX10-CU: ; %bb.0: ; %entry
11818 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11819 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
11820 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11821 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
11822 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
11823 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11824 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11825 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11826 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11827 ; GFX10-CU-NEXT: buffer_gl0_inv
11828 ; GFX10-CU-NEXT: buffer_gl1_inv
11829 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
11830 ; GFX10-CU-NEXT: s_endpgm
11832 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11833 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11834 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11835 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
11836 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
11837 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11838 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11839 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
11840 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
11841 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
11842 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11843 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11844 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11845 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
11846 ; SKIP-CACHE-INV-NEXT: s_endpgm
11848 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11849 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11850 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11851 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11852 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11853 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11854 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11855 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11856 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11857 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11858 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11859 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11860 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11861 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11863 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11864 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11865 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11866 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11867 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11868 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
11869 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11870 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11871 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11872 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11873 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11874 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11875 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11876 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11878 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11879 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11880 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11881 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11882 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11883 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11884 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11885 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11886 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
11887 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11888 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11889 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11890 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11892 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11893 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11894 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11895 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
11896 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11897 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
11898 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11899 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11900 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
11901 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11902 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11903 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
11904 ; GFX940-TGSPLIT-NEXT: s_endpgm
11906 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11907 ; GFX11-WGP: ; %bb.0: ; %entry
11908 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11909 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
11910 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11911 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11912 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11913 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11914 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11915 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11916 ; GFX11-WGP-NEXT: buffer_gl0_inv
11917 ; GFX11-WGP-NEXT: buffer_gl1_inv
11918 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
11919 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11920 ; GFX11-WGP-NEXT: s_endpgm
11922 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_monotonic_ret_cmpxchg:
11923 ; GFX11-CU: ; %bb.0: ; %entry
11924 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11925 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
11926 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11927 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
11928 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11929 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11930 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
11931 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11932 ; GFX11-CU-NEXT: buffer_gl0_inv
11933 ; GFX11-CU-NEXT: buffer_gl1_inv
11934 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
11935 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11936 ; GFX11-CU-NEXT: s_endpgm
11937 i32 addrspace(1)* %out, i32 %in, i32 %old) {
11939 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
11940 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel monotonic
11941 %val0 = extractvalue { i32, i1 } %val, 0
11942 store i32 %val0, i32 addrspace(1)* %out, align 4
11946 define amdgpu_kernel void @global_system_one_as_seq_cst_monotonic_ret_cmpxchg(
11947 ; GFX6-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
11948 ; GFX6: ; %bb.0: ; %entry
11949 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11950 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
11951 ; GFX6-NEXT: s_mov_b32 s6, -1
11952 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11953 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
11954 ; GFX6-NEXT: s_mov_b32 s4, s0
11955 ; GFX6-NEXT: s_mov_b32 s5, s1
11956 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
11957 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11958 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
11959 ; GFX6-NEXT: s_waitcnt vmcnt(0)
11960 ; GFX6-NEXT: buffer_wbinvl1
11961 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
11962 ; GFX6-NEXT: s_endpgm
11964 ; GFX7-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
11965 ; GFX7: ; %bb.0: ; %entry
11966 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11967 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11968 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11969 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11970 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11971 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11972 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11973 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11974 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11975 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11976 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11977 ; GFX7-NEXT: buffer_wbinvl1_vol
11978 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11979 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11980 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11981 ; GFX7-NEXT: s_endpgm
11983 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
11984 ; GFX10-WGP: ; %bb.0: ; %entry
11985 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11986 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
11987 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11988 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
11989 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
11990 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11991 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11992 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
11993 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11994 ; GFX10-WGP-NEXT: buffer_gl0_inv
11995 ; GFX10-WGP-NEXT: buffer_gl1_inv
11996 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
11997 ; GFX10-WGP-NEXT: s_endpgm
11999 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12000 ; GFX10-CU: ; %bb.0: ; %entry
12001 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12002 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
12003 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12004 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
12005 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
12006 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12007 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12008 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12009 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12010 ; GFX10-CU-NEXT: buffer_gl0_inv
12011 ; GFX10-CU-NEXT: buffer_gl1_inv
12012 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
12013 ; GFX10-CU-NEXT: s_endpgm
12015 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12016 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12017 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12018 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
12019 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12020 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12021 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12022 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
12023 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
12024 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
12025 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12026 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12027 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12028 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
12029 ; SKIP-CACHE-INV-NEXT: s_endpgm
12031 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12032 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12033 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12034 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12035 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12036 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12037 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12038 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12039 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12040 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12041 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12042 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12043 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12044 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12046 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12047 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12048 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12049 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12050 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12051 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12052 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12053 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12054 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12055 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12056 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12057 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12058 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12059 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12061 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12062 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12063 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12064 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12065 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12066 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12067 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12068 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12069 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12070 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12071 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12072 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12073 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12075 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12076 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12077 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12078 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12079 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12080 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12081 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12082 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12083 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12084 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12085 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12086 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12087 ; GFX940-TGSPLIT-NEXT: s_endpgm
12089 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12090 ; GFX11-WGP: ; %bb.0: ; %entry
12091 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12092 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
12093 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12094 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12095 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12096 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12097 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12098 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12099 ; GFX11-WGP-NEXT: buffer_gl0_inv
12100 ; GFX11-WGP-NEXT: buffer_gl1_inv
12101 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
12102 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12103 ; GFX11-WGP-NEXT: s_endpgm
12105 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12106 ; GFX11-CU: ; %bb.0: ; %entry
12107 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12108 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
12109 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12110 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12111 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12112 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12113 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12114 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12115 ; GFX11-CU-NEXT: buffer_gl0_inv
12116 ; GFX11-CU-NEXT: buffer_gl1_inv
12117 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
12118 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12119 ; GFX11-CU-NEXT: s_endpgm
12120 i32 addrspace(1)* %out, i32 %in, i32 %old) {
12122 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
12123 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst monotonic
12124 %val0 = extractvalue { i32, i1 } %val, 0
12125 store i32 %val0, i32 addrspace(1)* %out, align 4
12129 define amdgpu_kernel void @global_system_one_as_monotonic_acquire_ret_cmpxchg(
12130 ; GFX6-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12131 ; GFX6: ; %bb.0: ; %entry
12132 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12133 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
12134 ; GFX6-NEXT: s_mov_b32 s6, -1
12135 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12136 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
12137 ; GFX6-NEXT: s_mov_b32 s4, s0
12138 ; GFX6-NEXT: s_mov_b32 s5, s1
12139 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
12140 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12141 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12142 ; GFX6-NEXT: buffer_wbinvl1
12143 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
12144 ; GFX6-NEXT: s_endpgm
12146 ; GFX7-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12147 ; GFX7: ; %bb.0: ; %entry
12148 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12149 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12150 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12151 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12152 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12153 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12154 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12155 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12156 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12157 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12158 ; GFX7-NEXT: buffer_wbinvl1_vol
12159 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12160 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12161 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12162 ; GFX7-NEXT: s_endpgm
12164 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12165 ; GFX10-WGP: ; %bb.0: ; %entry
12166 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12167 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
12168 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12169 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
12170 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
12171 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12172 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12173 ; GFX10-WGP-NEXT: buffer_gl0_inv
12174 ; GFX10-WGP-NEXT: buffer_gl1_inv
12175 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
12176 ; GFX10-WGP-NEXT: s_endpgm
12178 ; GFX10-CU-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12179 ; GFX10-CU: ; %bb.0: ; %entry
12180 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12181 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
12182 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12183 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
12184 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
12185 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12186 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12187 ; GFX10-CU-NEXT: buffer_gl0_inv
12188 ; GFX10-CU-NEXT: buffer_gl1_inv
12189 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
12190 ; GFX10-CU-NEXT: s_endpgm
12192 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12193 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12194 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12195 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
12196 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12197 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12198 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12199 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
12200 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
12201 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
12202 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12203 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12204 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
12205 ; SKIP-CACHE-INV-NEXT: s_endpgm
12207 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12208 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12209 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12210 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12211 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12212 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12213 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12214 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12215 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12216 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12217 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12218 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12220 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12221 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12222 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12223 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12224 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12225 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12226 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12227 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12228 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12229 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12230 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12231 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12233 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12234 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12235 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12236 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12237 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12238 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12239 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12240 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12241 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12242 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12243 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12245 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12246 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12247 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12248 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12249 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12250 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12251 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12252 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12253 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12254 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12255 ; GFX940-TGSPLIT-NEXT: s_endpgm
12257 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12258 ; GFX11-WGP: ; %bb.0: ; %entry
12259 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12260 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
12261 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12262 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12263 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12264 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12265 ; GFX11-WGP-NEXT: buffer_gl0_inv
12266 ; GFX11-WGP-NEXT: buffer_gl1_inv
12267 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
12268 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12269 ; GFX11-WGP-NEXT: s_endpgm
12271 ; GFX11-CU-LABEL: global_system_one_as_monotonic_acquire_ret_cmpxchg:
12272 ; GFX11-CU: ; %bb.0: ; %entry
12273 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12274 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
12275 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12276 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12277 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12278 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12279 ; GFX11-CU-NEXT: buffer_gl0_inv
12280 ; GFX11-CU-NEXT: buffer_gl1_inv
12281 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
12282 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12283 ; GFX11-CU-NEXT: s_endpgm
12284 i32 addrspace(1)* %out, i32 %in, i32 %old) {
12286 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
12287 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") monotonic acquire
12288 %val0 = extractvalue { i32, i1 } %val, 0
12289 store i32 %val0, i32 addrspace(1)* %out, align 4
12293 define amdgpu_kernel void @global_system_one_as_acquire_acquire_ret_cmpxchg(
12294 ; GFX6-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12295 ; GFX6: ; %bb.0: ; %entry
12296 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12297 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
12298 ; GFX6-NEXT: s_mov_b32 s6, -1
12299 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12300 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
12301 ; GFX6-NEXT: s_mov_b32 s4, s0
12302 ; GFX6-NEXT: s_mov_b32 s5, s1
12303 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
12304 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12305 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12306 ; GFX6-NEXT: buffer_wbinvl1
12307 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
12308 ; GFX6-NEXT: s_endpgm
12310 ; GFX7-LABEL: global_system_one_as_acquire_acquire_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: s_waitcnt vmcnt(0)
12322 ; GFX7-NEXT: buffer_wbinvl1_vol
12323 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12324 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12325 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12326 ; GFX7-NEXT: s_endpgm
12328 ; GFX10-WGP-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12329 ; GFX10-WGP: ; %bb.0: ; %entry
12330 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12331 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
12332 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12333 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
12334 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
12335 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12336 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12337 ; GFX10-WGP-NEXT: buffer_gl0_inv
12338 ; GFX10-WGP-NEXT: buffer_gl1_inv
12339 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
12340 ; GFX10-WGP-NEXT: s_endpgm
12342 ; GFX10-CU-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12343 ; GFX10-CU: ; %bb.0: ; %entry
12344 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12345 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
12346 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12347 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
12348 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
12349 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12350 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12351 ; GFX10-CU-NEXT: buffer_gl0_inv
12352 ; GFX10-CU-NEXT: buffer_gl1_inv
12353 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
12354 ; GFX10-CU-NEXT: s_endpgm
12356 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12357 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12358 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12359 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
12360 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12361 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12362 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12363 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
12364 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
12365 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
12366 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12367 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12368 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
12369 ; SKIP-CACHE-INV-NEXT: s_endpgm
12371 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12372 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12373 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12374 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12375 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12376 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12377 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12378 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12379 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12380 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12381 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12382 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12384 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12385 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12386 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12387 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12388 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12389 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12390 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12391 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12392 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12393 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12394 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12395 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12397 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12398 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12399 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12400 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12401 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12402 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12403 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12404 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12405 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12406 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12407 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12409 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12410 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12411 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12412 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12413 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12414 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12415 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12416 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12417 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12418 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12419 ; GFX940-TGSPLIT-NEXT: s_endpgm
12421 ; GFX11-WGP-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12422 ; GFX11-WGP: ; %bb.0: ; %entry
12423 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12424 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
12425 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12426 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12427 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12428 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12429 ; GFX11-WGP-NEXT: buffer_gl0_inv
12430 ; GFX11-WGP-NEXT: buffer_gl1_inv
12431 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
12432 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12433 ; GFX11-WGP-NEXT: s_endpgm
12435 ; GFX11-CU-LABEL: global_system_one_as_acquire_acquire_ret_cmpxchg:
12436 ; GFX11-CU: ; %bb.0: ; %entry
12437 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12438 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
12439 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12440 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12441 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12442 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12443 ; GFX11-CU-NEXT: buffer_gl0_inv
12444 ; GFX11-CU-NEXT: buffer_gl1_inv
12445 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
12446 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12447 ; GFX11-CU-NEXT: s_endpgm
12448 i32 addrspace(1)* %out, i32 %in, i32 %old) {
12450 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
12451 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acquire acquire
12452 %val0 = extractvalue { i32, i1 } %val, 0
12453 store i32 %val0, i32 addrspace(1)* %out, align 4
12457 define amdgpu_kernel void @global_system_one_as_release_acquire_ret_cmpxchg(
12458 ; GFX6-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12459 ; GFX6: ; %bb.0: ; %entry
12460 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12461 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
12462 ; GFX6-NEXT: s_mov_b32 s6, -1
12463 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12464 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
12465 ; GFX6-NEXT: s_mov_b32 s4, s0
12466 ; GFX6-NEXT: s_mov_b32 s5, s1
12467 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
12468 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12469 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12470 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12471 ; GFX6-NEXT: buffer_wbinvl1
12472 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
12473 ; GFX6-NEXT: s_endpgm
12475 ; GFX7-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12476 ; GFX7: ; %bb.0: ; %entry
12477 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12478 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12479 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12480 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12481 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12482 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12483 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12484 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12485 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12486 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12487 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12488 ; GFX7-NEXT: buffer_wbinvl1_vol
12489 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12490 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12491 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12492 ; GFX7-NEXT: s_endpgm
12494 ; GFX10-WGP-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12495 ; GFX10-WGP: ; %bb.0: ; %entry
12496 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12497 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
12498 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12499 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
12500 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
12501 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12502 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12503 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12504 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12505 ; GFX10-WGP-NEXT: buffer_gl0_inv
12506 ; GFX10-WGP-NEXT: buffer_gl1_inv
12507 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
12508 ; GFX10-WGP-NEXT: s_endpgm
12510 ; GFX10-CU-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12511 ; GFX10-CU: ; %bb.0: ; %entry
12512 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12513 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
12514 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12515 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
12516 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
12517 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12518 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12519 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12520 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12521 ; GFX10-CU-NEXT: buffer_gl0_inv
12522 ; GFX10-CU-NEXT: buffer_gl1_inv
12523 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
12524 ; GFX10-CU-NEXT: s_endpgm
12526 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12527 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12528 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12529 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
12530 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12531 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12532 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12533 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
12534 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
12535 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
12536 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12537 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12538 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12539 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
12540 ; SKIP-CACHE-INV-NEXT: s_endpgm
12542 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12543 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12544 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12545 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12546 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12547 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12548 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12549 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12550 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12551 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12552 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12553 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12554 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12555 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12557 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12558 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12559 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12560 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12561 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12562 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12563 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12564 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12565 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12566 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12567 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12568 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12569 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12570 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12572 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12573 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12574 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12575 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12576 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12577 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12578 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12579 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12580 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12581 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12582 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12583 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12584 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12586 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12587 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12588 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12589 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12590 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12591 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12592 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12593 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12594 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12595 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12596 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12597 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12598 ; GFX940-TGSPLIT-NEXT: s_endpgm
12600 ; GFX11-WGP-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12601 ; GFX11-WGP: ; %bb.0: ; %entry
12602 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12603 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
12604 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12605 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12606 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12607 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12608 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12609 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12610 ; GFX11-WGP-NEXT: buffer_gl0_inv
12611 ; GFX11-WGP-NEXT: buffer_gl1_inv
12612 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
12613 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12614 ; GFX11-WGP-NEXT: s_endpgm
12616 ; GFX11-CU-LABEL: global_system_one_as_release_acquire_ret_cmpxchg:
12617 ; GFX11-CU: ; %bb.0: ; %entry
12618 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12619 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
12620 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12621 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12622 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12623 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12624 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12625 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12626 ; GFX11-CU-NEXT: buffer_gl0_inv
12627 ; GFX11-CU-NEXT: buffer_gl1_inv
12628 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
12629 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12630 ; GFX11-CU-NEXT: s_endpgm
12631 i32 addrspace(1)* %out, i32 %in, i32 %old) {
12633 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
12634 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") release acquire
12635 %val0 = extractvalue { i32, i1 } %val, 0
12636 store i32 %val0, i32 addrspace(1)* %out, align 4
12640 define amdgpu_kernel void @global_system_one_as_acq_rel_acquire_ret_cmpxchg(
12641 ; GFX6-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12642 ; GFX6: ; %bb.0: ; %entry
12643 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12644 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
12645 ; GFX6-NEXT: s_mov_b32 s6, -1
12646 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12647 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
12648 ; GFX6-NEXT: s_mov_b32 s4, s0
12649 ; GFX6-NEXT: s_mov_b32 s5, s1
12650 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
12651 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12652 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12653 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12654 ; GFX6-NEXT: buffer_wbinvl1
12655 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
12656 ; GFX6-NEXT: s_endpgm
12658 ; GFX7-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12659 ; GFX7: ; %bb.0: ; %entry
12660 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12661 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12662 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12663 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12664 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12665 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12666 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12667 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12668 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12669 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12670 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12671 ; GFX7-NEXT: buffer_wbinvl1_vol
12672 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12673 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12674 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12675 ; GFX7-NEXT: s_endpgm
12677 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12678 ; GFX10-WGP: ; %bb.0: ; %entry
12679 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12680 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
12681 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12682 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
12683 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
12684 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12685 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12686 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12687 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12688 ; GFX10-WGP-NEXT: buffer_gl0_inv
12689 ; GFX10-WGP-NEXT: buffer_gl1_inv
12690 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
12691 ; GFX10-WGP-NEXT: s_endpgm
12693 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12694 ; GFX10-CU: ; %bb.0: ; %entry
12695 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12696 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
12697 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12698 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
12699 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
12700 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12701 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12702 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12703 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12704 ; GFX10-CU-NEXT: buffer_gl0_inv
12705 ; GFX10-CU-NEXT: buffer_gl1_inv
12706 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
12707 ; GFX10-CU-NEXT: s_endpgm
12709 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12710 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12711 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12712 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
12713 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12714 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12715 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12716 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
12717 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
12718 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
12719 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12720 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12721 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12722 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
12723 ; SKIP-CACHE-INV-NEXT: s_endpgm
12725 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12726 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12727 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12728 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12729 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12730 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12731 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12732 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12733 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12734 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12735 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12736 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12737 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12738 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12740 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12741 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12742 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12743 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12744 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12745 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12746 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12747 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12748 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12749 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12750 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12751 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12752 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12753 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12755 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12756 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12757 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12758 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12759 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12760 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12761 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12762 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12763 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12764 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12765 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12766 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12767 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12769 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12770 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12771 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12772 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12773 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12774 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12775 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12776 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12777 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12778 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12779 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12780 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12781 ; GFX940-TGSPLIT-NEXT: s_endpgm
12783 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12784 ; GFX11-WGP: ; %bb.0: ; %entry
12785 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12786 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
12787 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12788 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12789 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12790 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12791 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12792 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12793 ; GFX11-WGP-NEXT: buffer_gl0_inv
12794 ; GFX11-WGP-NEXT: buffer_gl1_inv
12795 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
12796 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12797 ; GFX11-WGP-NEXT: s_endpgm
12799 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_acquire_ret_cmpxchg:
12800 ; GFX11-CU: ; %bb.0: ; %entry
12801 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12802 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
12803 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12804 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12805 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12806 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12807 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12808 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12809 ; GFX11-CU-NEXT: buffer_gl0_inv
12810 ; GFX11-CU-NEXT: buffer_gl1_inv
12811 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
12812 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12813 ; GFX11-CU-NEXT: s_endpgm
12814 i32 addrspace(1)* %out, i32 %in, i32 %old) {
12816 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
12817 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel acquire
12818 %val0 = extractvalue { i32, i1 } %val, 0
12819 store i32 %val0, i32 addrspace(1)* %out, align 4
12823 define amdgpu_kernel void @global_system_one_as_seq_cst_acquire_ret_cmpxchg(
12824 ; GFX6-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12825 ; GFX6: ; %bb.0: ; %entry
12826 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12827 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
12828 ; GFX6-NEXT: s_mov_b32 s6, -1
12829 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12830 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
12831 ; GFX6-NEXT: s_mov_b32 s4, s0
12832 ; GFX6-NEXT: s_mov_b32 s5, s1
12833 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
12834 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12835 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12836 ; GFX6-NEXT: s_waitcnt vmcnt(0)
12837 ; GFX6-NEXT: buffer_wbinvl1
12838 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
12839 ; GFX6-NEXT: s_endpgm
12841 ; GFX7-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12842 ; GFX7: ; %bb.0: ; %entry
12843 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12844 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12845 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12846 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12847 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12848 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12849 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12850 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12851 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12852 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12853 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12854 ; GFX7-NEXT: buffer_wbinvl1_vol
12855 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12856 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12857 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12858 ; GFX7-NEXT: s_endpgm
12860 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12861 ; GFX10-WGP: ; %bb.0: ; %entry
12862 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12863 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
12864 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12865 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
12866 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
12867 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12868 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12869 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12870 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12871 ; GFX10-WGP-NEXT: buffer_gl0_inv
12872 ; GFX10-WGP-NEXT: buffer_gl1_inv
12873 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
12874 ; GFX10-WGP-NEXT: s_endpgm
12876 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12877 ; GFX10-CU: ; %bb.0: ; %entry
12878 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12879 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
12880 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12881 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
12882 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
12883 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12884 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12885 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12886 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12887 ; GFX10-CU-NEXT: buffer_gl0_inv
12888 ; GFX10-CU-NEXT: buffer_gl1_inv
12889 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
12890 ; GFX10-CU-NEXT: s_endpgm
12892 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12893 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12894 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12895 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
12896 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
12897 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12898 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12899 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
12900 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
12901 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
12902 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12903 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
12904 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12905 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
12906 ; SKIP-CACHE-INV-NEXT: s_endpgm
12908 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12909 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12910 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12911 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12912 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12913 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12914 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12915 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12916 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12917 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12918 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12919 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12920 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12921 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12923 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12924 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12925 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12926 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12927 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12928 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
12929 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12930 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12931 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
12932 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12933 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12934 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12935 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12936 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12938 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12939 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12940 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12941 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12942 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12943 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12944 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12945 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12946 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12947 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12948 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12949 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12950 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12952 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12953 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12954 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12955 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
12956 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12957 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
12958 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12959 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12960 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
12961 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12962 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12963 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
12964 ; GFX940-TGSPLIT-NEXT: s_endpgm
12966 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12967 ; GFX11-WGP: ; %bb.0: ; %entry
12968 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12969 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
12970 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12971 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12972 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12973 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12974 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12975 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12976 ; GFX11-WGP-NEXT: buffer_gl0_inv
12977 ; GFX11-WGP-NEXT: buffer_gl1_inv
12978 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
12979 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12980 ; GFX11-WGP-NEXT: s_endpgm
12982 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_acquire_ret_cmpxchg:
12983 ; GFX11-CU: ; %bb.0: ; %entry
12984 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12985 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
12986 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12987 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
12988 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12989 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12990 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
12991 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12992 ; GFX11-CU-NEXT: buffer_gl0_inv
12993 ; GFX11-CU-NEXT: buffer_gl1_inv
12994 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
12995 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12996 ; GFX11-CU-NEXT: s_endpgm
12997 i32 addrspace(1)* %out, i32 %in, i32 %old) {
12999 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
13000 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst acquire
13001 %val0 = extractvalue { i32, i1 } %val, 0
13002 store i32 %val0, i32 addrspace(1)* %out, align 4
13006 define amdgpu_kernel void @global_system_one_as_monotonic_seq_cst_ret_cmpxchg(
13007 ; GFX6-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13008 ; GFX6: ; %bb.0: ; %entry
13009 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13010 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
13011 ; GFX6-NEXT: s_mov_b32 s6, -1
13012 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13013 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
13014 ; GFX6-NEXT: s_mov_b32 s4, s0
13015 ; GFX6-NEXT: s_mov_b32 s5, s1
13016 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
13017 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13018 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13019 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13020 ; GFX6-NEXT: buffer_wbinvl1
13021 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
13022 ; GFX6-NEXT: s_endpgm
13024 ; GFX7-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13025 ; GFX7: ; %bb.0: ; %entry
13026 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13027 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13028 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13029 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13030 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13031 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13032 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13033 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13034 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13035 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13036 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13037 ; GFX7-NEXT: buffer_wbinvl1_vol
13038 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13039 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13040 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13041 ; GFX7-NEXT: s_endpgm
13043 ; GFX10-WGP-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13044 ; GFX10-WGP: ; %bb.0: ; %entry
13045 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13046 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
13047 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13048 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
13049 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
13050 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13051 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13052 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13053 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13054 ; GFX10-WGP-NEXT: buffer_gl0_inv
13055 ; GFX10-WGP-NEXT: buffer_gl1_inv
13056 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
13057 ; GFX10-WGP-NEXT: s_endpgm
13059 ; GFX10-CU-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13060 ; GFX10-CU: ; %bb.0: ; %entry
13061 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13062 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
13063 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13064 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
13065 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
13066 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13067 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13068 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13069 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13070 ; GFX10-CU-NEXT: buffer_gl0_inv
13071 ; GFX10-CU-NEXT: buffer_gl1_inv
13072 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
13073 ; GFX10-CU-NEXT: s_endpgm
13075 ; SKIP-CACHE-INV-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13076 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13077 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13078 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
13079 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
13080 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13081 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
13082 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
13083 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
13084 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
13085 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13086 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13087 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13088 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
13089 ; SKIP-CACHE-INV-NEXT: s_endpgm
13091 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13092 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13093 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13094 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13095 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13096 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13097 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13098 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13099 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13100 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13101 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13102 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13103 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13104 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13106 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13107 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13108 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13109 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13110 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13111 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13112 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13113 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13114 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13115 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13116 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13117 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13118 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13119 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13121 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13122 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13123 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13124 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13125 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13126 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13127 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13128 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13129 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13130 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13131 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13132 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13133 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13135 ; GFX940-TGSPLIT-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13136 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13137 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13138 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13139 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13140 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13141 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13142 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13143 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13144 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13145 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13146 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13147 ; GFX940-TGSPLIT-NEXT: s_endpgm
13149 ; GFX11-WGP-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13150 ; GFX11-WGP: ; %bb.0: ; %entry
13151 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13152 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
13153 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13154 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13155 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13156 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13157 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13158 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13159 ; GFX11-WGP-NEXT: buffer_gl0_inv
13160 ; GFX11-WGP-NEXT: buffer_gl1_inv
13161 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
13162 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13163 ; GFX11-WGP-NEXT: s_endpgm
13165 ; GFX11-CU-LABEL: global_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13166 ; GFX11-CU: ; %bb.0: ; %entry
13167 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13168 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
13169 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13170 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13171 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13172 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13173 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13174 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13175 ; GFX11-CU-NEXT: buffer_gl0_inv
13176 ; GFX11-CU-NEXT: buffer_gl1_inv
13177 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
13178 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13179 ; GFX11-CU-NEXT: s_endpgm
13180 i32 addrspace(1)* %out, i32 %in, i32 %old) {
13182 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
13183 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") monotonic seq_cst
13184 %val0 = extractvalue { i32, i1 } %val, 0
13185 store i32 %val0, i32 addrspace(1)* %out, align 4
13189 define amdgpu_kernel void @global_system_one_as_acquire_seq_cst_ret_cmpxchg(
13190 ; GFX6-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13191 ; GFX6: ; %bb.0: ; %entry
13192 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13193 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
13194 ; GFX6-NEXT: s_mov_b32 s6, -1
13195 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13196 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
13197 ; GFX6-NEXT: s_mov_b32 s4, s0
13198 ; GFX6-NEXT: s_mov_b32 s5, s1
13199 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
13200 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13201 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13202 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13203 ; GFX6-NEXT: buffer_wbinvl1
13204 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
13205 ; GFX6-NEXT: s_endpgm
13207 ; GFX7-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13208 ; GFX7: ; %bb.0: ; %entry
13209 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13210 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13211 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13212 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13213 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13214 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13215 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13216 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13217 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13218 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13219 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13220 ; GFX7-NEXT: buffer_wbinvl1_vol
13221 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13222 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13223 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13224 ; GFX7-NEXT: s_endpgm
13226 ; GFX10-WGP-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13227 ; GFX10-WGP: ; %bb.0: ; %entry
13228 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13229 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
13230 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13231 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
13232 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
13233 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13234 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13235 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13236 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13237 ; GFX10-WGP-NEXT: buffer_gl0_inv
13238 ; GFX10-WGP-NEXT: buffer_gl1_inv
13239 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
13240 ; GFX10-WGP-NEXT: s_endpgm
13242 ; GFX10-CU-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13243 ; GFX10-CU: ; %bb.0: ; %entry
13244 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13245 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
13246 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13247 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
13248 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
13249 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13250 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13251 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13252 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13253 ; GFX10-CU-NEXT: buffer_gl0_inv
13254 ; GFX10-CU-NEXT: buffer_gl1_inv
13255 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
13256 ; GFX10-CU-NEXT: s_endpgm
13258 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13259 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13260 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13261 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
13262 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
13263 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13264 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
13265 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
13266 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
13267 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
13268 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13269 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13270 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13271 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
13272 ; SKIP-CACHE-INV-NEXT: s_endpgm
13274 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13275 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13276 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13277 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13278 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13279 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13280 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13281 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13282 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13283 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13284 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13285 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13286 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13287 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13289 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13290 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13291 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13292 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13293 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13294 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13295 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13296 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13297 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13298 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13299 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13300 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13301 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13302 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13304 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13305 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13306 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13307 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13308 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13309 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13310 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13311 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13312 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13313 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13314 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13315 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13316 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13318 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13319 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13320 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13321 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13322 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13323 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13324 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13325 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13326 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13327 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13328 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13329 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13330 ; GFX940-TGSPLIT-NEXT: s_endpgm
13332 ; GFX11-WGP-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13333 ; GFX11-WGP: ; %bb.0: ; %entry
13334 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13335 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
13336 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13337 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13338 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13339 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13340 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13341 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13342 ; GFX11-WGP-NEXT: buffer_gl0_inv
13343 ; GFX11-WGP-NEXT: buffer_gl1_inv
13344 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
13345 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13346 ; GFX11-WGP-NEXT: s_endpgm
13348 ; GFX11-CU-LABEL: global_system_one_as_acquire_seq_cst_ret_cmpxchg:
13349 ; GFX11-CU: ; %bb.0: ; %entry
13350 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13351 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
13352 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13353 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13354 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13355 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13356 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13357 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13358 ; GFX11-CU-NEXT: buffer_gl0_inv
13359 ; GFX11-CU-NEXT: buffer_gl1_inv
13360 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
13361 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13362 ; GFX11-CU-NEXT: s_endpgm
13363 i32 addrspace(1)* %out, i32 %in, i32 %old) {
13365 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
13366 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acquire seq_cst
13367 %val0 = extractvalue { i32, i1 } %val, 0
13368 store i32 %val0, i32 addrspace(1)* %out, align 4
13372 define amdgpu_kernel void @global_system_one_as_release_seq_cst_ret_cmpxchg(
13373 ; GFX6-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13374 ; GFX6: ; %bb.0: ; %entry
13375 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13376 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
13377 ; GFX6-NEXT: s_mov_b32 s6, -1
13378 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13379 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
13380 ; GFX6-NEXT: s_mov_b32 s4, s0
13381 ; GFX6-NEXT: s_mov_b32 s5, s1
13382 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
13383 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13384 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13385 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13386 ; GFX6-NEXT: buffer_wbinvl1
13387 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
13388 ; GFX6-NEXT: s_endpgm
13390 ; GFX7-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13391 ; GFX7: ; %bb.0: ; %entry
13392 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13393 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13394 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13395 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13396 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13397 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13398 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13399 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13400 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13401 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13402 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13403 ; GFX7-NEXT: buffer_wbinvl1_vol
13404 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13405 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13406 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13407 ; GFX7-NEXT: s_endpgm
13409 ; GFX10-WGP-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13410 ; GFX10-WGP: ; %bb.0: ; %entry
13411 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13412 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
13413 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13414 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
13415 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
13416 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13417 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13418 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13419 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13420 ; GFX10-WGP-NEXT: buffer_gl0_inv
13421 ; GFX10-WGP-NEXT: buffer_gl1_inv
13422 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
13423 ; GFX10-WGP-NEXT: s_endpgm
13425 ; GFX10-CU-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13426 ; GFX10-CU: ; %bb.0: ; %entry
13427 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13428 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
13429 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13430 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
13431 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
13432 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13433 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13434 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13435 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13436 ; GFX10-CU-NEXT: buffer_gl0_inv
13437 ; GFX10-CU-NEXT: buffer_gl1_inv
13438 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
13439 ; GFX10-CU-NEXT: s_endpgm
13441 ; SKIP-CACHE-INV-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13442 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13443 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13444 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
13445 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
13446 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13447 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
13448 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
13449 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
13450 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
13451 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13452 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13453 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13454 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
13455 ; SKIP-CACHE-INV-NEXT: s_endpgm
13457 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13458 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13459 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13460 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13461 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13462 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13463 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13464 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13465 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13466 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13467 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13468 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13469 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13470 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13472 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13473 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13474 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13475 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13476 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13477 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13478 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13479 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13480 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13481 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13482 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13483 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13484 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13485 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13487 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13488 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13489 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13490 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13491 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13492 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13493 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13494 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13495 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13496 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13497 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13498 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13499 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13501 ; GFX940-TGSPLIT-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13502 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13503 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13504 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13505 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13506 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13507 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13508 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13509 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13510 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13511 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13512 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13513 ; GFX940-TGSPLIT-NEXT: s_endpgm
13515 ; GFX11-WGP-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13516 ; GFX11-WGP: ; %bb.0: ; %entry
13517 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13518 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
13519 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13520 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13521 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13522 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13523 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13524 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13525 ; GFX11-WGP-NEXT: buffer_gl0_inv
13526 ; GFX11-WGP-NEXT: buffer_gl1_inv
13527 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
13528 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13529 ; GFX11-WGP-NEXT: s_endpgm
13531 ; GFX11-CU-LABEL: global_system_one_as_release_seq_cst_ret_cmpxchg:
13532 ; GFX11-CU: ; %bb.0: ; %entry
13533 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13534 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
13535 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13536 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13537 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13538 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13539 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13540 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13541 ; GFX11-CU-NEXT: buffer_gl0_inv
13542 ; GFX11-CU-NEXT: buffer_gl1_inv
13543 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
13544 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13545 ; GFX11-CU-NEXT: s_endpgm
13546 i32 addrspace(1)* %out, i32 %in, i32 %old) {
13548 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
13549 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") release seq_cst
13550 %val0 = extractvalue { i32, i1 } %val, 0
13551 store i32 %val0, i32 addrspace(1)* %out, align 4
13555 define amdgpu_kernel void @global_system_one_as_acq_rel_seq_cst_ret_cmpxchg(
13556 ; GFX6-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13557 ; GFX6: ; %bb.0: ; %entry
13558 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13559 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
13560 ; GFX6-NEXT: s_mov_b32 s6, -1
13561 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13562 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
13563 ; GFX6-NEXT: s_mov_b32 s4, s0
13564 ; GFX6-NEXT: s_mov_b32 s5, s1
13565 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
13566 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13567 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13568 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13569 ; GFX6-NEXT: buffer_wbinvl1
13570 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
13571 ; GFX6-NEXT: s_endpgm
13573 ; GFX7-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13574 ; GFX7: ; %bb.0: ; %entry
13575 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13576 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13577 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13578 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13579 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13580 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13581 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13582 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13583 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13584 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13585 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13586 ; GFX7-NEXT: buffer_wbinvl1_vol
13587 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13588 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13589 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13590 ; GFX7-NEXT: s_endpgm
13592 ; GFX10-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13593 ; GFX10-WGP: ; %bb.0: ; %entry
13594 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13595 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
13596 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13597 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
13598 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
13599 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13600 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13601 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13602 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13603 ; GFX10-WGP-NEXT: buffer_gl0_inv
13604 ; GFX10-WGP-NEXT: buffer_gl1_inv
13605 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
13606 ; GFX10-WGP-NEXT: s_endpgm
13608 ; GFX10-CU-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13609 ; GFX10-CU: ; %bb.0: ; %entry
13610 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13611 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
13612 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13613 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
13614 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
13615 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13616 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13617 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13618 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13619 ; GFX10-CU-NEXT: buffer_gl0_inv
13620 ; GFX10-CU-NEXT: buffer_gl1_inv
13621 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
13622 ; GFX10-CU-NEXT: s_endpgm
13624 ; SKIP-CACHE-INV-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13625 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13626 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13627 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
13628 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
13629 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13630 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
13631 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
13632 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
13633 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
13634 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13635 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13636 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13637 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
13638 ; SKIP-CACHE-INV-NEXT: s_endpgm
13640 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13641 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13642 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13643 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13644 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13645 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13646 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13647 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13648 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13649 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13650 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13651 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13652 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13653 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13655 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13656 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13657 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13658 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13659 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13660 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13661 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13662 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13663 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13664 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13665 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13666 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13667 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13668 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13670 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13671 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13672 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13673 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13674 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13675 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13676 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13677 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13678 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13679 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13680 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13681 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13682 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13684 ; GFX940-TGSPLIT-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13685 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13686 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13687 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13688 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13689 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13690 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13691 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13692 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13693 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13694 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13695 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13696 ; GFX940-TGSPLIT-NEXT: s_endpgm
13698 ; GFX11-WGP-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13699 ; GFX11-WGP: ; %bb.0: ; %entry
13700 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13701 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
13702 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13703 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13704 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13705 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13706 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13707 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13708 ; GFX11-WGP-NEXT: buffer_gl0_inv
13709 ; GFX11-WGP-NEXT: buffer_gl1_inv
13710 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
13711 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13712 ; GFX11-WGP-NEXT: s_endpgm
13714 ; GFX11-CU-LABEL: global_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13715 ; GFX11-CU: ; %bb.0: ; %entry
13716 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13717 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
13718 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13719 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13720 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13721 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13722 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13723 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13724 ; GFX11-CU-NEXT: buffer_gl0_inv
13725 ; GFX11-CU-NEXT: buffer_gl1_inv
13726 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
13727 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13728 ; GFX11-CU-NEXT: s_endpgm
13729 i32 addrspace(1)* %out, i32 %in, i32 %old) {
13731 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
13732 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel seq_cst
13733 %val0 = extractvalue { i32, i1 } %val, 0
13734 store i32 %val0, i32 addrspace(1)* %out, align 4
13738 define amdgpu_kernel void @global_system_one_as_seq_cst_seq_cst_ret_cmpxchg(
13739 ; GFX6-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13740 ; GFX6: ; %bb.0: ; %entry
13741 ; GFX6-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13742 ; GFX6-NEXT: s_mov_b32 s7, 0x100f000
13743 ; GFX6-NEXT: s_mov_b32 s6, -1
13744 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13745 ; GFX6-NEXT: v_mov_b32_e32 v0, s2
13746 ; GFX6-NEXT: s_mov_b32 s4, s0
13747 ; GFX6-NEXT: s_mov_b32 s5, s1
13748 ; GFX6-NEXT: v_mov_b32_e32 v1, s3
13749 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13750 ; GFX6-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13751 ; GFX6-NEXT: s_waitcnt vmcnt(0)
13752 ; GFX6-NEXT: buffer_wbinvl1
13753 ; GFX6-NEXT: buffer_store_dword v0, off, s[4:7], 0
13754 ; GFX6-NEXT: s_endpgm
13756 ; GFX7-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13757 ; GFX7: ; %bb.0: ; %entry
13758 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13759 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13760 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13761 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13762 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13763 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13764 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13765 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13766 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13767 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13768 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13769 ; GFX7-NEXT: buffer_wbinvl1_vol
13770 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13771 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13772 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13773 ; GFX7-NEXT: s_endpgm
13775 ; GFX10-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13776 ; GFX10-WGP: ; %bb.0: ; %entry
13777 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13778 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, 0
13779 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13780 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
13781 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
13782 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13783 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13784 ; GFX10-WGP-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13785 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13786 ; GFX10-WGP-NEXT: buffer_gl0_inv
13787 ; GFX10-WGP-NEXT: buffer_gl1_inv
13788 ; GFX10-WGP-NEXT: global_store_dword v2, v0, s[0:1]
13789 ; GFX10-WGP-NEXT: s_endpgm
13791 ; GFX10-CU-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13792 ; GFX10-CU: ; %bb.0: ; %entry
13793 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13794 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, 0
13795 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13796 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
13797 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
13798 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13799 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13800 ; GFX10-CU-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13801 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13802 ; GFX10-CU-NEXT: buffer_gl0_inv
13803 ; GFX10-CU-NEXT: buffer_gl1_inv
13804 ; GFX10-CU-NEXT: global_store_dword v2, v0, s[0:1]
13805 ; GFX10-CU-NEXT: s_endpgm
13807 ; SKIP-CACHE-INV-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13808 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13809 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13810 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s7, 0xf000
13811 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s6, -1
13812 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13813 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
13814 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s4, s0
13815 ; SKIP-CACHE-INV-NEXT: s_mov_b32 s5, s1
13816 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
13817 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13818 ; SKIP-CACHE-INV-NEXT: buffer_atomic_cmpswap v[0:1], off, s[4:7], 0 offset:16 glc
13819 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13820 ; SKIP-CACHE-INV-NEXT: buffer_store_dword v0, off, s[4:7], 0
13821 ; SKIP-CACHE-INV-NEXT: s_endpgm
13823 ; GFX90A-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13824 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13825 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13826 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13827 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13828 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13829 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13830 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13831 ; GFX90A-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13832 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13833 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13834 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13835 ; GFX90A-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13836 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13838 ; GFX90A-TGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13839 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13840 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13841 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13842 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13843 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[2:3], s[2:3] op_sel:[0,1]
13844 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13845 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13846 ; GFX90A-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 glc
13847 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13848 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13849 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13850 ; GFX90A-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13851 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13853 ; GFX940-NOTTGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13854 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13855 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13856 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13857 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13858 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13859 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13860 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13861 ; GFX940-NOTTGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13862 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13863 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13864 ; GFX940-NOTTGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13865 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13867 ; GFX940-TGSPLIT-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13868 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13869 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13870 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, 0
13871 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13872 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
13873 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13874 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13875 ; GFX940-TGSPLIT-NEXT: global_atomic_cmpswap v0, v2, v[0:1], s[0:1] offset:16 sc0 sc1
13876 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13877 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13878 ; GFX940-TGSPLIT-NEXT: global_store_dword v2, v0, s[0:1]
13879 ; GFX940-TGSPLIT-NEXT: s_endpgm
13881 ; GFX11-WGP-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13882 ; GFX11-WGP: ; %bb.0: ; %entry
13883 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13884 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, 0
13885 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13886 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13887 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13888 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13889 ; GFX11-WGP-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13890 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13891 ; GFX11-WGP-NEXT: buffer_gl0_inv
13892 ; GFX11-WGP-NEXT: buffer_gl1_inv
13893 ; GFX11-WGP-NEXT: global_store_b32 v2, v0, s[0:1]
13894 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13895 ; GFX11-WGP-NEXT: s_endpgm
13897 ; GFX11-CU-LABEL: global_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
13898 ; GFX11-CU: ; %bb.0: ; %entry
13899 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13900 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, 0
13901 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13902 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
13903 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13904 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13905 ; GFX11-CU-NEXT: global_atomic_cmpswap_b32 v0, v2, v[0:1], s[0:1] offset:16 glc
13906 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13907 ; GFX11-CU-NEXT: buffer_gl0_inv
13908 ; GFX11-CU-NEXT: buffer_gl1_inv
13909 ; GFX11-CU-NEXT: global_store_b32 v2, v0, s[0:1]
13910 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13911 ; GFX11-CU-NEXT: s_endpgm
13912 i32 addrspace(1)* %out, i32 %in, i32 %old) {
13914 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4
13915 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst seq_cst
13916 %val0 = extractvalue { i32, i1 } %val, 0
13917 store i32 %val0, i32 addrspace(1)* %out, align 4