1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx700 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX7 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-WGP %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -mattr=+cumode -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX10-CU %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx700 -amdgcn-skip-cache-invalidations -verify-machineinstrs < %s | FileCheck --check-prefixes=SKIP-CACHE-INV %s
6 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX90A-NOTTGSPLIT %s
7 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -mattr=+tgsplit -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX90A-TGSPLIT %s
8 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX940-NOTTGSPLIT %s
9 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 -mattr=+tgsplit -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX940-TGSPLIT %s
10 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11-WGP %s
11 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=+cumode -verify-machineinstrs < %s | FileCheck --check-prefixes=GFX11-CU %s
13 define amdgpu_kernel void @flat_system_unordered_load(
14 ; GFX7-LABEL: flat_system_unordered_load:
15 ; GFX7: ; %bb.0: ; %entry
16 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
17 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
18 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
19 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
20 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
21 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
22 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
23 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
24 ; GFX7-NEXT: flat_store_dword v[0:1], v2
27 ; GFX10-WGP-LABEL: flat_system_unordered_load:
28 ; GFX10-WGP: ; %bb.0: ; %entry
29 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
30 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
31 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
32 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
33 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1]
34 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
35 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
36 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
37 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
38 ; GFX10-WGP-NEXT: s_endpgm
40 ; GFX10-CU-LABEL: flat_system_unordered_load:
41 ; GFX10-CU: ; %bb.0: ; %entry
42 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
43 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
44 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
45 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
46 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1]
47 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
48 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
49 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
50 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
51 ; GFX10-CU-NEXT: s_endpgm
53 ; SKIP-CACHE-INV-LABEL: flat_system_unordered_load:
54 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
55 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
56 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
57 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
58 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
59 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1]
60 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
61 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
62 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
63 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
64 ; SKIP-CACHE-INV-NEXT: s_endpgm
66 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_unordered_load:
67 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
68 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
69 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
70 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
71 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
72 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1]
73 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
74 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
75 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
76 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
77 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
79 ; GFX90A-TGSPLIT-LABEL: flat_system_unordered_load:
80 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
81 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
82 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
83 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
84 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
85 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1]
86 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
87 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
88 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
89 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
90 ; GFX90A-TGSPLIT-NEXT: s_endpgm
92 ; GFX940-NOTTGSPLIT-LABEL: flat_system_unordered_load:
93 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
94 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
95 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
96 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
97 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
98 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1]
99 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
100 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
101 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
102 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
103 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
105 ; GFX940-TGSPLIT-LABEL: flat_system_unordered_load:
106 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
107 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
108 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
109 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
110 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
111 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1]
112 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
113 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
114 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
115 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
116 ; GFX940-TGSPLIT-NEXT: s_endpgm
118 ; GFX11-WGP-LABEL: flat_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: s_waitcnt lgkmcnt(0)
122 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
123 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1]
124 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
125 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
126 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
127 ; GFX11-WGP-NEXT: s_endpgm
129 ; GFX11-CU-LABEL: flat_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: s_waitcnt lgkmcnt(0)
133 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
134 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1]
135 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
136 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
137 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
138 ; GFX11-CU-NEXT: s_endpgm
141 %val = load atomic i32, ptr %in unordered, align 4
142 store i32 %val, ptr %out
146 define amdgpu_kernel void @flat_system_monotonic_load(
147 ; GFX7-LABEL: flat_system_monotonic_load:
148 ; GFX7: ; %bb.0: ; %entry
149 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
150 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
151 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
152 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
153 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
154 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
155 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
156 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
157 ; GFX7-NEXT: flat_store_dword v[0:1], v2
158 ; GFX7-NEXT: s_endpgm
160 ; GFX10-WGP-LABEL: flat_system_monotonic_load:
161 ; GFX10-WGP: ; %bb.0: ; %entry
162 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
163 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
164 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
165 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
166 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
167 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
168 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
169 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
170 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
171 ; GFX10-WGP-NEXT: s_endpgm
173 ; GFX10-CU-LABEL: flat_system_monotonic_load:
174 ; GFX10-CU: ; %bb.0: ; %entry
175 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
176 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
177 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
178 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
179 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
180 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
181 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
182 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
183 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
184 ; GFX10-CU-NEXT: s_endpgm
186 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_load:
187 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
188 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
189 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
190 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
191 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
192 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
193 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
194 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
195 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
196 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
197 ; SKIP-CACHE-INV-NEXT: s_endpgm
199 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_load:
200 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
201 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
202 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
203 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
204 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
205 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
206 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
207 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
208 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
209 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
210 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
212 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_load:
213 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
214 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
215 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
216 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
217 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
218 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
219 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
220 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
221 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
222 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
223 ; GFX90A-TGSPLIT-NEXT: s_endpgm
225 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_load:
226 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
227 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
228 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
229 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
230 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
231 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
232 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
233 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
234 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
235 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
236 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
238 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_load:
239 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
240 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
241 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
242 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
243 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
244 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
245 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
246 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
247 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
248 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
249 ; GFX940-TGSPLIT-NEXT: s_endpgm
251 ; GFX11-WGP-LABEL: flat_system_monotonic_load:
252 ; GFX11-WGP: ; %bb.0: ; %entry
253 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
254 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
255 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
256 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
257 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
258 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
259 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
260 ; GFX11-WGP-NEXT: s_endpgm
262 ; GFX11-CU-LABEL: flat_system_monotonic_load:
263 ; GFX11-CU: ; %bb.0: ; %entry
264 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
265 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
266 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
267 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
268 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
269 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
270 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
271 ; GFX11-CU-NEXT: s_endpgm
274 %val = load atomic i32, ptr %in monotonic, align 4
275 store i32 %val, ptr %out
279 define amdgpu_kernel void @flat_system_acquire_load(
280 ; GFX7-LABEL: flat_system_acquire_load:
281 ; GFX7: ; %bb.0: ; %entry
282 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
283 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
284 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
285 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
286 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
287 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
288 ; GFX7-NEXT: buffer_wbinvl1_vol
289 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
290 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
291 ; GFX7-NEXT: flat_store_dword v[0:1], v2
292 ; GFX7-NEXT: s_endpgm
294 ; GFX10-WGP-LABEL: flat_system_acquire_load:
295 ; GFX10-WGP: ; %bb.0: ; %entry
296 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
297 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
298 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
299 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
300 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
301 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
302 ; GFX10-WGP-NEXT: buffer_gl0_inv
303 ; GFX10-WGP-NEXT: buffer_gl1_inv
304 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
305 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
306 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
307 ; GFX10-WGP-NEXT: s_endpgm
309 ; GFX10-CU-LABEL: flat_system_acquire_load:
310 ; GFX10-CU: ; %bb.0: ; %entry
311 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
312 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
313 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
314 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
315 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
316 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
317 ; GFX10-CU-NEXT: buffer_gl0_inv
318 ; GFX10-CU-NEXT: buffer_gl1_inv
319 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
320 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
321 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
322 ; GFX10-CU-NEXT: s_endpgm
324 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_load:
325 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
326 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
327 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
328 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
329 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
330 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
331 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
332 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
333 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
334 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
335 ; SKIP-CACHE-INV-NEXT: s_endpgm
337 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_load:
338 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
339 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
340 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
341 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
342 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
343 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
344 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
345 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
346 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
347 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
348 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
349 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
350 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
352 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_load:
353 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
354 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
355 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
356 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
357 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
358 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
359 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
360 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
361 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
362 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
363 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
364 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
365 ; GFX90A-TGSPLIT-NEXT: s_endpgm
367 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_load:
368 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
369 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
370 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
371 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
372 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
373 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
374 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
375 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
376 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
377 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
378 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
379 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
381 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_load:
382 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
383 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
384 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
385 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
386 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
387 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
388 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
389 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
390 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
391 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
392 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
393 ; GFX940-TGSPLIT-NEXT: s_endpgm
395 ; GFX11-WGP-LABEL: flat_system_acquire_load:
396 ; GFX11-WGP: ; %bb.0: ; %entry
397 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
398 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
399 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
400 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
401 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
402 ; GFX11-WGP-NEXT: buffer_gl0_inv
403 ; GFX11-WGP-NEXT: buffer_gl1_inv
404 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
405 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
406 ; GFX11-WGP-NEXT: s_endpgm
408 ; GFX11-CU-LABEL: flat_system_acquire_load:
409 ; GFX11-CU: ; %bb.0: ; %entry
410 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
411 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
412 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
413 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
414 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
415 ; GFX11-CU-NEXT: buffer_gl0_inv
416 ; GFX11-CU-NEXT: buffer_gl1_inv
417 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
418 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
419 ; GFX11-CU-NEXT: s_endpgm
422 %val = load atomic i32, ptr %in acquire, align 4
423 store i32 %val, ptr %out
427 define amdgpu_kernel void @flat_system_seq_cst_load(
428 ; GFX7-LABEL: flat_system_seq_cst_load:
429 ; GFX7: ; %bb.0: ; %entry
430 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
431 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
432 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
433 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
434 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
435 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
436 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
437 ; GFX7-NEXT: buffer_wbinvl1_vol
438 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
439 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
440 ; GFX7-NEXT: flat_store_dword v[0:1], v2
441 ; GFX7-NEXT: s_endpgm
443 ; GFX10-WGP-LABEL: flat_system_seq_cst_load:
444 ; GFX10-WGP: ; %bb.0: ; %entry
445 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
446 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
447 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
448 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
449 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
450 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
451 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
452 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
453 ; GFX10-WGP-NEXT: buffer_gl0_inv
454 ; GFX10-WGP-NEXT: buffer_gl1_inv
455 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
456 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
457 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
458 ; GFX10-WGP-NEXT: s_endpgm
460 ; GFX10-CU-LABEL: flat_system_seq_cst_load:
461 ; GFX10-CU: ; %bb.0: ; %entry
462 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
463 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
464 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
465 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
466 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
467 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
468 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
469 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
470 ; GFX10-CU-NEXT: buffer_gl0_inv
471 ; GFX10-CU-NEXT: buffer_gl1_inv
472 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
473 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
474 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
475 ; GFX10-CU-NEXT: s_endpgm
477 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_load:
478 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
479 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
480 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
481 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
482 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
483 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
484 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
485 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
486 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
487 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
488 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
489 ; SKIP-CACHE-INV-NEXT: s_endpgm
491 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_load:
492 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
493 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
494 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
495 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
496 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
497 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
498 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
499 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
500 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
501 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
502 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
503 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
504 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
505 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
507 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_load:
508 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
509 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
510 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
511 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
512 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
513 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
514 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
515 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
516 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
517 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
518 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
519 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
520 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
521 ; GFX90A-TGSPLIT-NEXT: s_endpgm
523 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_load:
524 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
525 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
526 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
527 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
528 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
529 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
530 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
531 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
532 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
533 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
534 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
535 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
536 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
538 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_load:
539 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
540 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
541 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
542 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
543 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
544 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
545 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
546 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
547 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
548 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
549 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
550 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
551 ; GFX940-TGSPLIT-NEXT: s_endpgm
553 ; GFX11-WGP-LABEL: flat_system_seq_cst_load:
554 ; GFX11-WGP: ; %bb.0: ; %entry
555 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
556 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
557 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
558 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
559 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
560 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
561 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
562 ; GFX11-WGP-NEXT: buffer_gl0_inv
563 ; GFX11-WGP-NEXT: buffer_gl1_inv
564 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
565 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
566 ; GFX11-WGP-NEXT: s_endpgm
568 ; GFX11-CU-LABEL: flat_system_seq_cst_load:
569 ; GFX11-CU: ; %bb.0: ; %entry
570 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
571 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
572 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
573 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
574 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
575 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
576 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
577 ; GFX11-CU-NEXT: buffer_gl0_inv
578 ; GFX11-CU-NEXT: buffer_gl1_inv
579 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
580 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
581 ; GFX11-CU-NEXT: s_endpgm
584 %val = load atomic i32, ptr %in seq_cst, align 4
585 store i32 %val, ptr %out
589 define amdgpu_kernel void @flat_system_unordered_store(
590 ; GFX7-LABEL: flat_system_unordered_store:
591 ; GFX7: ; %bb.0: ; %entry
592 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
593 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
594 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
595 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
596 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
597 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
598 ; GFX7-NEXT: flat_store_dword v[0:1], v2
599 ; GFX7-NEXT: s_endpgm
601 ; GFX10-WGP-LABEL: flat_system_unordered_store:
602 ; GFX10-WGP: ; %bb.0: ; %entry
603 ; GFX10-WGP-NEXT: s_clause 0x1
604 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
605 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
606 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
607 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
608 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
609 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
610 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
611 ; GFX10-WGP-NEXT: s_endpgm
613 ; GFX10-CU-LABEL: flat_system_unordered_store:
614 ; GFX10-CU: ; %bb.0: ; %entry
615 ; GFX10-CU-NEXT: s_clause 0x1
616 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
617 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
618 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
619 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
620 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
621 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
622 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
623 ; GFX10-CU-NEXT: s_endpgm
625 ; SKIP-CACHE-INV-LABEL: flat_system_unordered_store:
626 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
627 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
628 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
629 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
630 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
631 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
632 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
633 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
634 ; SKIP-CACHE-INV-NEXT: s_endpgm
636 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_unordered_store:
637 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
638 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
639 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
640 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
641 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
642 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
643 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
644 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
646 ; GFX90A-TGSPLIT-LABEL: flat_system_unordered_store:
647 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
648 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
649 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
650 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
651 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
652 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
653 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
654 ; GFX90A-TGSPLIT-NEXT: s_endpgm
656 ; GFX940-NOTTGSPLIT-LABEL: flat_system_unordered_store:
657 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
658 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
659 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
660 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
661 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
662 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
663 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
664 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
666 ; GFX940-TGSPLIT-LABEL: flat_system_unordered_store:
667 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
668 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
669 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
670 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
671 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
672 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
673 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
674 ; GFX940-TGSPLIT-NEXT: s_endpgm
676 ; GFX11-WGP-LABEL: flat_system_unordered_store:
677 ; GFX11-WGP: ; %bb.0: ; %entry
678 ; GFX11-WGP-NEXT: s_clause 0x1
679 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
680 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
681 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
682 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
683 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
684 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
685 ; GFX11-WGP-NEXT: s_endpgm
687 ; GFX11-CU-LABEL: flat_system_unordered_store:
688 ; GFX11-CU: ; %bb.0: ; %entry
689 ; GFX11-CU-NEXT: s_clause 0x1
690 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
691 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
692 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
693 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
694 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
695 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
696 ; GFX11-CU-NEXT: s_endpgm
699 store atomic i32 %in, ptr %out unordered, align 4
703 define amdgpu_kernel void @flat_system_monotonic_store(
704 ; GFX7-LABEL: flat_system_monotonic_store:
705 ; GFX7: ; %bb.0: ; %entry
706 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
707 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
708 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
709 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
710 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
711 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
712 ; GFX7-NEXT: flat_store_dword v[0:1], v2
713 ; GFX7-NEXT: s_endpgm
715 ; GFX10-WGP-LABEL: flat_system_monotonic_store:
716 ; GFX10-WGP: ; %bb.0: ; %entry
717 ; GFX10-WGP-NEXT: s_clause 0x1
718 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
719 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
720 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
721 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
722 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
723 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
724 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
725 ; GFX10-WGP-NEXT: s_endpgm
727 ; GFX10-CU-LABEL: flat_system_monotonic_store:
728 ; GFX10-CU: ; %bb.0: ; %entry
729 ; GFX10-CU-NEXT: s_clause 0x1
730 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
731 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
732 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
733 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
734 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
735 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
736 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
737 ; GFX10-CU-NEXT: s_endpgm
739 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_store:
740 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
741 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
742 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
743 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
744 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
745 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
746 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
747 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
748 ; SKIP-CACHE-INV-NEXT: s_endpgm
750 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_store:
751 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
752 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
753 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
754 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
755 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
756 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
757 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
758 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
760 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_store:
761 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
762 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
763 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
764 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
765 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
766 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
767 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
768 ; GFX90A-TGSPLIT-NEXT: s_endpgm
770 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_store:
771 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
772 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
773 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
774 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
775 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
776 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
777 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
778 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
780 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_store:
781 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
782 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
783 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
784 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
785 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
786 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
787 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
788 ; GFX940-TGSPLIT-NEXT: s_endpgm
790 ; GFX11-WGP-LABEL: flat_system_monotonic_store:
791 ; GFX11-WGP: ; %bb.0: ; %entry
792 ; GFX11-WGP-NEXT: s_clause 0x1
793 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
794 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
795 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
796 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
797 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
798 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
799 ; GFX11-WGP-NEXT: s_endpgm
801 ; GFX11-CU-LABEL: flat_system_monotonic_store:
802 ; GFX11-CU: ; %bb.0: ; %entry
803 ; GFX11-CU-NEXT: s_clause 0x1
804 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
805 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
806 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
807 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
808 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
809 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
810 ; GFX11-CU-NEXT: s_endpgm
813 store atomic i32 %in, ptr %out monotonic, align 4
817 define amdgpu_kernel void @flat_system_release_store(
818 ; GFX7-LABEL: flat_system_release_store:
819 ; GFX7: ; %bb.0: ; %entry
820 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
821 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
822 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
823 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
824 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
825 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
826 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
827 ; GFX7-NEXT: flat_store_dword v[0:1], v2
828 ; GFX7-NEXT: s_endpgm
830 ; GFX10-WGP-LABEL: flat_system_release_store:
831 ; GFX10-WGP: ; %bb.0: ; %entry
832 ; GFX10-WGP-NEXT: s_clause 0x1
833 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
834 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
835 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
836 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
837 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
838 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
839 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
840 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
841 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
842 ; GFX10-WGP-NEXT: s_endpgm
844 ; GFX10-CU-LABEL: flat_system_release_store:
845 ; GFX10-CU: ; %bb.0: ; %entry
846 ; GFX10-CU-NEXT: s_clause 0x1
847 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
848 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
849 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
850 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
851 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
852 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
853 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
854 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
855 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
856 ; GFX10-CU-NEXT: s_endpgm
858 ; SKIP-CACHE-INV-LABEL: flat_system_release_store:
859 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
860 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
861 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
862 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
863 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
864 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
865 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
866 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
867 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
868 ; SKIP-CACHE-INV-NEXT: s_endpgm
870 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_store:
871 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
872 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
873 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
874 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
875 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
876 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
877 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
878 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
879 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
880 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
882 ; GFX90A-TGSPLIT-LABEL: flat_system_release_store:
883 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
884 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
885 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
886 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
887 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
888 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
889 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
890 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
891 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
892 ; GFX90A-TGSPLIT-NEXT: s_endpgm
894 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_store:
895 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
896 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
897 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
898 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
899 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
900 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
901 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
902 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
903 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
904 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
906 ; GFX940-TGSPLIT-LABEL: flat_system_release_store:
907 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
908 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
909 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
910 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
911 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
912 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
913 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
914 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
915 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
916 ; GFX940-TGSPLIT-NEXT: s_endpgm
918 ; GFX11-WGP-LABEL: flat_system_release_store:
919 ; GFX11-WGP: ; %bb.0: ; %entry
920 ; GFX11-WGP-NEXT: s_clause 0x1
921 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
922 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
923 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
924 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
925 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
926 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
927 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
928 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
929 ; GFX11-WGP-NEXT: s_endpgm
931 ; GFX11-CU-LABEL: flat_system_release_store:
932 ; GFX11-CU: ; %bb.0: ; %entry
933 ; GFX11-CU-NEXT: s_clause 0x1
934 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
935 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
936 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
937 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
938 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
939 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
940 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
941 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
942 ; GFX11-CU-NEXT: s_endpgm
945 store atomic i32 %in, ptr %out release, align 4
949 define amdgpu_kernel void @flat_system_seq_cst_store(
950 ; GFX7-LABEL: flat_system_seq_cst_store:
951 ; GFX7: ; %bb.0: ; %entry
952 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
953 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
954 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
955 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
956 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
957 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
958 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
959 ; GFX7-NEXT: flat_store_dword v[0:1], v2
960 ; GFX7-NEXT: s_endpgm
962 ; GFX10-WGP-LABEL: flat_system_seq_cst_store:
963 ; GFX10-WGP: ; %bb.0: ; %entry
964 ; GFX10-WGP-NEXT: s_clause 0x1
965 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
966 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
967 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
968 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
969 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
970 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
971 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
972 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
973 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
974 ; GFX10-WGP-NEXT: s_endpgm
976 ; GFX10-CU-LABEL: flat_system_seq_cst_store:
977 ; GFX10-CU: ; %bb.0: ; %entry
978 ; GFX10-CU-NEXT: s_clause 0x1
979 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
980 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
981 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
982 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
983 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
984 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
985 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
986 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
987 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
988 ; GFX10-CU-NEXT: s_endpgm
990 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_store:
991 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
992 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
993 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
994 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
995 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
996 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
997 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
998 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
999 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
1000 ; SKIP-CACHE-INV-NEXT: s_endpgm
1002 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_store:
1003 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1004 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
1005 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
1006 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1007 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1008 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1009 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1010 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1011 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
1012 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1014 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_store:
1015 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1016 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
1017 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
1018 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1019 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1020 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1021 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1022 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1023 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
1024 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1026 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_store:
1027 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1028 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
1029 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
1030 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1031 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1032 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1033 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1034 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1035 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
1036 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1038 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_store:
1039 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1040 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
1041 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
1042 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1043 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1044 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1045 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1046 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1047 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
1048 ; GFX940-TGSPLIT-NEXT: s_endpgm
1050 ; GFX11-WGP-LABEL: flat_system_seq_cst_store:
1051 ; GFX11-WGP: ; %bb.0: ; %entry
1052 ; GFX11-WGP-NEXT: s_clause 0x1
1053 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
1054 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
1055 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1056 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1057 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1058 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1059 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1060 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
1061 ; GFX11-WGP-NEXT: s_endpgm
1063 ; GFX11-CU-LABEL: flat_system_seq_cst_store:
1064 ; GFX11-CU: ; %bb.0: ; %entry
1065 ; GFX11-CU-NEXT: s_clause 0x1
1066 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
1067 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
1068 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1069 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1070 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1071 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1072 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1073 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
1074 ; GFX11-CU-NEXT: s_endpgm
1075 i32 %in, ptr %out) {
1077 store atomic i32 %in, ptr %out seq_cst, align 4
1081 define amdgpu_kernel void @flat_system_monotonic_atomicrmw(
1082 ; GFX7-LABEL: flat_system_monotonic_atomicrmw:
1083 ; GFX7: ; %bb.0: ; %entry
1084 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1085 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1086 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1087 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1088 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1089 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1090 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1091 ; GFX7-NEXT: s_endpgm
1093 ; GFX10-WGP-LABEL: flat_system_monotonic_atomicrmw:
1094 ; GFX10-WGP: ; %bb.0: ; %entry
1095 ; GFX10-WGP-NEXT: s_clause 0x1
1096 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1097 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1098 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1099 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1100 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1101 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1102 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1103 ; GFX10-WGP-NEXT: s_endpgm
1105 ; GFX10-CU-LABEL: flat_system_monotonic_atomicrmw:
1106 ; GFX10-CU: ; %bb.0: ; %entry
1107 ; GFX10-CU-NEXT: s_clause 0x1
1108 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1109 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1110 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1111 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1112 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1113 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1114 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1115 ; GFX10-CU-NEXT: s_endpgm
1117 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_atomicrmw:
1118 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1119 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1120 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1121 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1122 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1123 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1124 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1125 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1126 ; SKIP-CACHE-INV-NEXT: s_endpgm
1128 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_atomicrmw:
1129 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1130 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1131 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1132 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1133 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1134 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1135 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1136 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1138 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_atomicrmw:
1139 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1140 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1141 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1142 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1143 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1144 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1145 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1146 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1148 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_atomicrmw:
1149 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1150 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1151 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1152 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1153 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1154 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1155 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1156 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1158 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_atomicrmw:
1159 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1160 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1161 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1162 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1163 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1164 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1165 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1166 ; GFX940-TGSPLIT-NEXT: s_endpgm
1168 ; GFX11-WGP-LABEL: flat_system_monotonic_atomicrmw:
1169 ; GFX11-WGP: ; %bb.0: ; %entry
1170 ; GFX11-WGP-NEXT: s_clause 0x1
1171 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1172 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1173 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1174 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1175 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1176 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1177 ; GFX11-WGP-NEXT: s_endpgm
1179 ; GFX11-CU-LABEL: flat_system_monotonic_atomicrmw:
1180 ; GFX11-CU: ; %bb.0: ; %entry
1181 ; GFX11-CU-NEXT: s_clause 0x1
1182 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1183 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1184 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1185 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1186 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1187 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1188 ; GFX11-CU-NEXT: s_endpgm
1189 ptr %out, i32 %in) {
1191 %val = atomicrmw volatile xchg ptr %out, i32 %in monotonic
1195 define amdgpu_kernel void @flat_system_acquire_atomicrmw(
1196 ; GFX7-LABEL: flat_system_acquire_atomicrmw:
1197 ; GFX7: ; %bb.0: ; %entry
1198 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1199 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1200 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1201 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1202 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1203 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1204 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1205 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1206 ; GFX7-NEXT: buffer_wbinvl1_vol
1207 ; GFX7-NEXT: s_endpgm
1209 ; GFX10-WGP-LABEL: flat_system_acquire_atomicrmw:
1210 ; GFX10-WGP: ; %bb.0: ; %entry
1211 ; GFX10-WGP-NEXT: s_clause 0x1
1212 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1213 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1214 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1215 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1216 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1217 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1218 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1219 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1220 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1221 ; GFX10-WGP-NEXT: buffer_gl0_inv
1222 ; GFX10-WGP-NEXT: buffer_gl1_inv
1223 ; GFX10-WGP-NEXT: s_endpgm
1225 ; GFX10-CU-LABEL: flat_system_acquire_atomicrmw:
1226 ; GFX10-CU: ; %bb.0: ; %entry
1227 ; GFX10-CU-NEXT: s_clause 0x1
1228 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1229 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1230 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1231 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1232 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1233 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1234 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1235 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1236 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1237 ; GFX10-CU-NEXT: buffer_gl0_inv
1238 ; GFX10-CU-NEXT: buffer_gl1_inv
1239 ; GFX10-CU-NEXT: s_endpgm
1241 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_atomicrmw:
1242 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1243 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1244 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1245 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1246 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1247 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1248 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1249 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1250 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1251 ; SKIP-CACHE-INV-NEXT: s_endpgm
1253 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_atomicrmw:
1254 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1255 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1256 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1257 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1258 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1259 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1260 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1261 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1262 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1263 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1264 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1266 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_atomicrmw:
1267 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1268 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1269 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1270 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1271 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1272 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1273 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1274 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1275 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1276 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1277 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1279 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_atomicrmw:
1280 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1281 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1282 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1283 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1284 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1285 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1286 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1287 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1288 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1289 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1291 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_atomicrmw:
1292 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1293 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1294 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1295 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1296 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1297 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1298 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1299 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1300 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1301 ; GFX940-TGSPLIT-NEXT: s_endpgm
1303 ; GFX11-WGP-LABEL: flat_system_acquire_atomicrmw:
1304 ; GFX11-WGP: ; %bb.0: ; %entry
1305 ; GFX11-WGP-NEXT: s_clause 0x1
1306 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1307 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1308 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1309 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1310 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1311 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1312 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1313 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1314 ; GFX11-WGP-NEXT: buffer_gl0_inv
1315 ; GFX11-WGP-NEXT: buffer_gl1_inv
1316 ; GFX11-WGP-NEXT: s_endpgm
1318 ; GFX11-CU-LABEL: flat_system_acquire_atomicrmw:
1319 ; GFX11-CU: ; %bb.0: ; %entry
1320 ; GFX11-CU-NEXT: s_clause 0x1
1321 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1322 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1323 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1324 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1325 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1326 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1327 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1328 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1329 ; GFX11-CU-NEXT: buffer_gl0_inv
1330 ; GFX11-CU-NEXT: buffer_gl1_inv
1331 ; GFX11-CU-NEXT: s_endpgm
1332 ptr %out, i32 %in) {
1334 %val = atomicrmw volatile xchg ptr %out, i32 %in acquire
1338 define amdgpu_kernel void @flat_system_release_atomicrmw(
1339 ; GFX7-LABEL: flat_system_release_atomicrmw:
1340 ; GFX7: ; %bb.0: ; %entry
1341 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1342 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1343 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1344 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1345 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1346 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1347 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1348 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1349 ; GFX7-NEXT: s_endpgm
1351 ; GFX10-WGP-LABEL: flat_system_release_atomicrmw:
1352 ; GFX10-WGP: ; %bb.0: ; %entry
1353 ; GFX10-WGP-NEXT: s_clause 0x1
1354 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1355 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1356 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1357 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1358 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1359 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1360 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1361 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1362 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1363 ; GFX10-WGP-NEXT: s_endpgm
1365 ; GFX10-CU-LABEL: flat_system_release_atomicrmw:
1366 ; GFX10-CU: ; %bb.0: ; %entry
1367 ; GFX10-CU-NEXT: s_clause 0x1
1368 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1369 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1370 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1371 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1372 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1373 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1374 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1375 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1376 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1377 ; GFX10-CU-NEXT: s_endpgm
1379 ; SKIP-CACHE-INV-LABEL: flat_system_release_atomicrmw:
1380 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1381 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1382 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1383 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1384 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1385 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1386 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1387 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1388 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1389 ; SKIP-CACHE-INV-NEXT: s_endpgm
1391 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_atomicrmw:
1392 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1393 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1394 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1395 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1396 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1397 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1398 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1399 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1400 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1401 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1403 ; GFX90A-TGSPLIT-LABEL: flat_system_release_atomicrmw:
1404 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1405 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1406 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1407 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1408 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1409 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1410 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1411 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1412 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1413 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1415 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_atomicrmw:
1416 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1417 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1418 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1419 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1420 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1421 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1422 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1423 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1424 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1425 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1427 ; GFX940-TGSPLIT-LABEL: flat_system_release_atomicrmw:
1428 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1429 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1430 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1431 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1432 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1433 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1434 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1435 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1436 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1437 ; GFX940-TGSPLIT-NEXT: s_endpgm
1439 ; GFX11-WGP-LABEL: flat_system_release_atomicrmw:
1440 ; GFX11-WGP: ; %bb.0: ; %entry
1441 ; GFX11-WGP-NEXT: s_clause 0x1
1442 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1443 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1444 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1445 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1446 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1447 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1448 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1449 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1450 ; GFX11-WGP-NEXT: s_endpgm
1452 ; GFX11-CU-LABEL: flat_system_release_atomicrmw:
1453 ; GFX11-CU: ; %bb.0: ; %entry
1454 ; GFX11-CU-NEXT: s_clause 0x1
1455 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1456 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1457 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1458 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1459 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1460 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1461 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1462 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1463 ; GFX11-CU-NEXT: s_endpgm
1464 ptr %out, i32 %in) {
1466 %val = atomicrmw volatile xchg ptr %out, i32 %in release
1470 define amdgpu_kernel void @flat_system_acq_rel_atomicrmw(
1471 ; GFX7-LABEL: flat_system_acq_rel_atomicrmw:
1472 ; GFX7: ; %bb.0: ; %entry
1473 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1474 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1475 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1476 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1477 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1478 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1479 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1480 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1481 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1482 ; GFX7-NEXT: buffer_wbinvl1_vol
1483 ; GFX7-NEXT: s_endpgm
1485 ; GFX10-WGP-LABEL: flat_system_acq_rel_atomicrmw:
1486 ; GFX10-WGP: ; %bb.0: ; %entry
1487 ; GFX10-WGP-NEXT: s_clause 0x1
1488 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1489 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1490 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1491 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1492 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1493 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1494 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1495 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1496 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1497 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1498 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1499 ; GFX10-WGP-NEXT: buffer_gl0_inv
1500 ; GFX10-WGP-NEXT: buffer_gl1_inv
1501 ; GFX10-WGP-NEXT: s_endpgm
1503 ; GFX10-CU-LABEL: flat_system_acq_rel_atomicrmw:
1504 ; GFX10-CU: ; %bb.0: ; %entry
1505 ; GFX10-CU-NEXT: s_clause 0x1
1506 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1507 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1508 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1509 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1510 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1511 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1512 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1513 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1514 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1515 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1516 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1517 ; GFX10-CU-NEXT: buffer_gl0_inv
1518 ; GFX10-CU-NEXT: buffer_gl1_inv
1519 ; GFX10-CU-NEXT: s_endpgm
1521 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_atomicrmw:
1522 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1523 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1524 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1525 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1526 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1527 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1528 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1529 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1530 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1531 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1532 ; SKIP-CACHE-INV-NEXT: s_endpgm
1534 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_atomicrmw:
1535 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1536 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1537 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1538 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1539 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1540 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1541 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1542 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1543 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1544 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1545 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1546 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1547 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1549 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_atomicrmw:
1550 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1551 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1552 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1553 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1554 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1555 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1556 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1557 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1558 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1559 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1560 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1561 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1562 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1564 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_atomicrmw:
1565 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1566 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1567 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1568 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1569 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1570 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1571 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1572 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1573 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1574 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1575 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1576 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1578 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_atomicrmw:
1579 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1580 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1581 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1582 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1583 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1584 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1585 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1586 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1587 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1588 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1589 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1590 ; GFX940-TGSPLIT-NEXT: s_endpgm
1592 ; GFX11-WGP-LABEL: flat_system_acq_rel_atomicrmw:
1593 ; GFX11-WGP: ; %bb.0: ; %entry
1594 ; GFX11-WGP-NEXT: s_clause 0x1
1595 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1596 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1597 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1598 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1599 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1600 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1601 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1602 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1603 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1604 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1605 ; GFX11-WGP-NEXT: buffer_gl0_inv
1606 ; GFX11-WGP-NEXT: buffer_gl1_inv
1607 ; GFX11-WGP-NEXT: s_endpgm
1609 ; GFX11-CU-LABEL: flat_system_acq_rel_atomicrmw:
1610 ; GFX11-CU: ; %bb.0: ; %entry
1611 ; GFX11-CU-NEXT: s_clause 0x1
1612 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1613 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1614 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1615 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1616 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1617 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1618 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1619 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1620 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1621 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1622 ; GFX11-CU-NEXT: buffer_gl0_inv
1623 ; GFX11-CU-NEXT: buffer_gl1_inv
1624 ; GFX11-CU-NEXT: s_endpgm
1625 ptr %out, i32 %in) {
1627 %val = atomicrmw volatile xchg ptr %out, i32 %in acq_rel
1631 define amdgpu_kernel void @flat_system_seq_cst_atomicrmw(
1632 ; GFX7-LABEL: flat_system_seq_cst_atomicrmw:
1633 ; GFX7: ; %bb.0: ; %entry
1634 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1635 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1636 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1637 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1638 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1639 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1640 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1641 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1642 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1643 ; GFX7-NEXT: buffer_wbinvl1_vol
1644 ; GFX7-NEXT: s_endpgm
1646 ; GFX10-WGP-LABEL: flat_system_seq_cst_atomicrmw:
1647 ; GFX10-WGP: ; %bb.0: ; %entry
1648 ; GFX10-WGP-NEXT: s_clause 0x1
1649 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1650 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1651 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1652 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1653 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1654 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1655 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1656 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1657 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1658 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1659 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1660 ; GFX10-WGP-NEXT: buffer_gl0_inv
1661 ; GFX10-WGP-NEXT: buffer_gl1_inv
1662 ; GFX10-WGP-NEXT: s_endpgm
1664 ; GFX10-CU-LABEL: flat_system_seq_cst_atomicrmw:
1665 ; GFX10-CU: ; %bb.0: ; %entry
1666 ; GFX10-CU-NEXT: s_clause 0x1
1667 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1668 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1669 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1670 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1671 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1672 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1673 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1674 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1675 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1676 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1677 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1678 ; GFX10-CU-NEXT: buffer_gl0_inv
1679 ; GFX10-CU-NEXT: buffer_gl1_inv
1680 ; GFX10-CU-NEXT: s_endpgm
1682 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_atomicrmw:
1683 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1684 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1685 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1686 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1687 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1688 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1689 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1690 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1691 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1692 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1693 ; SKIP-CACHE-INV-NEXT: s_endpgm
1695 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_atomicrmw:
1696 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1697 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1698 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1699 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1700 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1701 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1702 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1703 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1704 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1705 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1706 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1707 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1708 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1710 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_atomicrmw:
1711 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1712 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1713 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1714 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1715 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1716 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1717 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1718 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1719 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1720 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1721 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1722 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1723 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1725 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_atomicrmw:
1726 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1727 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1728 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1729 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1730 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1731 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1732 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1733 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1734 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1735 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1736 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1737 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1739 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_atomicrmw:
1740 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1741 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1742 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1743 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1744 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1745 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1746 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1747 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1748 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1749 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1750 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1751 ; GFX940-TGSPLIT-NEXT: s_endpgm
1753 ; GFX11-WGP-LABEL: flat_system_seq_cst_atomicrmw:
1754 ; GFX11-WGP: ; %bb.0: ; %entry
1755 ; GFX11-WGP-NEXT: s_clause 0x1
1756 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1757 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1758 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1759 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1760 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1761 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1762 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1763 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1764 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1765 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1766 ; GFX11-WGP-NEXT: buffer_gl0_inv
1767 ; GFX11-WGP-NEXT: buffer_gl1_inv
1768 ; GFX11-WGP-NEXT: s_endpgm
1770 ; GFX11-CU-LABEL: flat_system_seq_cst_atomicrmw:
1771 ; GFX11-CU: ; %bb.0: ; %entry
1772 ; GFX11-CU-NEXT: s_clause 0x1
1773 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1774 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1775 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1776 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1777 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1778 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1779 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1780 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1781 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1782 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1783 ; GFX11-CU-NEXT: buffer_gl0_inv
1784 ; GFX11-CU-NEXT: buffer_gl1_inv
1785 ; GFX11-CU-NEXT: s_endpgm
1786 ptr %out, i32 %in) {
1788 %val = atomicrmw volatile xchg ptr %out, i32 %in seq_cst
1792 define amdgpu_kernel void @flat_system_acquire_ret_atomicrmw(
1793 ; GFX7-LABEL: flat_system_acquire_ret_atomicrmw:
1794 ; GFX7: ; %bb.0: ; %entry
1795 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1796 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1797 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1798 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1799 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1800 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1801 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1802 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1803 ; GFX7-NEXT: buffer_wbinvl1_vol
1804 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1805 ; GFX7-NEXT: s_endpgm
1807 ; GFX10-WGP-LABEL: flat_system_acquire_ret_atomicrmw:
1808 ; GFX10-WGP: ; %bb.0: ; %entry
1809 ; GFX10-WGP-NEXT: s_clause 0x1
1810 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1811 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1812 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1813 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1814 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1815 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1816 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1817 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1818 ; GFX10-WGP-NEXT: buffer_gl0_inv
1819 ; GFX10-WGP-NEXT: buffer_gl1_inv
1820 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
1821 ; GFX10-WGP-NEXT: s_endpgm
1823 ; GFX10-CU-LABEL: flat_system_acquire_ret_atomicrmw:
1824 ; GFX10-CU: ; %bb.0: ; %entry
1825 ; GFX10-CU-NEXT: s_clause 0x1
1826 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1827 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1828 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1829 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1830 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1831 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1832 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1833 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1834 ; GFX10-CU-NEXT: buffer_gl0_inv
1835 ; GFX10-CU-NEXT: buffer_gl1_inv
1836 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
1837 ; GFX10-CU-NEXT: s_endpgm
1839 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_ret_atomicrmw:
1840 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1841 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1842 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1843 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1844 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1845 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1846 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1847 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1848 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1849 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
1850 ; SKIP-CACHE-INV-NEXT: s_endpgm
1852 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_ret_atomicrmw:
1853 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1854 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1855 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1856 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1857 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1858 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1859 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1860 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1861 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1862 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1863 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
1864 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1866 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_ret_atomicrmw:
1867 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1868 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1869 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1870 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1871 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1872 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1873 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1874 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1875 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1876 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1877 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
1878 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1880 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_ret_atomicrmw:
1881 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1882 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1883 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1884 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1885 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1886 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1887 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
1888 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1889 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1890 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
1891 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1893 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_ret_atomicrmw:
1894 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1895 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1896 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1897 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1898 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1899 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1900 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
1901 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1902 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1903 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
1904 ; GFX940-TGSPLIT-NEXT: s_endpgm
1906 ; GFX11-WGP-LABEL: flat_system_acquire_ret_atomicrmw:
1907 ; GFX11-WGP: ; %bb.0: ; %entry
1908 ; GFX11-WGP-NEXT: s_clause 0x1
1909 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1910 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1911 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1912 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1913 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1914 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
1915 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1916 ; GFX11-WGP-NEXT: buffer_gl0_inv
1917 ; GFX11-WGP-NEXT: buffer_gl1_inv
1918 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
1919 ; GFX11-WGP-NEXT: s_endpgm
1921 ; GFX11-CU-LABEL: flat_system_acquire_ret_atomicrmw:
1922 ; GFX11-CU: ; %bb.0: ; %entry
1923 ; GFX11-CU-NEXT: s_clause 0x1
1924 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1925 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1926 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1927 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1928 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1929 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
1930 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1931 ; GFX11-CU-NEXT: buffer_gl0_inv
1932 ; GFX11-CU-NEXT: buffer_gl1_inv
1933 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
1934 ; GFX11-CU-NEXT: s_endpgm
1935 ptr %out, i32 %in) {
1937 %val = atomicrmw volatile xchg ptr %out, i32 %in acquire
1938 store i32 %val, ptr %out, align 4
1942 define amdgpu_kernel void @flat_system_acq_rel_ret_atomicrmw(
1943 ; GFX7-LABEL: flat_system_acq_rel_ret_atomicrmw:
1944 ; GFX7: ; %bb.0: ; %entry
1945 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1946 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1947 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1948 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1949 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1950 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1951 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1952 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1953 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1954 ; GFX7-NEXT: buffer_wbinvl1_vol
1955 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1956 ; GFX7-NEXT: s_endpgm
1958 ; GFX10-WGP-LABEL: flat_system_acq_rel_ret_atomicrmw:
1959 ; GFX10-WGP: ; %bb.0: ; %entry
1960 ; GFX10-WGP-NEXT: s_clause 0x1
1961 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1962 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1963 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1964 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1965 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1966 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1967 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1968 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1969 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1970 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1971 ; GFX10-WGP-NEXT: buffer_gl0_inv
1972 ; GFX10-WGP-NEXT: buffer_gl1_inv
1973 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
1974 ; GFX10-WGP-NEXT: s_endpgm
1976 ; GFX10-CU-LABEL: flat_system_acq_rel_ret_atomicrmw:
1977 ; GFX10-CU: ; %bb.0: ; %entry
1978 ; GFX10-CU-NEXT: s_clause 0x1
1979 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1980 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1981 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1982 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1983 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1984 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1985 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1986 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1987 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1988 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1989 ; GFX10-CU-NEXT: buffer_gl0_inv
1990 ; GFX10-CU-NEXT: buffer_gl1_inv
1991 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
1992 ; GFX10-CU-NEXT: s_endpgm
1994 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_ret_atomicrmw:
1995 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1996 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1997 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1998 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1999 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2000 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2001 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
2002 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2003 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2004 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2005 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
2006 ; SKIP-CACHE-INV-NEXT: s_endpgm
2008 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_ret_atomicrmw:
2009 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2010 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2011 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2012 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2013 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2014 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
2015 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2016 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2017 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2018 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2019 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2020 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2021 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
2022 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2024 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_ret_atomicrmw:
2025 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2026 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2027 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2028 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2029 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2030 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
2031 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2032 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2033 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2034 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2035 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2036 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2037 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
2038 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2040 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_ret_atomicrmw:
2041 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2042 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2043 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2044 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2045 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2046 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2047 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2048 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2049 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
2050 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2051 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2052 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
2053 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2055 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_ret_atomicrmw:
2056 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2057 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2058 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2059 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2060 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2061 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2062 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2063 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2064 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
2065 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2066 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2067 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
2068 ; GFX940-TGSPLIT-NEXT: s_endpgm
2070 ; GFX11-WGP-LABEL: flat_system_acq_rel_ret_atomicrmw:
2071 ; GFX11-WGP: ; %bb.0: ; %entry
2072 ; GFX11-WGP-NEXT: s_clause 0x1
2073 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
2074 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
2075 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2076 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2077 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
2078 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2079 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2080 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
2081 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2082 ; GFX11-WGP-NEXT: buffer_gl0_inv
2083 ; GFX11-WGP-NEXT: buffer_gl1_inv
2084 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
2085 ; GFX11-WGP-NEXT: s_endpgm
2087 ; GFX11-CU-LABEL: flat_system_acq_rel_ret_atomicrmw:
2088 ; GFX11-CU: ; %bb.0: ; %entry
2089 ; GFX11-CU-NEXT: s_clause 0x1
2090 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
2091 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
2092 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2093 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2094 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
2095 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2096 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2097 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
2098 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2099 ; GFX11-CU-NEXT: buffer_gl0_inv
2100 ; GFX11-CU-NEXT: buffer_gl1_inv
2101 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
2102 ; GFX11-CU-NEXT: s_endpgm
2103 ptr %out, i32 %in) {
2105 %val = atomicrmw volatile xchg ptr %out, i32 %in acq_rel
2106 store i32 %val, ptr %out, align 4
2110 define amdgpu_kernel void @flat_system_seq_cst_ret_atomicrmw(
2111 ; GFX7-LABEL: flat_system_seq_cst_ret_atomicrmw:
2112 ; GFX7: ; %bb.0: ; %entry
2113 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2114 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
2115 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2116 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2117 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2118 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2119 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2120 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2121 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2122 ; GFX7-NEXT: buffer_wbinvl1_vol
2123 ; GFX7-NEXT: flat_store_dword v[0:1], v2
2124 ; GFX7-NEXT: s_endpgm
2126 ; GFX10-WGP-LABEL: flat_system_seq_cst_ret_atomicrmw:
2127 ; GFX10-WGP: ; %bb.0: ; %entry
2128 ; GFX10-WGP-NEXT: s_clause 0x1
2129 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2130 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
2131 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2132 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2133 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2134 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2135 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2136 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2137 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2138 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2139 ; GFX10-WGP-NEXT: buffer_gl0_inv
2140 ; GFX10-WGP-NEXT: buffer_gl1_inv
2141 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
2142 ; GFX10-WGP-NEXT: s_endpgm
2144 ; GFX10-CU-LABEL: flat_system_seq_cst_ret_atomicrmw:
2145 ; GFX10-CU: ; %bb.0: ; %entry
2146 ; GFX10-CU-NEXT: s_clause 0x1
2147 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2148 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
2149 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2150 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2151 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2152 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2153 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2154 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2155 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2156 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2157 ; GFX10-CU-NEXT: buffer_gl0_inv
2158 ; GFX10-CU-NEXT: buffer_gl1_inv
2159 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
2160 ; GFX10-CU-NEXT: s_endpgm
2162 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_ret_atomicrmw:
2163 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2164 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2165 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
2166 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2167 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2168 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2169 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
2170 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2171 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2172 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2173 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
2174 ; SKIP-CACHE-INV-NEXT: s_endpgm
2176 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_ret_atomicrmw:
2177 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2178 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2179 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2180 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2181 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2182 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
2183 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2184 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2185 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2186 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2187 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2188 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2189 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
2190 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2192 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_ret_atomicrmw:
2193 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2194 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2195 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2196 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2197 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2198 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
2199 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2200 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2201 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2202 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2203 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2204 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2205 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
2206 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2208 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_ret_atomicrmw:
2209 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2210 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2211 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2212 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2213 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2214 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2215 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2216 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2217 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
2218 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2219 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2220 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
2221 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2223 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_ret_atomicrmw:
2224 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2225 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2226 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2227 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2228 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2229 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2230 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2231 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2232 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
2233 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2234 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2235 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
2236 ; GFX940-TGSPLIT-NEXT: s_endpgm
2238 ; GFX11-WGP-LABEL: flat_system_seq_cst_ret_atomicrmw:
2239 ; GFX11-WGP: ; %bb.0: ; %entry
2240 ; GFX11-WGP-NEXT: s_clause 0x1
2241 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
2242 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
2243 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2244 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2245 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
2246 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2247 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2248 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
2249 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2250 ; GFX11-WGP-NEXT: buffer_gl0_inv
2251 ; GFX11-WGP-NEXT: buffer_gl1_inv
2252 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
2253 ; GFX11-WGP-NEXT: s_endpgm
2255 ; GFX11-CU-LABEL: flat_system_seq_cst_ret_atomicrmw:
2256 ; GFX11-CU: ; %bb.0: ; %entry
2257 ; GFX11-CU-NEXT: s_clause 0x1
2258 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
2259 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
2260 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2261 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2262 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
2263 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2264 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2265 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
2266 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2267 ; GFX11-CU-NEXT: buffer_gl0_inv
2268 ; GFX11-CU-NEXT: buffer_gl1_inv
2269 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
2270 ; GFX11-CU-NEXT: s_endpgm
2271 ptr %out, i32 %in) {
2273 %val = atomicrmw volatile xchg ptr %out, i32 %in seq_cst
2274 store i32 %val, ptr %out, align 4
2278 define amdgpu_kernel void @flat_system_monotonic_monotonic_cmpxchg(
2279 ; GFX7-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2280 ; GFX7: ; %bb.0: ; %entry
2281 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2282 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2283 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2284 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2285 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2286 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2287 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2288 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2289 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2290 ; GFX7-NEXT: s_endpgm
2292 ; GFX10-WGP-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2293 ; GFX10-WGP: ; %bb.0: ; %entry
2294 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2295 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2296 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2297 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2298 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2299 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2300 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2301 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2302 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2303 ; GFX10-WGP-NEXT: s_endpgm
2305 ; GFX10-CU-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2306 ; GFX10-CU: ; %bb.0: ; %entry
2307 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2308 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2309 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2310 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2311 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2312 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2313 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2314 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2315 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2316 ; GFX10-CU-NEXT: s_endpgm
2318 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2319 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2320 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2321 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2322 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2323 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2324 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2325 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2326 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2327 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2328 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2329 ; SKIP-CACHE-INV-NEXT: s_endpgm
2331 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2332 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2333 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2334 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2335 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2336 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2337 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2338 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2340 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2341 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2342 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2343 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2344 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2345 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2346 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2347 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2349 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2350 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2351 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2352 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2353 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2354 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2355 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2356 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2358 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2359 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2360 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2361 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2362 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2363 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2364 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2365 ; GFX940-TGSPLIT-NEXT: s_endpgm
2367 ; GFX11-WGP-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2368 ; GFX11-WGP: ; %bb.0: ; %entry
2369 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2370 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2371 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2372 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2373 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2374 ; GFX11-WGP-NEXT: s_endpgm
2376 ; GFX11-CU-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2377 ; GFX11-CU: ; %bb.0: ; %entry
2378 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2379 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2380 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2381 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2382 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2383 ; GFX11-CU-NEXT: s_endpgm
2384 ptr %out, i32 %in, i32 %old) {
2386 %gep = getelementptr i32, ptr %out, i32 4
2387 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in monotonic monotonic
2391 define amdgpu_kernel void @flat_system_acquire_monotonic_cmpxchg(
2392 ; GFX7-LABEL: flat_system_acquire_monotonic_cmpxchg:
2393 ; GFX7: ; %bb.0: ; %entry
2394 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2395 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2396 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2397 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2398 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2399 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2400 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2401 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2402 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2403 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2404 ; GFX7-NEXT: buffer_wbinvl1_vol
2405 ; GFX7-NEXT: s_endpgm
2407 ; GFX10-WGP-LABEL: flat_system_acquire_monotonic_cmpxchg:
2408 ; GFX10-WGP: ; %bb.0: ; %entry
2409 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2410 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2411 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2412 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2413 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2414 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2415 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2416 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2417 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2418 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2419 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2420 ; GFX10-WGP-NEXT: buffer_gl0_inv
2421 ; GFX10-WGP-NEXT: buffer_gl1_inv
2422 ; GFX10-WGP-NEXT: s_endpgm
2424 ; GFX10-CU-LABEL: flat_system_acquire_monotonic_cmpxchg:
2425 ; GFX10-CU: ; %bb.0: ; %entry
2426 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2427 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2428 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2429 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2430 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2431 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2432 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2433 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2434 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2435 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2436 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2437 ; GFX10-CU-NEXT: buffer_gl0_inv
2438 ; GFX10-CU-NEXT: buffer_gl1_inv
2439 ; GFX10-CU-NEXT: s_endpgm
2441 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_monotonic_cmpxchg:
2442 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2443 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2444 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2445 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2446 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2447 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2448 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2449 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2450 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2451 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2452 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2453 ; SKIP-CACHE-INV-NEXT: s_endpgm
2455 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_monotonic_cmpxchg:
2456 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2457 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2458 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2459 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2460 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2461 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2462 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2463 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2464 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2465 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2467 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_monotonic_cmpxchg:
2468 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2469 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2470 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2471 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2472 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2473 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2474 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2475 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2476 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2477 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2479 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_monotonic_cmpxchg:
2480 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2481 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2482 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2483 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2484 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2485 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2486 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2487 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2488 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2490 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_monotonic_cmpxchg:
2491 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2492 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2493 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2494 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2495 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2496 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2497 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2498 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2499 ; GFX940-TGSPLIT-NEXT: s_endpgm
2501 ; GFX11-WGP-LABEL: flat_system_acquire_monotonic_cmpxchg:
2502 ; GFX11-WGP: ; %bb.0: ; %entry
2503 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2504 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2505 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2506 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2507 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2508 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2509 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2510 ; GFX11-WGP-NEXT: buffer_gl0_inv
2511 ; GFX11-WGP-NEXT: buffer_gl1_inv
2512 ; GFX11-WGP-NEXT: s_endpgm
2514 ; GFX11-CU-LABEL: flat_system_acquire_monotonic_cmpxchg:
2515 ; GFX11-CU: ; %bb.0: ; %entry
2516 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2517 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2518 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2519 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2520 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2521 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2522 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2523 ; GFX11-CU-NEXT: buffer_gl0_inv
2524 ; GFX11-CU-NEXT: buffer_gl1_inv
2525 ; GFX11-CU-NEXT: s_endpgm
2526 ptr %out, i32 %in, i32 %old) {
2528 %gep = getelementptr i32, ptr %out, i32 4
2529 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acquire monotonic
2533 define amdgpu_kernel void @flat_system_release_monotonic_cmpxchg(
2534 ; GFX7-LABEL: flat_system_release_monotonic_cmpxchg:
2535 ; GFX7: ; %bb.0: ; %entry
2536 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2537 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2538 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2539 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2540 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2541 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2542 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2543 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2544 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2545 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2546 ; GFX7-NEXT: s_endpgm
2548 ; GFX10-WGP-LABEL: flat_system_release_monotonic_cmpxchg:
2549 ; GFX10-WGP: ; %bb.0: ; %entry
2550 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2551 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2552 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2553 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2554 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2555 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2556 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2557 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2558 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2559 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2560 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2561 ; GFX10-WGP-NEXT: s_endpgm
2563 ; GFX10-CU-LABEL: flat_system_release_monotonic_cmpxchg:
2564 ; GFX10-CU: ; %bb.0: ; %entry
2565 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2566 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2567 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2568 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2569 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2570 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2571 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2572 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2573 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2574 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2575 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2576 ; GFX10-CU-NEXT: s_endpgm
2578 ; SKIP-CACHE-INV-LABEL: flat_system_release_monotonic_cmpxchg:
2579 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2580 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2581 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2582 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2583 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2584 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2585 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2586 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2587 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2588 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2589 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2590 ; SKIP-CACHE-INV-NEXT: s_endpgm
2592 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_monotonic_cmpxchg:
2593 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2594 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2595 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2596 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2597 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2598 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2599 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2600 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2601 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2603 ; GFX90A-TGSPLIT-LABEL: flat_system_release_monotonic_cmpxchg:
2604 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2605 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2606 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2607 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2608 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2609 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2610 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2611 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2612 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2614 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_monotonic_cmpxchg:
2615 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2616 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2617 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2618 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2619 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2620 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2621 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2622 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2623 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2625 ; GFX940-TGSPLIT-LABEL: flat_system_release_monotonic_cmpxchg:
2626 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2627 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2628 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2629 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2630 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2631 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2632 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2633 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2634 ; GFX940-TGSPLIT-NEXT: s_endpgm
2636 ; GFX11-WGP-LABEL: flat_system_release_monotonic_cmpxchg:
2637 ; GFX11-WGP: ; %bb.0: ; %entry
2638 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2639 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2640 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2641 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2642 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2643 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2644 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2645 ; GFX11-WGP-NEXT: s_endpgm
2647 ; GFX11-CU-LABEL: flat_system_release_monotonic_cmpxchg:
2648 ; GFX11-CU: ; %bb.0: ; %entry
2649 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2650 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2651 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2652 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2653 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2654 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2655 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2656 ; GFX11-CU-NEXT: s_endpgm
2657 ptr %out, i32 %in, i32 %old) {
2659 %gep = getelementptr i32, ptr %out, i32 4
2660 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in release monotonic
2664 define amdgpu_kernel void @flat_system_acq_rel_monotonic_cmpxchg(
2665 ; GFX7-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2666 ; GFX7: ; %bb.0: ; %entry
2667 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2668 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2669 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2670 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2671 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2672 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2673 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2674 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2675 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2676 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2677 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2678 ; GFX7-NEXT: buffer_wbinvl1_vol
2679 ; GFX7-NEXT: s_endpgm
2681 ; GFX10-WGP-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2682 ; GFX10-WGP: ; %bb.0: ; %entry
2683 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2684 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2685 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2686 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2687 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2688 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2689 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2690 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2691 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2692 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2693 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2694 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2695 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2696 ; GFX10-WGP-NEXT: buffer_gl0_inv
2697 ; GFX10-WGP-NEXT: buffer_gl1_inv
2698 ; GFX10-WGP-NEXT: s_endpgm
2700 ; GFX10-CU-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2701 ; GFX10-CU: ; %bb.0: ; %entry
2702 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2703 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2704 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2705 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2706 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2707 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2708 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2709 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2710 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2711 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2712 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2713 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2714 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2715 ; GFX10-CU-NEXT: buffer_gl0_inv
2716 ; GFX10-CU-NEXT: buffer_gl1_inv
2717 ; GFX10-CU-NEXT: s_endpgm
2719 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2720 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2721 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2722 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2723 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2724 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2725 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2726 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2727 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2728 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2729 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2730 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2731 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2732 ; SKIP-CACHE-INV-NEXT: s_endpgm
2734 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2735 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2736 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2737 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2738 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2739 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2740 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2741 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2742 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2743 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2744 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2745 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2746 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2748 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2749 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2750 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2751 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2752 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2753 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2754 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2755 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2756 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2757 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2758 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2759 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2760 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2762 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2763 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2764 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2765 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2766 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2767 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2768 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2769 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2770 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2771 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2772 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2773 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2775 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2776 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2777 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2778 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2779 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2780 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2781 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2782 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2783 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2784 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2785 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2786 ; GFX940-TGSPLIT-NEXT: s_endpgm
2788 ; GFX11-WGP-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2789 ; GFX11-WGP: ; %bb.0: ; %entry
2790 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2791 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2792 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2793 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2794 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2795 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2796 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2797 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2798 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2799 ; GFX11-WGP-NEXT: buffer_gl0_inv
2800 ; GFX11-WGP-NEXT: buffer_gl1_inv
2801 ; GFX11-WGP-NEXT: s_endpgm
2803 ; GFX11-CU-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2804 ; GFX11-CU: ; %bb.0: ; %entry
2805 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2806 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2807 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2808 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2809 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2810 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2811 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2812 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2813 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2814 ; GFX11-CU-NEXT: buffer_gl0_inv
2815 ; GFX11-CU-NEXT: buffer_gl1_inv
2816 ; GFX11-CU-NEXT: s_endpgm
2817 ptr %out, i32 %in, i32 %old) {
2819 %gep = getelementptr i32, ptr %out, i32 4
2820 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acq_rel monotonic
2824 define amdgpu_kernel void @flat_system_seq_cst_monotonic_cmpxchg(
2825 ; GFX7-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2826 ; GFX7: ; %bb.0: ; %entry
2827 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2828 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2829 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2830 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2831 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2832 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2833 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2834 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2835 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2836 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2837 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2838 ; GFX7-NEXT: buffer_wbinvl1_vol
2839 ; GFX7-NEXT: s_endpgm
2841 ; GFX10-WGP-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2842 ; GFX10-WGP: ; %bb.0: ; %entry
2843 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2844 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2845 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2846 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2847 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2848 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2849 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2850 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2851 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2852 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2853 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2854 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2855 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2856 ; GFX10-WGP-NEXT: buffer_gl0_inv
2857 ; GFX10-WGP-NEXT: buffer_gl1_inv
2858 ; GFX10-WGP-NEXT: s_endpgm
2860 ; GFX10-CU-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2861 ; GFX10-CU: ; %bb.0: ; %entry
2862 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2863 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2864 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2865 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2866 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2867 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2868 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2869 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2870 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2871 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2872 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2873 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2874 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2875 ; GFX10-CU-NEXT: buffer_gl0_inv
2876 ; GFX10-CU-NEXT: buffer_gl1_inv
2877 ; GFX10-CU-NEXT: s_endpgm
2879 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2880 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2881 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2882 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2883 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2884 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2885 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2886 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2887 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2888 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2889 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2890 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2891 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2892 ; SKIP-CACHE-INV-NEXT: s_endpgm
2894 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2895 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2896 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2897 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2898 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2899 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2900 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2901 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2902 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2903 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2904 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2905 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2906 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2908 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2909 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2910 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2911 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2912 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2913 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2914 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2915 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2916 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2917 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2918 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2919 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2920 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2922 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2923 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2924 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2925 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2926 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2927 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2928 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2929 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2930 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2931 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2932 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2933 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2935 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2936 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2937 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2938 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2939 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2940 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2941 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2942 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2943 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2944 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2945 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2946 ; GFX940-TGSPLIT-NEXT: s_endpgm
2948 ; GFX11-WGP-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2949 ; GFX11-WGP: ; %bb.0: ; %entry
2950 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2951 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2952 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2953 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2954 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2955 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2956 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2957 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2958 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2959 ; GFX11-WGP-NEXT: buffer_gl0_inv
2960 ; GFX11-WGP-NEXT: buffer_gl1_inv
2961 ; GFX11-WGP-NEXT: s_endpgm
2963 ; GFX11-CU-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2964 ; GFX11-CU: ; %bb.0: ; %entry
2965 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2966 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2967 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2968 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2969 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2970 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2971 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2972 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2973 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2974 ; GFX11-CU-NEXT: buffer_gl0_inv
2975 ; GFX11-CU-NEXT: buffer_gl1_inv
2976 ; GFX11-CU-NEXT: s_endpgm
2977 ptr %out, i32 %in, i32 %old) {
2979 %gep = getelementptr i32, ptr %out, i32 4
2980 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in seq_cst monotonic
2984 define amdgpu_kernel void @flat_system_monotonic_acquire_cmpxchg(
2985 ; GFX7-LABEL: flat_system_monotonic_acquire_cmpxchg:
2986 ; GFX7: ; %bb.0: ; %entry
2987 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2988 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2989 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2990 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2991 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2992 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2993 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2994 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2995 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2996 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2997 ; GFX7-NEXT: buffer_wbinvl1_vol
2998 ; GFX7-NEXT: s_endpgm
3000 ; GFX10-WGP-LABEL: flat_system_monotonic_acquire_cmpxchg:
3001 ; GFX10-WGP: ; %bb.0: ; %entry
3002 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3003 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3004 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3005 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3006 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3007 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3008 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3009 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3010 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3011 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3012 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3013 ; GFX10-WGP-NEXT: buffer_gl0_inv
3014 ; GFX10-WGP-NEXT: buffer_gl1_inv
3015 ; GFX10-WGP-NEXT: s_endpgm
3017 ; GFX10-CU-LABEL: flat_system_monotonic_acquire_cmpxchg:
3018 ; GFX10-CU: ; %bb.0: ; %entry
3019 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3020 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3021 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3022 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3023 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3024 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3025 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3026 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3027 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3028 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3029 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3030 ; GFX10-CU-NEXT: buffer_gl0_inv
3031 ; GFX10-CU-NEXT: buffer_gl1_inv
3032 ; GFX10-CU-NEXT: s_endpgm
3034 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_acquire_cmpxchg:
3035 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3036 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3037 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3038 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3039 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3040 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3041 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3042 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3043 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3044 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3045 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3046 ; SKIP-CACHE-INV-NEXT: s_endpgm
3048 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_acquire_cmpxchg:
3049 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3050 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3051 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3052 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3053 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3054 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3055 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3056 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3057 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3058 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3060 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_acquire_cmpxchg:
3061 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3062 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3063 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3064 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3065 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3066 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3067 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3068 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3069 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3070 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3072 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_acquire_cmpxchg:
3073 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3074 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3075 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3076 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3077 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3078 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3079 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3080 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3081 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3083 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_acquire_cmpxchg:
3084 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3085 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3086 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3087 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3088 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3089 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3090 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3091 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3092 ; GFX940-TGSPLIT-NEXT: s_endpgm
3094 ; GFX11-WGP-LABEL: flat_system_monotonic_acquire_cmpxchg:
3095 ; GFX11-WGP: ; %bb.0: ; %entry
3096 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3097 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3098 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3099 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3100 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3101 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3102 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3103 ; GFX11-WGP-NEXT: buffer_gl0_inv
3104 ; GFX11-WGP-NEXT: buffer_gl1_inv
3105 ; GFX11-WGP-NEXT: s_endpgm
3107 ; GFX11-CU-LABEL: flat_system_monotonic_acquire_cmpxchg:
3108 ; GFX11-CU: ; %bb.0: ; %entry
3109 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3110 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3111 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3112 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3113 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3114 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3115 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3116 ; GFX11-CU-NEXT: buffer_gl0_inv
3117 ; GFX11-CU-NEXT: buffer_gl1_inv
3118 ; GFX11-CU-NEXT: s_endpgm
3119 ptr %out, i32 %in, i32 %old) {
3121 %gep = getelementptr i32, ptr %out, i32 4
3122 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in monotonic acquire
3126 define amdgpu_kernel void @flat_system_acquire_acquire_cmpxchg(
3127 ; GFX7-LABEL: flat_system_acquire_acquire_cmpxchg:
3128 ; GFX7: ; %bb.0: ; %entry
3129 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3130 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3131 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3132 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3133 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3134 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3135 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3136 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3137 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3138 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3139 ; GFX7-NEXT: buffer_wbinvl1_vol
3140 ; GFX7-NEXT: s_endpgm
3142 ; GFX10-WGP-LABEL: flat_system_acquire_acquire_cmpxchg:
3143 ; GFX10-WGP: ; %bb.0: ; %entry
3144 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3145 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3146 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3147 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3148 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3149 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3150 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3151 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3152 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3153 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3154 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3155 ; GFX10-WGP-NEXT: buffer_gl0_inv
3156 ; GFX10-WGP-NEXT: buffer_gl1_inv
3157 ; GFX10-WGP-NEXT: s_endpgm
3159 ; GFX10-CU-LABEL: flat_system_acquire_acquire_cmpxchg:
3160 ; GFX10-CU: ; %bb.0: ; %entry
3161 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3162 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3163 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3164 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3165 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3166 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3167 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3168 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3169 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3170 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3171 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3172 ; GFX10-CU-NEXT: buffer_gl0_inv
3173 ; GFX10-CU-NEXT: buffer_gl1_inv
3174 ; GFX10-CU-NEXT: s_endpgm
3176 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_acquire_cmpxchg:
3177 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3178 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3179 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3180 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3181 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3182 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3183 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3184 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3185 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3186 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3187 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3188 ; SKIP-CACHE-INV-NEXT: s_endpgm
3190 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_acquire_cmpxchg:
3191 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3192 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3193 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3194 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3195 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3196 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3197 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3198 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3199 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3200 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3202 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_acquire_cmpxchg:
3203 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3204 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3205 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3206 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3207 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3208 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3209 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3210 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3211 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3212 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3214 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_acquire_cmpxchg:
3215 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3216 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3217 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3218 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3219 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3220 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3221 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3222 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3223 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3225 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_acquire_cmpxchg:
3226 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3227 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3228 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3229 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3230 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3231 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3232 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3233 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3234 ; GFX940-TGSPLIT-NEXT: s_endpgm
3236 ; GFX11-WGP-LABEL: flat_system_acquire_acquire_cmpxchg:
3237 ; GFX11-WGP: ; %bb.0: ; %entry
3238 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3239 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3240 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3241 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3242 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3243 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3244 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3245 ; GFX11-WGP-NEXT: buffer_gl0_inv
3246 ; GFX11-WGP-NEXT: buffer_gl1_inv
3247 ; GFX11-WGP-NEXT: s_endpgm
3249 ; GFX11-CU-LABEL: flat_system_acquire_acquire_cmpxchg:
3250 ; GFX11-CU: ; %bb.0: ; %entry
3251 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3252 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3253 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3254 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3255 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3256 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3257 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3258 ; GFX11-CU-NEXT: buffer_gl0_inv
3259 ; GFX11-CU-NEXT: buffer_gl1_inv
3260 ; GFX11-CU-NEXT: s_endpgm
3261 ptr %out, i32 %in, i32 %old) {
3263 %gep = getelementptr i32, ptr %out, i32 4
3264 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acquire acquire
3268 define amdgpu_kernel void @flat_system_release_acquire_cmpxchg(
3269 ; GFX7-LABEL: flat_system_release_acquire_cmpxchg:
3270 ; GFX7: ; %bb.0: ; %entry
3271 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3272 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3273 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3274 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3275 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3276 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3277 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3278 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3279 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3280 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3281 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3282 ; GFX7-NEXT: buffer_wbinvl1_vol
3283 ; GFX7-NEXT: s_endpgm
3285 ; GFX10-WGP-LABEL: flat_system_release_acquire_cmpxchg:
3286 ; GFX10-WGP: ; %bb.0: ; %entry
3287 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3288 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3289 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3290 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3291 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3292 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3293 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3294 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3295 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3296 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3297 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3298 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3299 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3300 ; GFX10-WGP-NEXT: buffer_gl0_inv
3301 ; GFX10-WGP-NEXT: buffer_gl1_inv
3302 ; GFX10-WGP-NEXT: s_endpgm
3304 ; GFX10-CU-LABEL: flat_system_release_acquire_cmpxchg:
3305 ; GFX10-CU: ; %bb.0: ; %entry
3306 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3307 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3308 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3309 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3310 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3311 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3312 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3313 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3314 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3315 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3316 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3317 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3318 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3319 ; GFX10-CU-NEXT: buffer_gl0_inv
3320 ; GFX10-CU-NEXT: buffer_gl1_inv
3321 ; GFX10-CU-NEXT: s_endpgm
3323 ; SKIP-CACHE-INV-LABEL: flat_system_release_acquire_cmpxchg:
3324 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3325 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3326 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3327 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3328 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3329 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3330 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3331 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3332 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3333 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3334 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3335 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3336 ; SKIP-CACHE-INV-NEXT: s_endpgm
3338 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_acquire_cmpxchg:
3339 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3340 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3341 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3342 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3343 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3344 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3345 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3346 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3347 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3348 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3349 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3350 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3352 ; GFX90A-TGSPLIT-LABEL: flat_system_release_acquire_cmpxchg:
3353 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3354 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3355 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3356 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3357 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3358 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3359 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3360 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] 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: flat_system_release_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: s_waitcnt lgkmcnt(0)
3370 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3371 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3372 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3373 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3374 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3375 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3376 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3377 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3379 ; GFX940-TGSPLIT-LABEL: flat_system_release_acquire_cmpxchg:
3380 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3381 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3382 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3383 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3384 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3385 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3386 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3387 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3388 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3389 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3390 ; GFX940-TGSPLIT-NEXT: s_endpgm
3392 ; GFX11-WGP-LABEL: flat_system_release_acquire_cmpxchg:
3393 ; GFX11-WGP: ; %bb.0: ; %entry
3394 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3395 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3396 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3397 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3398 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3399 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3400 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3401 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3402 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3403 ; GFX11-WGP-NEXT: buffer_gl0_inv
3404 ; GFX11-WGP-NEXT: buffer_gl1_inv
3405 ; GFX11-WGP-NEXT: s_endpgm
3407 ; GFX11-CU-LABEL: flat_system_release_acquire_cmpxchg:
3408 ; GFX11-CU: ; %bb.0: ; %entry
3409 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3410 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3411 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3412 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3413 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3414 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3415 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3416 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3417 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3418 ; GFX11-CU-NEXT: buffer_gl0_inv
3419 ; GFX11-CU-NEXT: buffer_gl1_inv
3420 ; GFX11-CU-NEXT: s_endpgm
3421 ptr %out, i32 %in, i32 %old) {
3423 %gep = getelementptr i32, ptr %out, i32 4
3424 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in release acquire
3428 define amdgpu_kernel void @flat_system_acq_rel_acquire_cmpxchg(
3429 ; GFX7-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3430 ; GFX7: ; %bb.0: ; %entry
3431 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3432 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3433 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3434 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3435 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3436 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3437 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3438 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3439 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3440 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3441 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3442 ; GFX7-NEXT: buffer_wbinvl1_vol
3443 ; GFX7-NEXT: s_endpgm
3445 ; GFX10-WGP-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3446 ; GFX10-WGP: ; %bb.0: ; %entry
3447 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3448 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3449 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3450 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3451 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3452 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3453 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3454 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3455 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3456 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3457 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3458 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3459 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3460 ; GFX10-WGP-NEXT: buffer_gl0_inv
3461 ; GFX10-WGP-NEXT: buffer_gl1_inv
3462 ; GFX10-WGP-NEXT: s_endpgm
3464 ; GFX10-CU-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3465 ; GFX10-CU: ; %bb.0: ; %entry
3466 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3467 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3468 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3469 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3470 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3471 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3472 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3473 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3474 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3475 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3476 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3477 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3478 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3479 ; GFX10-CU-NEXT: buffer_gl0_inv
3480 ; GFX10-CU-NEXT: buffer_gl1_inv
3481 ; GFX10-CU-NEXT: s_endpgm
3483 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3484 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3485 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3486 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3487 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3488 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3489 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3490 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3491 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3492 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3493 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3494 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3495 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3496 ; SKIP-CACHE-INV-NEXT: s_endpgm
3498 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3499 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3500 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3501 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3502 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3503 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3504 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3505 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3506 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3507 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3508 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3509 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3510 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3512 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3513 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3514 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3515 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3516 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3517 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3518 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3519 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3520 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3521 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3522 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3523 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3524 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3526 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3527 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3528 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3529 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3530 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3531 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3532 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3533 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3534 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3535 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3536 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3537 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3539 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3540 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3541 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3542 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3543 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3544 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3545 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3546 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3547 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3548 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3549 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3550 ; GFX940-TGSPLIT-NEXT: s_endpgm
3552 ; GFX11-WGP-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3553 ; GFX11-WGP: ; %bb.0: ; %entry
3554 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3555 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3556 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3557 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3558 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3559 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3560 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3561 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3562 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3563 ; GFX11-WGP-NEXT: buffer_gl0_inv
3564 ; GFX11-WGP-NEXT: buffer_gl1_inv
3565 ; GFX11-WGP-NEXT: s_endpgm
3567 ; GFX11-CU-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3568 ; GFX11-CU: ; %bb.0: ; %entry
3569 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3570 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3571 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3572 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3573 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3574 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3575 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3576 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3577 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3578 ; GFX11-CU-NEXT: buffer_gl0_inv
3579 ; GFX11-CU-NEXT: buffer_gl1_inv
3580 ; GFX11-CU-NEXT: s_endpgm
3581 ptr %out, i32 %in, i32 %old) {
3583 %gep = getelementptr i32, ptr %out, i32 4
3584 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acq_rel acquire
3588 define amdgpu_kernel void @flat_system_seq_cst_acquire_cmpxchg(
3589 ; GFX7-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3590 ; GFX7: ; %bb.0: ; %entry
3591 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3592 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3593 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3594 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3595 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3596 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3597 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3598 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3599 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3600 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3601 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3602 ; GFX7-NEXT: buffer_wbinvl1_vol
3603 ; GFX7-NEXT: s_endpgm
3605 ; GFX10-WGP-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3606 ; GFX10-WGP: ; %bb.0: ; %entry
3607 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3608 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3609 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3610 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3611 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3612 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3613 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3614 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3615 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3616 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3617 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3618 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3619 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3620 ; GFX10-WGP-NEXT: buffer_gl0_inv
3621 ; GFX10-WGP-NEXT: buffer_gl1_inv
3622 ; GFX10-WGP-NEXT: s_endpgm
3624 ; GFX10-CU-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3625 ; GFX10-CU: ; %bb.0: ; %entry
3626 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3627 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3628 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3629 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3630 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3631 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3632 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3633 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3634 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3635 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3636 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3637 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3638 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3639 ; GFX10-CU-NEXT: buffer_gl0_inv
3640 ; GFX10-CU-NEXT: buffer_gl1_inv
3641 ; GFX10-CU-NEXT: s_endpgm
3643 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3644 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3645 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3646 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3647 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3648 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3649 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3650 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3651 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3652 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3653 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3654 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3655 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3656 ; SKIP-CACHE-INV-NEXT: s_endpgm
3658 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3659 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3660 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3661 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3662 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3663 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3664 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3665 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3666 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3667 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3668 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3669 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3670 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3672 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3673 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3674 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3675 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3676 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3677 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3678 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3679 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3680 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3681 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3682 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3683 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3684 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3686 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3687 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3688 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3689 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3690 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3691 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3692 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3693 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3694 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3695 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3696 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3697 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3699 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3700 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3701 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3702 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3703 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3704 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3705 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3706 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3707 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3708 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3709 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3710 ; GFX940-TGSPLIT-NEXT: s_endpgm
3712 ; GFX11-WGP-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3713 ; GFX11-WGP: ; %bb.0: ; %entry
3714 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3715 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3716 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3717 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3718 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3719 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3720 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3721 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3722 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3723 ; GFX11-WGP-NEXT: buffer_gl0_inv
3724 ; GFX11-WGP-NEXT: buffer_gl1_inv
3725 ; GFX11-WGP-NEXT: s_endpgm
3727 ; GFX11-CU-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3728 ; GFX11-CU: ; %bb.0: ; %entry
3729 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3730 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3731 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3732 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3733 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3734 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3735 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3736 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3737 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3738 ; GFX11-CU-NEXT: buffer_gl0_inv
3739 ; GFX11-CU-NEXT: buffer_gl1_inv
3740 ; GFX11-CU-NEXT: s_endpgm
3741 ptr %out, i32 %in, i32 %old) {
3743 %gep = getelementptr i32, ptr %out, i32 4
3744 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in seq_cst acquire
3748 define amdgpu_kernel void @flat_system_monotonic_seq_cst_cmpxchg(
3749 ; GFX7-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3750 ; GFX7: ; %bb.0: ; %entry
3751 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3752 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3753 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3754 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3755 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3756 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3757 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3758 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3759 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3760 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3761 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3762 ; GFX7-NEXT: buffer_wbinvl1_vol
3763 ; GFX7-NEXT: s_endpgm
3765 ; GFX10-WGP-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3766 ; GFX10-WGP: ; %bb.0: ; %entry
3767 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3768 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3769 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3770 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3771 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3772 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3773 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3774 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3775 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3776 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3777 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3778 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3779 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3780 ; GFX10-WGP-NEXT: buffer_gl0_inv
3781 ; GFX10-WGP-NEXT: buffer_gl1_inv
3782 ; GFX10-WGP-NEXT: s_endpgm
3784 ; GFX10-CU-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3785 ; GFX10-CU: ; %bb.0: ; %entry
3786 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3787 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3788 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3789 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3790 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3791 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3792 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3793 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3794 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3795 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3796 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3797 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3798 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3799 ; GFX10-CU-NEXT: buffer_gl0_inv
3800 ; GFX10-CU-NEXT: buffer_gl1_inv
3801 ; GFX10-CU-NEXT: s_endpgm
3803 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3804 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3805 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3806 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3807 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3808 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3809 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3810 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3811 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3812 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3813 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3814 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3815 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3816 ; SKIP-CACHE-INV-NEXT: s_endpgm
3818 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3819 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3820 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3821 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3822 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3823 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3824 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3825 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3826 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3827 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3828 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3829 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3830 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3832 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3833 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3834 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3835 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3836 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3837 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3838 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3839 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3840 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3841 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3842 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3843 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3844 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3846 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3847 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3848 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3849 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3850 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3851 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3852 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3853 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3854 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3855 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3856 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3857 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3859 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3860 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3861 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3862 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3863 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3864 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3865 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3866 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3867 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3868 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3869 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3870 ; GFX940-TGSPLIT-NEXT: s_endpgm
3872 ; GFX11-WGP-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3873 ; GFX11-WGP: ; %bb.0: ; %entry
3874 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3875 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3876 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3877 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3878 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3879 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3880 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3881 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3882 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3883 ; GFX11-WGP-NEXT: buffer_gl0_inv
3884 ; GFX11-WGP-NEXT: buffer_gl1_inv
3885 ; GFX11-WGP-NEXT: s_endpgm
3887 ; GFX11-CU-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3888 ; GFX11-CU: ; %bb.0: ; %entry
3889 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3890 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3891 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3892 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3893 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3894 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3895 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3896 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3897 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3898 ; GFX11-CU-NEXT: buffer_gl0_inv
3899 ; GFX11-CU-NEXT: buffer_gl1_inv
3900 ; GFX11-CU-NEXT: s_endpgm
3901 ptr %out, i32 %in, i32 %old) {
3903 %gep = getelementptr i32, ptr %out, i32 4
3904 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in monotonic seq_cst
3908 define amdgpu_kernel void @flat_system_acquire_seq_cst_cmpxchg(
3909 ; GFX7-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3910 ; GFX7: ; %bb.0: ; %entry
3911 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3912 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3913 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3914 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3915 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3916 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3917 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3918 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3919 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3920 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3921 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3922 ; GFX7-NEXT: buffer_wbinvl1_vol
3923 ; GFX7-NEXT: s_endpgm
3925 ; GFX10-WGP-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3926 ; GFX10-WGP: ; %bb.0: ; %entry
3927 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3928 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3929 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3930 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3931 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3932 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3933 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3934 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3935 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3936 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3937 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3938 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3939 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3940 ; GFX10-WGP-NEXT: buffer_gl0_inv
3941 ; GFX10-WGP-NEXT: buffer_gl1_inv
3942 ; GFX10-WGP-NEXT: s_endpgm
3944 ; GFX10-CU-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3945 ; GFX10-CU: ; %bb.0: ; %entry
3946 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3947 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3948 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3949 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3950 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3951 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3952 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3953 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3954 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3955 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3956 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3957 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3958 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3959 ; GFX10-CU-NEXT: buffer_gl0_inv
3960 ; GFX10-CU-NEXT: buffer_gl1_inv
3961 ; GFX10-CU-NEXT: s_endpgm
3963 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3964 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3965 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3966 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3967 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3968 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3969 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3970 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3971 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3972 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3973 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3974 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3975 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3976 ; SKIP-CACHE-INV-NEXT: s_endpgm
3978 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3979 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3980 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3981 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3982 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3983 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3984 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3985 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3986 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3987 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3988 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3989 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3990 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3992 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3993 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3994 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3995 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3996 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3997 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3998 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3999 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4000 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4001 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4002 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4003 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4004 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4006 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4007 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4008 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4009 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4010 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4011 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4012 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4013 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4014 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4015 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4016 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4017 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4019 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4020 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4021 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4022 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4023 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4024 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4025 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4026 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4027 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4028 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4029 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4030 ; GFX940-TGSPLIT-NEXT: s_endpgm
4032 ; GFX11-WGP-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4033 ; GFX11-WGP: ; %bb.0: ; %entry
4034 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4035 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4036 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4037 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4038 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4039 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4040 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4041 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4042 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4043 ; GFX11-WGP-NEXT: buffer_gl0_inv
4044 ; GFX11-WGP-NEXT: buffer_gl1_inv
4045 ; GFX11-WGP-NEXT: s_endpgm
4047 ; GFX11-CU-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4048 ; GFX11-CU: ; %bb.0: ; %entry
4049 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4050 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4051 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4052 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4053 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4054 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4055 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4056 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4057 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4058 ; GFX11-CU-NEXT: buffer_gl0_inv
4059 ; GFX11-CU-NEXT: buffer_gl1_inv
4060 ; GFX11-CU-NEXT: s_endpgm
4061 ptr %out, i32 %in, i32 %old) {
4063 %gep = getelementptr i32, ptr %out, i32 4
4064 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acquire seq_cst
4068 define amdgpu_kernel void @flat_system_release_seq_cst_cmpxchg(
4069 ; GFX7-LABEL: flat_system_release_seq_cst_cmpxchg:
4070 ; GFX7: ; %bb.0: ; %entry
4071 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4072 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4073 ; GFX7-NEXT: s_add_u32 s0, s0, 16
4074 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
4075 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4076 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4077 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4078 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4079 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4080 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4081 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4082 ; GFX7-NEXT: buffer_wbinvl1_vol
4083 ; GFX7-NEXT: s_endpgm
4085 ; GFX10-WGP-LABEL: flat_system_release_seq_cst_cmpxchg:
4086 ; GFX10-WGP: ; %bb.0: ; %entry
4087 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4088 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4089 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
4090 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
4091 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4092 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4093 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4094 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4095 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4096 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4097 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4098 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4099 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4100 ; GFX10-WGP-NEXT: buffer_gl0_inv
4101 ; GFX10-WGP-NEXT: buffer_gl1_inv
4102 ; GFX10-WGP-NEXT: s_endpgm
4104 ; GFX10-CU-LABEL: flat_system_release_seq_cst_cmpxchg:
4105 ; GFX10-CU: ; %bb.0: ; %entry
4106 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4107 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4108 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
4109 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
4110 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4111 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4112 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4113 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4114 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4115 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4116 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4117 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4118 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4119 ; GFX10-CU-NEXT: buffer_gl0_inv
4120 ; GFX10-CU-NEXT: buffer_gl1_inv
4121 ; GFX10-CU-NEXT: s_endpgm
4123 ; SKIP-CACHE-INV-LABEL: flat_system_release_seq_cst_cmpxchg:
4124 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4125 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4126 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4127 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
4128 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
4129 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4130 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4131 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4132 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4133 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4134 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4135 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4136 ; SKIP-CACHE-INV-NEXT: s_endpgm
4138 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_seq_cst_cmpxchg:
4139 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4140 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4141 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4142 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4143 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4144 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4145 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4146 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4147 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4148 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4149 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4150 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4152 ; GFX90A-TGSPLIT-LABEL: flat_system_release_seq_cst_cmpxchg:
4153 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4154 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4155 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4156 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4157 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4158 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4159 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4160 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4161 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4162 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4163 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4164 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4166 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_seq_cst_cmpxchg:
4167 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4168 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4169 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4170 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4171 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4172 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4173 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4174 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4175 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4176 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4177 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4179 ; GFX940-TGSPLIT-LABEL: flat_system_release_seq_cst_cmpxchg:
4180 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4181 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4182 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4183 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4184 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4185 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4186 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4187 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4188 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4189 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4190 ; GFX940-TGSPLIT-NEXT: s_endpgm
4192 ; GFX11-WGP-LABEL: flat_system_release_seq_cst_cmpxchg:
4193 ; GFX11-WGP: ; %bb.0: ; %entry
4194 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4195 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4196 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4197 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4198 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4199 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4200 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4201 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4202 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4203 ; GFX11-WGP-NEXT: buffer_gl0_inv
4204 ; GFX11-WGP-NEXT: buffer_gl1_inv
4205 ; GFX11-WGP-NEXT: s_endpgm
4207 ; GFX11-CU-LABEL: flat_system_release_seq_cst_cmpxchg:
4208 ; GFX11-CU: ; %bb.0: ; %entry
4209 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4210 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4211 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4212 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4213 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4214 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4215 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4216 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4217 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4218 ; GFX11-CU-NEXT: buffer_gl0_inv
4219 ; GFX11-CU-NEXT: buffer_gl1_inv
4220 ; GFX11-CU-NEXT: s_endpgm
4221 ptr %out, i32 %in, i32 %old) {
4223 %gep = getelementptr i32, ptr %out, i32 4
4224 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in release seq_cst
4228 define amdgpu_kernel void @flat_system_acq_rel_seq_cst_cmpxchg(
4229 ; GFX7-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4230 ; GFX7: ; %bb.0: ; %entry
4231 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4232 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4233 ; GFX7-NEXT: s_add_u32 s0, s0, 16
4234 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
4235 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4236 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4237 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4238 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4239 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4240 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4241 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4242 ; GFX7-NEXT: buffer_wbinvl1_vol
4243 ; GFX7-NEXT: s_endpgm
4245 ; GFX10-WGP-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4246 ; GFX10-WGP: ; %bb.0: ; %entry
4247 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4248 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4249 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
4250 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
4251 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4252 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4253 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4254 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4255 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4256 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4257 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4258 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4259 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4260 ; GFX10-WGP-NEXT: buffer_gl0_inv
4261 ; GFX10-WGP-NEXT: buffer_gl1_inv
4262 ; GFX10-WGP-NEXT: s_endpgm
4264 ; GFX10-CU-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4265 ; GFX10-CU: ; %bb.0: ; %entry
4266 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4267 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4268 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
4269 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
4270 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4271 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4272 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4273 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4274 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4275 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4276 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4277 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4278 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4279 ; GFX10-CU-NEXT: buffer_gl0_inv
4280 ; GFX10-CU-NEXT: buffer_gl1_inv
4281 ; GFX10-CU-NEXT: s_endpgm
4283 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4284 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4285 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4286 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4287 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
4288 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
4289 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4290 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4291 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4292 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4293 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4294 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4295 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4296 ; SKIP-CACHE-INV-NEXT: s_endpgm
4298 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4299 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4300 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4301 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4302 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4303 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4304 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4305 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4306 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4307 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4308 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4309 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4310 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4312 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4313 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4314 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4315 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4316 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4317 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4318 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4319 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4320 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4321 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4322 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4323 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4324 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4326 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4327 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4328 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4329 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4330 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4331 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4332 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4333 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4334 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4335 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4336 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4337 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4339 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4340 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4341 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4342 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4343 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4344 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4345 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4346 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4347 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4348 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4349 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4350 ; GFX940-TGSPLIT-NEXT: s_endpgm
4352 ; GFX11-WGP-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4353 ; GFX11-WGP: ; %bb.0: ; %entry
4354 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4355 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4356 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4357 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4358 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4359 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4360 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4361 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4362 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4363 ; GFX11-WGP-NEXT: buffer_gl0_inv
4364 ; GFX11-WGP-NEXT: buffer_gl1_inv
4365 ; GFX11-WGP-NEXT: s_endpgm
4367 ; GFX11-CU-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4368 ; GFX11-CU: ; %bb.0: ; %entry
4369 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4370 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4371 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4372 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4373 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4374 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4375 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4376 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4377 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4378 ; GFX11-CU-NEXT: buffer_gl0_inv
4379 ; GFX11-CU-NEXT: buffer_gl1_inv
4380 ; GFX11-CU-NEXT: s_endpgm
4381 ptr %out, i32 %in, i32 %old) {
4383 %gep = getelementptr i32, ptr %out, i32 4
4384 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acq_rel seq_cst
4388 define amdgpu_kernel void @flat_system_seq_cst_seq_cst_cmpxchg(
4389 ; GFX7-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4390 ; GFX7: ; %bb.0: ; %entry
4391 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4392 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4393 ; GFX7-NEXT: s_add_u32 s0, s0, 16
4394 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
4395 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4396 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4397 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4398 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4399 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4400 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4401 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4402 ; GFX7-NEXT: buffer_wbinvl1_vol
4403 ; GFX7-NEXT: s_endpgm
4405 ; GFX10-WGP-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4406 ; GFX10-WGP: ; %bb.0: ; %entry
4407 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4408 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4409 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
4410 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
4411 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4412 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4413 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4414 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4415 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4416 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4417 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4418 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4419 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4420 ; GFX10-WGP-NEXT: buffer_gl0_inv
4421 ; GFX10-WGP-NEXT: buffer_gl1_inv
4422 ; GFX10-WGP-NEXT: s_endpgm
4424 ; GFX10-CU-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4425 ; GFX10-CU: ; %bb.0: ; %entry
4426 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4427 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4428 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
4429 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
4430 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4431 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4432 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4433 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4434 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4435 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4436 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4437 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4438 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4439 ; GFX10-CU-NEXT: buffer_gl0_inv
4440 ; GFX10-CU-NEXT: buffer_gl1_inv
4441 ; GFX10-CU-NEXT: s_endpgm
4443 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4444 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4445 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4446 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4447 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
4448 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
4449 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4450 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4451 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4452 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4453 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4454 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4455 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4456 ; SKIP-CACHE-INV-NEXT: s_endpgm
4458 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4459 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4460 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4461 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4462 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4463 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4464 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4465 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4466 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4467 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4468 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4469 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4470 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4472 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4473 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4474 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4475 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4476 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4477 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4478 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4479 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4480 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4481 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4482 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4483 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4484 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4486 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4487 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4488 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4489 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4490 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4491 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4492 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4493 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4494 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4495 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4496 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4497 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4499 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4500 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4501 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4502 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4503 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4504 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4505 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4506 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4507 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4508 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4509 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4510 ; GFX940-TGSPLIT-NEXT: s_endpgm
4512 ; GFX11-WGP-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4513 ; GFX11-WGP: ; %bb.0: ; %entry
4514 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4515 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4516 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4517 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4518 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4519 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4520 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4521 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4522 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4523 ; GFX11-WGP-NEXT: buffer_gl0_inv
4524 ; GFX11-WGP-NEXT: buffer_gl1_inv
4525 ; GFX11-WGP-NEXT: s_endpgm
4527 ; GFX11-CU-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4528 ; GFX11-CU: ; %bb.0: ; %entry
4529 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4530 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4531 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4532 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4533 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4534 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4535 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4536 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4537 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4538 ; GFX11-CU-NEXT: buffer_gl0_inv
4539 ; GFX11-CU-NEXT: buffer_gl1_inv
4540 ; GFX11-CU-NEXT: s_endpgm
4541 ptr %out, i32 %in, i32 %old) {
4543 %gep = getelementptr i32, ptr %out, i32 4
4544 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in seq_cst seq_cst
4548 define amdgpu_kernel void @flat_system_monotonic_monotonic_ret_cmpxchg(
4549 ; GFX7-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4550 ; GFX7: ; %bb.0: ; %entry
4551 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4552 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4553 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4554 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4555 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4556 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4557 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4558 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4559 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4560 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4561 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4562 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4563 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4564 ; GFX7-NEXT: s_endpgm
4566 ; GFX10-WGP-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4567 ; GFX10-WGP: ; %bb.0: ; %entry
4568 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4569 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4570 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
4571 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
4572 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
4573 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4574 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4575 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4576 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4577 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4578 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4579 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4580 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
4581 ; GFX10-WGP-NEXT: s_endpgm
4583 ; GFX10-CU-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4584 ; GFX10-CU: ; %bb.0: ; %entry
4585 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4586 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4587 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
4588 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
4589 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
4590 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4591 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4592 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4593 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4594 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4595 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4596 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4597 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
4598 ; GFX10-CU-NEXT: s_endpgm
4600 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4601 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4602 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4603 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4604 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
4605 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
4606 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
4607 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4608 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
4609 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4610 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4611 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4612 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4613 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4614 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
4615 ; SKIP-CACHE-INV-NEXT: s_endpgm
4617 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4618 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4619 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4620 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4621 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4622 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4623 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4624 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4625 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
4626 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4628 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4629 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4630 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4631 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4632 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4633 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4634 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4635 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4636 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
4637 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4639 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4640 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4641 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4642 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4643 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4644 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4645 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4646 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4647 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
4648 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4650 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4651 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4652 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4653 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4654 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4655 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4656 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4657 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4658 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
4659 ; GFX940-TGSPLIT-NEXT: s_endpgm
4661 ; GFX11-WGP-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4662 ; GFX11-WGP: ; %bb.0: ; %entry
4663 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4664 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4665 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4666 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4667 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4668 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4669 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
4670 ; GFX11-WGP-NEXT: s_endpgm
4672 ; GFX11-CU-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4673 ; GFX11-CU: ; %bb.0: ; %entry
4674 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4675 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4676 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4677 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4678 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4679 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4680 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
4681 ; GFX11-CU-NEXT: s_endpgm
4682 ptr %out, i32 %in, i32 %old) {
4684 %gep = getelementptr i32, ptr %out, i32 4
4685 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in monotonic monotonic
4686 %val0 = extractvalue { i32, i1 } %val, 0
4687 store i32 %val0, ptr %out, align 4
4691 define amdgpu_kernel void @flat_system_acquire_monotonic_ret_cmpxchg(
4692 ; GFX7-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4693 ; GFX7: ; %bb.0: ; %entry
4694 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4695 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4696 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4697 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4698 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4699 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4700 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4701 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4702 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4703 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4704 ; GFX7-NEXT: buffer_wbinvl1_vol
4705 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4706 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4707 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4708 ; GFX7-NEXT: s_endpgm
4710 ; GFX10-WGP-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4711 ; GFX10-WGP: ; %bb.0: ; %entry
4712 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4713 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4714 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
4715 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
4716 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
4717 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4718 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4719 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4720 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4721 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4722 ; GFX10-WGP-NEXT: buffer_gl0_inv
4723 ; GFX10-WGP-NEXT: buffer_gl1_inv
4724 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4725 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4726 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
4727 ; GFX10-WGP-NEXT: s_endpgm
4729 ; GFX10-CU-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4730 ; GFX10-CU: ; %bb.0: ; %entry
4731 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4732 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4733 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
4734 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
4735 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
4736 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4737 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4738 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4739 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4740 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4741 ; GFX10-CU-NEXT: buffer_gl0_inv
4742 ; GFX10-CU-NEXT: buffer_gl1_inv
4743 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4744 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4745 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
4746 ; GFX10-CU-NEXT: s_endpgm
4748 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4749 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4750 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4751 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4752 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
4753 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
4754 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
4755 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4756 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
4757 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4758 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4759 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4760 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4761 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4762 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
4763 ; SKIP-CACHE-INV-NEXT: s_endpgm
4765 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4766 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4767 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4768 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4769 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4770 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4771 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4772 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4773 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4774 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4775 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
4776 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4778 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4779 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4780 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4781 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4782 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4783 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4784 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4785 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4786 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4787 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4788 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
4789 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4791 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4792 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4793 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4794 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4795 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4796 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4797 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4798 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4799 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4800 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
4801 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4803 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4804 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4805 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4806 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4807 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4808 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4809 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4810 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4811 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4812 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
4813 ; GFX940-TGSPLIT-NEXT: s_endpgm
4815 ; GFX11-WGP-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4816 ; GFX11-WGP: ; %bb.0: ; %entry
4817 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4818 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4819 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4820 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4821 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4822 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4823 ; GFX11-WGP-NEXT: buffer_gl0_inv
4824 ; GFX11-WGP-NEXT: buffer_gl1_inv
4825 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
4826 ; GFX11-WGP-NEXT: s_endpgm
4828 ; GFX11-CU-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4829 ; GFX11-CU: ; %bb.0: ; %entry
4830 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4831 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4832 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4833 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4834 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4835 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4836 ; GFX11-CU-NEXT: buffer_gl0_inv
4837 ; GFX11-CU-NEXT: buffer_gl1_inv
4838 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
4839 ; GFX11-CU-NEXT: s_endpgm
4840 ptr %out, i32 %in, i32 %old) {
4842 %gep = getelementptr i32, ptr %out, i32 4
4843 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acquire monotonic
4844 %val0 = extractvalue { i32, i1 } %val, 0
4845 store i32 %val0, ptr %out, align 4
4849 define amdgpu_kernel void @flat_system_release_monotonic_ret_cmpxchg(
4850 ; GFX7-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4851 ; GFX7: ; %bb.0: ; %entry
4852 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4853 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4854 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4855 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4856 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4857 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4858 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4859 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4860 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4861 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4862 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4863 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4864 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4865 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4866 ; GFX7-NEXT: s_endpgm
4868 ; GFX10-WGP-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4869 ; GFX10-WGP: ; %bb.0: ; %entry
4870 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4871 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4872 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
4873 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
4874 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
4875 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4876 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4877 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4878 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4879 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4880 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4881 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4882 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4883 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4884 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
4885 ; GFX10-WGP-NEXT: s_endpgm
4887 ; GFX10-CU-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4888 ; GFX10-CU: ; %bb.0: ; %entry
4889 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4890 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4891 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
4892 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
4893 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
4894 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4895 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4896 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4897 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4898 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4899 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4900 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4901 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4902 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4903 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
4904 ; GFX10-CU-NEXT: s_endpgm
4906 ; SKIP-CACHE-INV-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4907 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4908 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4909 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4910 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
4911 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
4912 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
4913 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4914 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
4915 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4916 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4917 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4918 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4919 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4920 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4921 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
4922 ; SKIP-CACHE-INV-NEXT: s_endpgm
4924 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4925 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4926 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4927 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4928 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4929 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4930 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4931 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4932 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4933 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4934 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
4935 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4937 ; GFX90A-TGSPLIT-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4938 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4939 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4940 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4941 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4942 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4943 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4944 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4945 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4946 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4947 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
4948 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4950 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4951 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4952 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4953 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4954 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4955 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4956 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4957 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4958 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4959 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4960 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
4961 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4963 ; GFX940-TGSPLIT-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4964 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4965 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4966 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4967 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4968 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4969 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4970 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4971 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4972 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4973 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
4974 ; GFX940-TGSPLIT-NEXT: s_endpgm
4976 ; GFX11-WGP-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4977 ; GFX11-WGP: ; %bb.0: ; %entry
4978 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4979 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4980 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4981 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4982 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4983 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4984 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4985 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4986 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
4987 ; GFX11-WGP-NEXT: s_endpgm
4989 ; GFX11-CU-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4990 ; GFX11-CU: ; %bb.0: ; %entry
4991 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4992 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4993 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4994 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4995 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4996 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4997 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4998 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4999 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5000 ; GFX11-CU-NEXT: s_endpgm
5001 ptr %out, i32 %in, i32 %old) {
5003 %gep = getelementptr i32, ptr %out, i32 4
5004 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in release monotonic
5005 %val0 = extractvalue { i32, i1 } %val, 0
5006 store i32 %val0, ptr %out, align 4
5010 define amdgpu_kernel void @flat_system_acq_rel_monotonic_ret_cmpxchg(
5011 ; GFX7-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5012 ; GFX7: ; %bb.0: ; %entry
5013 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5014 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5015 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5016 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5017 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5018 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5019 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5020 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5021 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5022 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5023 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5024 ; GFX7-NEXT: buffer_wbinvl1_vol
5025 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5026 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5027 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5028 ; GFX7-NEXT: s_endpgm
5030 ; GFX10-WGP-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5031 ; GFX10-WGP: ; %bb.0: ; %entry
5032 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5033 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5034 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5035 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5036 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5037 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5038 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5039 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5040 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5041 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5042 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5043 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5044 ; GFX10-WGP-NEXT: buffer_gl0_inv
5045 ; GFX10-WGP-NEXT: buffer_gl1_inv
5046 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5047 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5048 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5049 ; GFX10-WGP-NEXT: s_endpgm
5051 ; GFX10-CU-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5052 ; GFX10-CU: ; %bb.0: ; %entry
5053 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5054 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5055 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5056 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5057 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5058 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5059 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5060 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5061 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5062 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5063 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5064 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5065 ; GFX10-CU-NEXT: buffer_gl0_inv
5066 ; GFX10-CU-NEXT: buffer_gl1_inv
5067 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5068 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5069 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5070 ; GFX10-CU-NEXT: s_endpgm
5072 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5073 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5074 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5075 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5076 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5077 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5078 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5079 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5080 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5081 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5082 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5083 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5084 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5085 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5086 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5087 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5088 ; SKIP-CACHE-INV-NEXT: s_endpgm
5090 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5091 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5092 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5093 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5094 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5095 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5096 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5097 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5098 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5099 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5100 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5101 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5102 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5103 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5105 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5106 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5107 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5108 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5109 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5110 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5111 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5112 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5113 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5114 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5115 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5116 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5117 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5118 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5120 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5121 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5122 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5123 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5124 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5125 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5126 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5127 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5128 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5129 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5130 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5131 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5132 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5134 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5135 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5136 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5137 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5138 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5139 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5140 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5141 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5142 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5143 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5144 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5145 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5146 ; GFX940-TGSPLIT-NEXT: s_endpgm
5148 ; GFX11-WGP-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5149 ; GFX11-WGP: ; %bb.0: ; %entry
5150 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5151 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5152 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5153 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5154 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5155 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5156 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5157 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5158 ; GFX11-WGP-NEXT: buffer_gl0_inv
5159 ; GFX11-WGP-NEXT: buffer_gl1_inv
5160 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5161 ; GFX11-WGP-NEXT: s_endpgm
5163 ; GFX11-CU-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5164 ; GFX11-CU: ; %bb.0: ; %entry
5165 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5166 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5167 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5168 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5169 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5170 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5171 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5172 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5173 ; GFX11-CU-NEXT: buffer_gl0_inv
5174 ; GFX11-CU-NEXT: buffer_gl1_inv
5175 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5176 ; GFX11-CU-NEXT: s_endpgm
5177 ptr %out, i32 %in, i32 %old) {
5179 %gep = getelementptr i32, ptr %out, i32 4
5180 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acq_rel monotonic
5181 %val0 = extractvalue { i32, i1 } %val, 0
5182 store i32 %val0, ptr %out, align 4
5186 define amdgpu_kernel void @flat_system_seq_cst_monotonic_ret_cmpxchg(
5187 ; GFX7-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5188 ; GFX7: ; %bb.0: ; %entry
5189 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5190 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5191 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5192 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5193 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5194 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5195 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5196 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5197 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5198 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5199 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5200 ; GFX7-NEXT: buffer_wbinvl1_vol
5201 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5202 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5203 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5204 ; GFX7-NEXT: s_endpgm
5206 ; GFX10-WGP-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5207 ; GFX10-WGP: ; %bb.0: ; %entry
5208 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5209 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5210 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5211 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5212 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5213 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5214 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5215 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5216 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5217 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5218 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5219 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5220 ; GFX10-WGP-NEXT: buffer_gl0_inv
5221 ; GFX10-WGP-NEXT: buffer_gl1_inv
5222 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5223 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5224 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5225 ; GFX10-WGP-NEXT: s_endpgm
5227 ; GFX10-CU-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5228 ; GFX10-CU: ; %bb.0: ; %entry
5229 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5230 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5231 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5232 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5233 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5234 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5235 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5236 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5237 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5238 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5239 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5240 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5241 ; GFX10-CU-NEXT: buffer_gl0_inv
5242 ; GFX10-CU-NEXT: buffer_gl1_inv
5243 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5244 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5245 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5246 ; GFX10-CU-NEXT: s_endpgm
5248 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5249 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5250 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5251 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5252 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5253 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5254 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5255 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5256 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5257 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5258 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5259 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5260 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5261 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5262 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5263 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5264 ; SKIP-CACHE-INV-NEXT: s_endpgm
5266 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5267 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5268 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5269 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5270 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5271 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5272 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5273 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5274 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5275 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5276 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5277 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5278 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5279 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5281 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5282 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5283 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5284 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5285 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5286 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5287 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5288 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5289 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5290 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5291 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5292 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5293 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5294 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5296 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5297 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5298 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5299 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5300 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5301 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5302 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5303 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5304 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5305 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5306 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5307 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5308 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5310 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5311 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5312 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5313 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5314 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5315 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5316 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5317 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5318 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5319 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5320 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5321 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5322 ; GFX940-TGSPLIT-NEXT: s_endpgm
5324 ; GFX11-WGP-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5325 ; GFX11-WGP: ; %bb.0: ; %entry
5326 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5327 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5328 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5329 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5330 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5331 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5332 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5333 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5334 ; GFX11-WGP-NEXT: buffer_gl0_inv
5335 ; GFX11-WGP-NEXT: buffer_gl1_inv
5336 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5337 ; GFX11-WGP-NEXT: s_endpgm
5339 ; GFX11-CU-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5340 ; GFX11-CU: ; %bb.0: ; %entry
5341 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5342 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5343 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5344 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5345 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5346 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5347 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5348 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5349 ; GFX11-CU-NEXT: buffer_gl0_inv
5350 ; GFX11-CU-NEXT: buffer_gl1_inv
5351 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5352 ; GFX11-CU-NEXT: s_endpgm
5353 ptr %out, i32 %in, i32 %old) {
5355 %gep = getelementptr i32, ptr %out, i32 4
5356 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in seq_cst monotonic
5357 %val0 = extractvalue { i32, i1 } %val, 0
5358 store i32 %val0, ptr %out, align 4
5362 define amdgpu_kernel void @flat_system_monotonic_acquire_ret_cmpxchg(
5363 ; GFX7-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5364 ; GFX7: ; %bb.0: ; %entry
5365 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5366 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5367 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5368 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5369 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5370 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5371 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5372 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5373 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5374 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5375 ; GFX7-NEXT: buffer_wbinvl1_vol
5376 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5377 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5378 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5379 ; GFX7-NEXT: s_endpgm
5381 ; GFX10-WGP-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5382 ; GFX10-WGP: ; %bb.0: ; %entry
5383 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5384 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5385 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5386 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5387 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5388 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5389 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5390 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5391 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5392 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5393 ; GFX10-WGP-NEXT: buffer_gl0_inv
5394 ; GFX10-WGP-NEXT: buffer_gl1_inv
5395 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5396 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5397 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5398 ; GFX10-WGP-NEXT: s_endpgm
5400 ; GFX10-CU-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5401 ; GFX10-CU: ; %bb.0: ; %entry
5402 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5403 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5404 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5405 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5406 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5407 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5408 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5409 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5410 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5411 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5412 ; GFX10-CU-NEXT: buffer_gl0_inv
5413 ; GFX10-CU-NEXT: buffer_gl1_inv
5414 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5415 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5416 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5417 ; GFX10-CU-NEXT: s_endpgm
5419 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5420 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5421 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5422 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5423 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5424 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5425 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5426 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5427 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5428 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5429 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5430 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5431 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5432 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5433 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5434 ; SKIP-CACHE-INV-NEXT: s_endpgm
5436 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5437 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5438 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5439 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5440 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5441 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5442 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5443 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5444 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5445 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5446 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5447 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5449 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5450 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5451 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5452 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5453 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5454 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5455 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5456 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5457 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5458 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5459 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5460 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5462 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5463 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5464 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5465 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5466 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5467 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5468 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5469 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5470 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5471 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5472 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5474 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5475 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5476 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5477 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5478 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5479 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5480 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5481 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5482 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5483 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5484 ; GFX940-TGSPLIT-NEXT: s_endpgm
5486 ; GFX11-WGP-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5487 ; GFX11-WGP: ; %bb.0: ; %entry
5488 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5489 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5490 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5491 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5492 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5493 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5494 ; GFX11-WGP-NEXT: buffer_gl0_inv
5495 ; GFX11-WGP-NEXT: buffer_gl1_inv
5496 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5497 ; GFX11-WGP-NEXT: s_endpgm
5499 ; GFX11-CU-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5500 ; GFX11-CU: ; %bb.0: ; %entry
5501 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5502 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5503 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5504 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5505 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5506 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5507 ; GFX11-CU-NEXT: buffer_gl0_inv
5508 ; GFX11-CU-NEXT: buffer_gl1_inv
5509 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5510 ; GFX11-CU-NEXT: s_endpgm
5511 ptr %out, i32 %in, i32 %old) {
5513 %gep = getelementptr i32, ptr %out, i32 4
5514 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in monotonic acquire
5515 %val0 = extractvalue { i32, i1 } %val, 0
5516 store i32 %val0, ptr %out, align 4
5520 define amdgpu_kernel void @flat_system_acquire_acquire_ret_cmpxchg(
5521 ; GFX7-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5522 ; GFX7: ; %bb.0: ; %entry
5523 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5524 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5525 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5526 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5527 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5528 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5529 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5530 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5531 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5532 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5533 ; GFX7-NEXT: buffer_wbinvl1_vol
5534 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5535 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5536 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5537 ; GFX7-NEXT: s_endpgm
5539 ; GFX10-WGP-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5540 ; GFX10-WGP: ; %bb.0: ; %entry
5541 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5542 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5543 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5544 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5545 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5546 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5547 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5548 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5549 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5550 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5551 ; GFX10-WGP-NEXT: buffer_gl0_inv
5552 ; GFX10-WGP-NEXT: buffer_gl1_inv
5553 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5554 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5555 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5556 ; GFX10-WGP-NEXT: s_endpgm
5558 ; GFX10-CU-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5559 ; GFX10-CU: ; %bb.0: ; %entry
5560 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5561 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5562 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5563 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5564 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5565 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5566 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5567 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5568 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5569 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5570 ; GFX10-CU-NEXT: buffer_gl0_inv
5571 ; GFX10-CU-NEXT: buffer_gl1_inv
5572 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5573 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5574 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5575 ; GFX10-CU-NEXT: s_endpgm
5577 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5578 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5579 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5580 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5581 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5582 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5583 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5584 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5585 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5586 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5587 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5588 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5589 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5590 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5591 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5592 ; SKIP-CACHE-INV-NEXT: s_endpgm
5594 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5595 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5596 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5597 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5598 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5599 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5600 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5601 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5602 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5603 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5604 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5605 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5607 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5608 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5609 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5610 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5611 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5612 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5613 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5614 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5615 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5616 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5617 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5618 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5620 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5621 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5622 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5623 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5624 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5625 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5626 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5627 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5628 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5629 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5630 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5632 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5633 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5634 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5635 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5636 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5637 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5638 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5639 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5640 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5641 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5642 ; GFX940-TGSPLIT-NEXT: s_endpgm
5644 ; GFX11-WGP-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5645 ; GFX11-WGP: ; %bb.0: ; %entry
5646 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5647 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5648 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5649 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5650 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5651 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5652 ; GFX11-WGP-NEXT: buffer_gl0_inv
5653 ; GFX11-WGP-NEXT: buffer_gl1_inv
5654 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5655 ; GFX11-WGP-NEXT: s_endpgm
5657 ; GFX11-CU-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5658 ; GFX11-CU: ; %bb.0: ; %entry
5659 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5660 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5661 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5662 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5663 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5664 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5665 ; GFX11-CU-NEXT: buffer_gl0_inv
5666 ; GFX11-CU-NEXT: buffer_gl1_inv
5667 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5668 ; GFX11-CU-NEXT: s_endpgm
5669 ptr %out, i32 %in, i32 %old) {
5671 %gep = getelementptr i32, ptr %out, i32 4
5672 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acquire acquire
5673 %val0 = extractvalue { i32, i1 } %val, 0
5674 store i32 %val0, ptr %out, align 4
5678 define amdgpu_kernel void @flat_system_release_acquire_ret_cmpxchg(
5679 ; GFX7-LABEL: flat_system_release_acquire_ret_cmpxchg:
5680 ; GFX7: ; %bb.0: ; %entry
5681 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5682 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5683 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5684 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5685 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5686 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5687 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5688 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5689 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5690 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5691 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5692 ; GFX7-NEXT: buffer_wbinvl1_vol
5693 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5694 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5695 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5696 ; GFX7-NEXT: s_endpgm
5698 ; GFX10-WGP-LABEL: flat_system_release_acquire_ret_cmpxchg:
5699 ; GFX10-WGP: ; %bb.0: ; %entry
5700 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5701 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5702 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5703 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5704 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5705 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5706 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5707 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5708 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5709 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5710 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5711 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5712 ; GFX10-WGP-NEXT: buffer_gl0_inv
5713 ; GFX10-WGP-NEXT: buffer_gl1_inv
5714 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5715 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5716 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5717 ; GFX10-WGP-NEXT: s_endpgm
5719 ; GFX10-CU-LABEL: flat_system_release_acquire_ret_cmpxchg:
5720 ; GFX10-CU: ; %bb.0: ; %entry
5721 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5722 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5723 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5724 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5725 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5726 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5727 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5728 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5729 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5730 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5731 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5732 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5733 ; GFX10-CU-NEXT: buffer_gl0_inv
5734 ; GFX10-CU-NEXT: buffer_gl1_inv
5735 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5736 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5737 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5738 ; GFX10-CU-NEXT: s_endpgm
5740 ; SKIP-CACHE-INV-LABEL: flat_system_release_acquire_ret_cmpxchg:
5741 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5742 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5743 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5744 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5745 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5746 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5747 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5748 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5749 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5750 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5751 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5752 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5753 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5754 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5755 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5756 ; SKIP-CACHE-INV-NEXT: s_endpgm
5758 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_acquire_ret_cmpxchg:
5759 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5760 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5761 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5762 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5763 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5764 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5765 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5766 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5767 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5768 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5769 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5770 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5771 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5773 ; GFX90A-TGSPLIT-LABEL: flat_system_release_acquire_ret_cmpxchg:
5774 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5775 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5776 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5777 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5778 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5779 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5780 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5781 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5782 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5783 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5784 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5785 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5786 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5788 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_acquire_ret_cmpxchg:
5789 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5790 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5791 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5792 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5793 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5794 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5795 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5796 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5797 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5798 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5799 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5800 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5802 ; GFX940-TGSPLIT-LABEL: flat_system_release_acquire_ret_cmpxchg:
5803 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5804 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5805 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5806 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5807 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5808 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5809 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5810 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5811 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5812 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5813 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5814 ; GFX940-TGSPLIT-NEXT: s_endpgm
5816 ; GFX11-WGP-LABEL: flat_system_release_acquire_ret_cmpxchg:
5817 ; GFX11-WGP: ; %bb.0: ; %entry
5818 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5819 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5820 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5821 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5822 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5823 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5824 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5825 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5826 ; GFX11-WGP-NEXT: buffer_gl0_inv
5827 ; GFX11-WGP-NEXT: buffer_gl1_inv
5828 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5829 ; GFX11-WGP-NEXT: s_endpgm
5831 ; GFX11-CU-LABEL: flat_system_release_acquire_ret_cmpxchg:
5832 ; GFX11-CU: ; %bb.0: ; %entry
5833 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5834 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5835 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5836 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5837 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5838 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5839 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5840 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5841 ; GFX11-CU-NEXT: buffer_gl0_inv
5842 ; GFX11-CU-NEXT: buffer_gl1_inv
5843 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5844 ; GFX11-CU-NEXT: s_endpgm
5845 ptr %out, i32 %in, i32 %old) {
5847 %gep = getelementptr i32, ptr %out, i32 4
5848 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in release acquire
5849 %val0 = extractvalue { i32, i1 } %val, 0
5850 store i32 %val0, ptr %out, align 4
5854 define amdgpu_kernel void @flat_system_acq_rel_acquire_ret_cmpxchg(
5855 ; GFX7-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5856 ; GFX7: ; %bb.0: ; %entry
5857 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5858 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5859 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5860 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5861 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5862 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5863 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5864 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5865 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5866 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5867 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5868 ; GFX7-NEXT: buffer_wbinvl1_vol
5869 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5870 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5871 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5872 ; GFX7-NEXT: s_endpgm
5874 ; GFX10-WGP-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5875 ; GFX10-WGP: ; %bb.0: ; %entry
5876 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5877 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5878 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5879 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5880 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5881 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5882 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5883 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5884 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5885 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5886 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5887 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5888 ; GFX10-WGP-NEXT: buffer_gl0_inv
5889 ; GFX10-WGP-NEXT: buffer_gl1_inv
5890 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5891 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5892 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5893 ; GFX10-WGP-NEXT: s_endpgm
5895 ; GFX10-CU-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5896 ; GFX10-CU: ; %bb.0: ; %entry
5897 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5898 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5899 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5900 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5901 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5902 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5903 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5904 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5905 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5906 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5907 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5908 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5909 ; GFX10-CU-NEXT: buffer_gl0_inv
5910 ; GFX10-CU-NEXT: buffer_gl1_inv
5911 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5912 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5913 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5914 ; GFX10-CU-NEXT: s_endpgm
5916 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5917 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5918 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5919 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5920 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5921 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5922 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5923 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5924 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5925 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5926 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5927 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5928 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5929 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5930 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5931 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5932 ; SKIP-CACHE-INV-NEXT: s_endpgm
5934 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5935 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5936 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5937 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5938 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5939 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5940 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5941 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5942 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5943 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5944 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5945 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5946 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5947 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5949 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5950 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5951 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5952 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5953 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5954 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5955 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5956 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5957 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5958 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5959 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5960 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5961 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5962 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5964 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5965 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5966 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5967 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5968 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5969 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5970 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5971 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5972 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5973 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5974 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5975 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5976 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5978 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5979 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5980 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5981 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5982 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5983 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5984 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5985 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5986 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5987 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5988 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5989 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
5990 ; GFX940-TGSPLIT-NEXT: s_endpgm
5992 ; GFX11-WGP-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5993 ; GFX11-WGP: ; %bb.0: ; %entry
5994 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5995 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5996 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5997 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5998 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5999 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6000 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6001 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6002 ; GFX11-WGP-NEXT: buffer_gl0_inv
6003 ; GFX11-WGP-NEXT: buffer_gl1_inv
6004 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6005 ; GFX11-WGP-NEXT: s_endpgm
6007 ; GFX11-CU-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
6008 ; GFX11-CU: ; %bb.0: ; %entry
6009 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6010 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6011 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6012 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6013 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6014 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6015 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6016 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6017 ; GFX11-CU-NEXT: buffer_gl0_inv
6018 ; GFX11-CU-NEXT: buffer_gl1_inv
6019 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6020 ; GFX11-CU-NEXT: s_endpgm
6021 ptr %out, i32 %in, i32 %old) {
6023 %gep = getelementptr i32, ptr %out, i32 4
6024 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acq_rel acquire
6025 %val0 = extractvalue { i32, i1 } %val, 0
6026 store i32 %val0, ptr %out, align 4
6030 define amdgpu_kernel void @flat_system_seq_cst_acquire_ret_cmpxchg(
6031 ; GFX7-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6032 ; GFX7: ; %bb.0: ; %entry
6033 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6034 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6035 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6036 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6037 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6038 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6039 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6040 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6041 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6042 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6043 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6044 ; GFX7-NEXT: buffer_wbinvl1_vol
6045 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6046 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6047 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6048 ; GFX7-NEXT: s_endpgm
6050 ; GFX10-WGP-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6051 ; GFX10-WGP: ; %bb.0: ; %entry
6052 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6053 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6054 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6055 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6056 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6057 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6058 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6059 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6060 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6061 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6062 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6063 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6064 ; GFX10-WGP-NEXT: buffer_gl0_inv
6065 ; GFX10-WGP-NEXT: buffer_gl1_inv
6066 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6067 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6068 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6069 ; GFX10-WGP-NEXT: s_endpgm
6071 ; GFX10-CU-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6072 ; GFX10-CU: ; %bb.0: ; %entry
6073 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6074 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6075 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6076 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6077 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6078 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6079 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6080 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6081 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6082 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6083 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6084 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6085 ; GFX10-CU-NEXT: buffer_gl0_inv
6086 ; GFX10-CU-NEXT: buffer_gl1_inv
6087 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6088 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6089 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6090 ; GFX10-CU-NEXT: s_endpgm
6092 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6093 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6094 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6095 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6096 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6097 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6098 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6099 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6100 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6101 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6102 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6103 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6104 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6105 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6106 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6107 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6108 ; SKIP-CACHE-INV-NEXT: s_endpgm
6110 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6111 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6112 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6113 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6114 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6115 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6116 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6117 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6118 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6119 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6120 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6121 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6122 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6123 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6125 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6126 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6127 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6128 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6129 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6130 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6131 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6132 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6133 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6134 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6135 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6136 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6137 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6138 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6140 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6141 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6142 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6143 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6144 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6145 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6146 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6147 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6148 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6149 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6150 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6151 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6152 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6154 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6155 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6156 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6157 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6158 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6159 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6160 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6161 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6162 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6163 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6164 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6165 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6166 ; GFX940-TGSPLIT-NEXT: s_endpgm
6168 ; GFX11-WGP-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6169 ; GFX11-WGP: ; %bb.0: ; %entry
6170 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6171 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6172 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6173 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6174 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6175 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6176 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6177 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6178 ; GFX11-WGP-NEXT: buffer_gl0_inv
6179 ; GFX11-WGP-NEXT: buffer_gl1_inv
6180 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6181 ; GFX11-WGP-NEXT: s_endpgm
6183 ; GFX11-CU-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6184 ; GFX11-CU: ; %bb.0: ; %entry
6185 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6186 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6187 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6188 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6189 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6190 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6191 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6192 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6193 ; GFX11-CU-NEXT: buffer_gl0_inv
6194 ; GFX11-CU-NEXT: buffer_gl1_inv
6195 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6196 ; GFX11-CU-NEXT: s_endpgm
6197 ptr %out, i32 %in, i32 %old) {
6199 %gep = getelementptr i32, ptr %out, i32 4
6200 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in seq_cst acquire
6201 %val0 = extractvalue { i32, i1 } %val, 0
6202 store i32 %val0, ptr %out, align 4
6206 define amdgpu_kernel void @flat_system_monotonic_seq_cst_ret_cmpxchg(
6207 ; GFX7-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6208 ; GFX7: ; %bb.0: ; %entry
6209 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6210 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6211 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6212 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6213 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6214 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6215 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6216 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6217 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6218 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6219 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6220 ; GFX7-NEXT: buffer_wbinvl1_vol
6221 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6222 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6223 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6224 ; GFX7-NEXT: s_endpgm
6226 ; GFX10-WGP-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6227 ; GFX10-WGP: ; %bb.0: ; %entry
6228 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6229 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6230 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6231 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6232 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6233 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6234 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6235 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6236 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6237 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6238 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6239 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6240 ; GFX10-WGP-NEXT: buffer_gl0_inv
6241 ; GFX10-WGP-NEXT: buffer_gl1_inv
6242 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6243 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6244 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6245 ; GFX10-WGP-NEXT: s_endpgm
6247 ; GFX10-CU-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6248 ; GFX10-CU: ; %bb.0: ; %entry
6249 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6250 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6251 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6252 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6253 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6254 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6255 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6256 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6257 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6258 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6259 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6260 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6261 ; GFX10-CU-NEXT: buffer_gl0_inv
6262 ; GFX10-CU-NEXT: buffer_gl1_inv
6263 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6264 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6265 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6266 ; GFX10-CU-NEXT: s_endpgm
6268 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6269 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6270 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6271 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6272 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6273 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6274 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6275 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6276 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6277 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6278 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6279 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6280 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6281 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6282 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6283 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6284 ; SKIP-CACHE-INV-NEXT: s_endpgm
6286 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6287 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6288 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6289 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6290 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6291 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6292 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6293 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6294 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6295 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6296 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6297 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6298 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6299 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6301 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6302 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6303 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6304 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6305 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6306 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6307 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6308 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6309 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6310 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6311 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6312 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6313 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6314 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6316 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6317 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6318 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6319 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6320 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6321 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6322 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6323 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6324 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6325 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6326 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6327 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6328 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6330 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6331 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6332 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6333 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6334 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6335 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6336 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6337 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6338 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6339 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6340 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6341 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6342 ; GFX940-TGSPLIT-NEXT: s_endpgm
6344 ; GFX11-WGP-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6345 ; GFX11-WGP: ; %bb.0: ; %entry
6346 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6347 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6348 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6349 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6350 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6351 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6352 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6353 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6354 ; GFX11-WGP-NEXT: buffer_gl0_inv
6355 ; GFX11-WGP-NEXT: buffer_gl1_inv
6356 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6357 ; GFX11-WGP-NEXT: s_endpgm
6359 ; GFX11-CU-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6360 ; GFX11-CU: ; %bb.0: ; %entry
6361 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6362 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6363 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6364 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6365 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6366 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6367 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6368 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6369 ; GFX11-CU-NEXT: buffer_gl0_inv
6370 ; GFX11-CU-NEXT: buffer_gl1_inv
6371 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6372 ; GFX11-CU-NEXT: s_endpgm
6373 ptr %out, i32 %in, i32 %old) {
6375 %gep = getelementptr i32, ptr %out, i32 4
6376 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in monotonic seq_cst
6377 %val0 = extractvalue { i32, i1 } %val, 0
6378 store i32 %val0, ptr %out, align 4
6382 define amdgpu_kernel void @flat_system_acquire_seq_cst_ret_cmpxchg(
6383 ; GFX7-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6384 ; GFX7: ; %bb.0: ; %entry
6385 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6386 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6387 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6388 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6389 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6390 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6391 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6392 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6393 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6394 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6395 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6396 ; GFX7-NEXT: buffer_wbinvl1_vol
6397 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6398 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6399 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6400 ; GFX7-NEXT: s_endpgm
6402 ; GFX10-WGP-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6403 ; GFX10-WGP: ; %bb.0: ; %entry
6404 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6405 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6406 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6407 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6408 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6409 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6410 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6411 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6412 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6413 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6414 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6415 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6416 ; GFX10-WGP-NEXT: buffer_gl0_inv
6417 ; GFX10-WGP-NEXT: buffer_gl1_inv
6418 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6419 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6420 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6421 ; GFX10-WGP-NEXT: s_endpgm
6423 ; GFX10-CU-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6424 ; GFX10-CU: ; %bb.0: ; %entry
6425 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6426 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6427 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6428 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6429 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6430 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6431 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6432 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6433 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6434 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6435 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6436 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6437 ; GFX10-CU-NEXT: buffer_gl0_inv
6438 ; GFX10-CU-NEXT: buffer_gl1_inv
6439 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6440 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6441 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6442 ; GFX10-CU-NEXT: s_endpgm
6444 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6445 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6446 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6447 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6448 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6449 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6450 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6451 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6452 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6453 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6454 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6455 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6456 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6457 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6458 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6459 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6460 ; SKIP-CACHE-INV-NEXT: s_endpgm
6462 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6463 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6464 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6465 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6466 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6467 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6468 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6469 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6470 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6471 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6472 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6473 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6474 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6475 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6477 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6478 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6479 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6480 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6481 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6482 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6483 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6484 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6485 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6486 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6487 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6488 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6489 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6490 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6492 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6493 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6494 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6495 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6496 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6497 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6498 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6499 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6500 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6501 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6502 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6503 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6504 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6506 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6507 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6508 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6509 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6510 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6511 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6512 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6513 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6514 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6515 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6516 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6517 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6518 ; GFX940-TGSPLIT-NEXT: s_endpgm
6520 ; GFX11-WGP-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6521 ; GFX11-WGP: ; %bb.0: ; %entry
6522 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6523 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6524 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6525 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6526 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6527 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6528 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6529 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6530 ; GFX11-WGP-NEXT: buffer_gl0_inv
6531 ; GFX11-WGP-NEXT: buffer_gl1_inv
6532 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6533 ; GFX11-WGP-NEXT: s_endpgm
6535 ; GFX11-CU-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6536 ; GFX11-CU: ; %bb.0: ; %entry
6537 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6538 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6539 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6540 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6541 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6542 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6543 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6544 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6545 ; GFX11-CU-NEXT: buffer_gl0_inv
6546 ; GFX11-CU-NEXT: buffer_gl1_inv
6547 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6548 ; GFX11-CU-NEXT: s_endpgm
6549 ptr %out, i32 %in, i32 %old) {
6551 %gep = getelementptr i32, ptr %out, i32 4
6552 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acquire seq_cst
6553 %val0 = extractvalue { i32, i1 } %val, 0
6554 store i32 %val0, ptr %out, align 4
6558 define amdgpu_kernel void @flat_system_release_seq_cst_ret_cmpxchg(
6559 ; GFX7-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6560 ; GFX7: ; %bb.0: ; %entry
6561 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6562 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6563 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6564 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6565 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6566 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6567 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6568 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6569 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6570 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6571 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6572 ; GFX7-NEXT: buffer_wbinvl1_vol
6573 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6574 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6575 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6576 ; GFX7-NEXT: s_endpgm
6578 ; GFX10-WGP-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6579 ; GFX10-WGP: ; %bb.0: ; %entry
6580 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6581 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6582 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6583 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6584 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6585 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6586 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6587 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6588 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6589 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6590 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6591 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6592 ; GFX10-WGP-NEXT: buffer_gl0_inv
6593 ; GFX10-WGP-NEXT: buffer_gl1_inv
6594 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6595 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6596 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6597 ; GFX10-WGP-NEXT: s_endpgm
6599 ; GFX10-CU-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6600 ; GFX10-CU: ; %bb.0: ; %entry
6601 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6602 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6603 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6604 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6605 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6606 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6607 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6608 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6609 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6610 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6611 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6612 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6613 ; GFX10-CU-NEXT: buffer_gl0_inv
6614 ; GFX10-CU-NEXT: buffer_gl1_inv
6615 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6616 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6617 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6618 ; GFX10-CU-NEXT: s_endpgm
6620 ; SKIP-CACHE-INV-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6621 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6622 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6623 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6624 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6625 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6626 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6627 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6628 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6629 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6630 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6631 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6632 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6633 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6634 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6635 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6636 ; SKIP-CACHE-INV-NEXT: s_endpgm
6638 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6639 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6640 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6641 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6642 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6643 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6644 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6645 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6646 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6647 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6648 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6649 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6650 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6651 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6653 ; GFX90A-TGSPLIT-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6654 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6655 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6656 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6657 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6658 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6659 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6660 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6661 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6662 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6663 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6664 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6665 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6666 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6668 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6669 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6670 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6671 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6672 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6673 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6674 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6675 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6676 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6677 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6678 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6679 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6680 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6682 ; GFX940-TGSPLIT-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6683 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6684 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6685 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6686 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6687 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6688 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6689 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6690 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6691 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6692 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6693 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6694 ; GFX940-TGSPLIT-NEXT: s_endpgm
6696 ; GFX11-WGP-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6697 ; GFX11-WGP: ; %bb.0: ; %entry
6698 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6699 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6700 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6701 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6702 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6703 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6704 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6705 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6706 ; GFX11-WGP-NEXT: buffer_gl0_inv
6707 ; GFX11-WGP-NEXT: buffer_gl1_inv
6708 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6709 ; GFX11-WGP-NEXT: s_endpgm
6711 ; GFX11-CU-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6712 ; GFX11-CU: ; %bb.0: ; %entry
6713 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6714 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6715 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6716 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6717 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6718 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6719 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6720 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6721 ; GFX11-CU-NEXT: buffer_gl0_inv
6722 ; GFX11-CU-NEXT: buffer_gl1_inv
6723 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6724 ; GFX11-CU-NEXT: s_endpgm
6725 ptr %out, i32 %in, i32 %old) {
6727 %gep = getelementptr i32, ptr %out, i32 4
6728 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in release seq_cst
6729 %val0 = extractvalue { i32, i1 } %val, 0
6730 store i32 %val0, ptr %out, align 4
6734 define amdgpu_kernel void @flat_system_acq_rel_seq_cst_ret_cmpxchg(
6735 ; GFX7-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6736 ; GFX7: ; %bb.0: ; %entry
6737 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6738 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6739 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6740 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6741 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6742 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6743 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6744 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6745 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6746 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6747 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6748 ; GFX7-NEXT: buffer_wbinvl1_vol
6749 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6750 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6751 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6752 ; GFX7-NEXT: s_endpgm
6754 ; GFX10-WGP-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6755 ; GFX10-WGP: ; %bb.0: ; %entry
6756 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6757 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6758 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6759 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6760 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6761 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6762 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6763 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6764 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6765 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6766 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6767 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6768 ; GFX10-WGP-NEXT: buffer_gl0_inv
6769 ; GFX10-WGP-NEXT: buffer_gl1_inv
6770 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6771 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6772 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6773 ; GFX10-WGP-NEXT: s_endpgm
6775 ; GFX10-CU-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6776 ; GFX10-CU: ; %bb.0: ; %entry
6777 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6778 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6779 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6780 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6781 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6782 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6783 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6784 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6785 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6786 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6787 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6788 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6789 ; GFX10-CU-NEXT: buffer_gl0_inv
6790 ; GFX10-CU-NEXT: buffer_gl1_inv
6791 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6792 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6793 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6794 ; GFX10-CU-NEXT: s_endpgm
6796 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6797 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6798 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6799 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6800 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6801 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6802 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6803 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6804 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6805 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6806 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6807 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6808 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6809 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6810 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6811 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6812 ; SKIP-CACHE-INV-NEXT: s_endpgm
6814 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6815 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6816 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6817 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6818 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6819 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6820 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6821 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6822 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6823 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6824 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6825 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6826 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6827 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6829 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6830 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6831 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6832 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6833 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6834 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6835 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6836 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6837 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6838 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6839 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6840 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6841 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6842 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6844 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6845 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6846 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6847 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6848 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6849 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6850 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6851 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6852 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6853 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6854 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6855 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6856 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6858 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6859 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6860 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6861 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6862 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6863 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6864 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6865 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6866 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6867 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6868 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6869 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
6870 ; GFX940-TGSPLIT-NEXT: s_endpgm
6872 ; GFX11-WGP-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6873 ; GFX11-WGP: ; %bb.0: ; %entry
6874 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6875 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6876 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6877 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6878 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6879 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6880 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6881 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6882 ; GFX11-WGP-NEXT: buffer_gl0_inv
6883 ; GFX11-WGP-NEXT: buffer_gl1_inv
6884 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6885 ; GFX11-WGP-NEXT: s_endpgm
6887 ; GFX11-CU-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6888 ; GFX11-CU: ; %bb.0: ; %entry
6889 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6890 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6891 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6892 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6893 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6894 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6895 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6896 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6897 ; GFX11-CU-NEXT: buffer_gl0_inv
6898 ; GFX11-CU-NEXT: buffer_gl1_inv
6899 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6900 ; GFX11-CU-NEXT: s_endpgm
6901 ptr %out, i32 %in, i32 %old) {
6903 %gep = getelementptr i32, ptr %out, i32 4
6904 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in acq_rel seq_cst
6905 %val0 = extractvalue { i32, i1 } %val, 0
6906 store i32 %val0, ptr %out, align 4
6910 define amdgpu_kernel void @flat_system_seq_cst_seq_cst_ret_cmpxchg(
6911 ; GFX7-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
6912 ; GFX7: ; %bb.0: ; %entry
6913 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6914 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6915 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6916 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6917 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6918 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6919 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6920 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6921 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6922 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6923 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6924 ; GFX7-NEXT: buffer_wbinvl1_vol
6925 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6926 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6927 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6928 ; GFX7-NEXT: s_endpgm
6930 ; GFX10-WGP-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
6931 ; GFX10-WGP: ; %bb.0: ; %entry
6932 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6933 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6934 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6935 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6936 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6937 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6938 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6939 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6940 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6941 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6942 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6943 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6944 ; GFX10-WGP-NEXT: buffer_gl0_inv
6945 ; GFX10-WGP-NEXT: buffer_gl1_inv
6946 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6947 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6948 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6949 ; GFX10-WGP-NEXT: s_endpgm
6951 ; GFX10-CU-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
6952 ; GFX10-CU: ; %bb.0: ; %entry
6953 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6954 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6955 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6956 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6957 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6958 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6959 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6960 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6961 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6962 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6963 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6964 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6965 ; GFX10-CU-NEXT: buffer_gl0_inv
6966 ; GFX10-CU-NEXT: buffer_gl1_inv
6967 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6968 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6969 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6970 ; GFX10-CU-NEXT: s_endpgm
6972 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
6973 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6974 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6975 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6976 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6977 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6978 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6979 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6980 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6981 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6982 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6983 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6984 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6985 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6986 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6987 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6988 ; SKIP-CACHE-INV-NEXT: s_endpgm
6990 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
6991 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6992 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6993 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6994 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6995 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6996 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6997 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6998 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6999 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7000 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7001 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7002 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7003 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7005 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7006 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7007 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7008 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7009 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7010 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
7011 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
7012 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7013 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
7014 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7015 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7016 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7017 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7018 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7020 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7021 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7022 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7023 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7024 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
7025 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
7026 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7027 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7028 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
7029 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7030 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7031 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7032 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7034 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7035 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7036 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7037 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7038 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
7039 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
7040 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7041 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7042 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
7043 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7044 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7045 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7046 ; GFX940-TGSPLIT-NEXT: s_endpgm
7048 ; GFX11-WGP-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7049 ; GFX11-WGP: ; %bb.0: ; %entry
7050 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7051 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7052 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7053 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
7054 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7055 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7056 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
7057 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7058 ; GFX11-WGP-NEXT: buffer_gl0_inv
7059 ; GFX11-WGP-NEXT: buffer_gl1_inv
7060 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7061 ; GFX11-WGP-NEXT: s_endpgm
7063 ; GFX11-CU-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7064 ; GFX11-CU: ; %bb.0: ; %entry
7065 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7066 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7067 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7068 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
7069 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7070 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
7071 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
7072 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7073 ; GFX11-CU-NEXT: buffer_gl0_inv
7074 ; GFX11-CU-NEXT: buffer_gl1_inv
7075 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7076 ; GFX11-CU-NEXT: s_endpgm
7077 ptr %out, i32 %in, i32 %old) {
7079 %gep = getelementptr i32, ptr %out, i32 4
7080 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in seq_cst seq_cst
7081 %val0 = extractvalue { i32, i1 } %val, 0
7082 store i32 %val0, ptr %out, align 4
7086 define amdgpu_kernel void @flat_system_one_as_unordered_load(
7087 ; GFX7-LABEL: flat_system_one_as_unordered_load:
7088 ; GFX7: ; %bb.0: ; %entry
7089 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7090 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7091 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7092 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7093 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
7094 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
7095 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
7096 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7097 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7098 ; GFX7-NEXT: s_endpgm
7100 ; GFX10-WGP-LABEL: flat_system_one_as_unordered_load:
7101 ; GFX10-WGP: ; %bb.0: ; %entry
7102 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7103 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7104 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7105 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7106 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1]
7107 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
7108 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
7109 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7110 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7111 ; GFX10-WGP-NEXT: s_endpgm
7113 ; GFX10-CU-LABEL: flat_system_one_as_unordered_load:
7114 ; GFX10-CU: ; %bb.0: ; %entry
7115 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7116 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7117 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7118 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7119 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1]
7120 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
7121 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
7122 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7123 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7124 ; GFX10-CU-NEXT: s_endpgm
7126 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_unordered_load:
7127 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7128 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7129 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7130 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7131 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7132 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1]
7133 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7134 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7135 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7136 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7137 ; SKIP-CACHE-INV-NEXT: s_endpgm
7139 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_unordered_load:
7140 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7141 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7142 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7143 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7144 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7145 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1]
7146 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7147 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7148 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7149 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7150 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7152 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_unordered_load:
7153 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7154 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7155 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7156 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7157 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7158 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1]
7159 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7160 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7161 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7162 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7163 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7165 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_unordered_load:
7166 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7167 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7168 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7169 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7170 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7171 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1]
7172 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7173 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7174 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7175 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7176 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7178 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_unordered_load:
7179 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7180 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7181 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7182 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7183 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7184 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1]
7185 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7186 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7187 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7188 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7189 ; GFX940-TGSPLIT-NEXT: s_endpgm
7191 ; GFX11-WGP-LABEL: flat_system_one_as_unordered_load:
7192 ; GFX11-WGP: ; %bb.0: ; %entry
7193 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7194 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7195 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7196 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1]
7197 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7198 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7199 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7200 ; GFX11-WGP-NEXT: s_endpgm
7202 ; GFX11-CU-LABEL: flat_system_one_as_unordered_load:
7203 ; GFX11-CU: ; %bb.0: ; %entry
7204 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7205 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7206 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7207 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1]
7208 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7209 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7210 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7211 ; GFX11-CU-NEXT: s_endpgm
7212 ptr %in, ptr %out) {
7214 %val = load atomic i32, ptr %in syncscope("one-as") unordered, align 4
7215 store i32 %val, ptr %out
7219 define amdgpu_kernel void @flat_system_one_as_monotonic_load(
7220 ; GFX7-LABEL: flat_system_one_as_monotonic_load:
7221 ; GFX7: ; %bb.0: ; %entry
7222 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7223 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7224 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7225 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7226 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
7227 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
7228 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
7229 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7230 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7231 ; GFX7-NEXT: s_endpgm
7233 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_load:
7234 ; GFX10-WGP: ; %bb.0: ; %entry
7235 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7236 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7237 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7238 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7239 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
7240 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
7241 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
7242 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7243 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7244 ; GFX10-WGP-NEXT: s_endpgm
7246 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_load:
7247 ; GFX10-CU: ; %bb.0: ; %entry
7248 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7249 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7250 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7251 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7252 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
7253 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
7254 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
7255 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7256 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7257 ; GFX10-CU-NEXT: s_endpgm
7259 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_load:
7260 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7261 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7262 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7263 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7264 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7265 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
7266 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7267 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7268 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7269 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7270 ; SKIP-CACHE-INV-NEXT: s_endpgm
7272 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_load:
7273 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7274 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7275 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7276 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7277 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7278 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7279 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7280 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7281 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7282 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7283 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7285 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_load:
7286 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7287 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7288 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7289 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7290 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7291 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7292 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7293 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7294 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7295 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7296 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7298 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_load:
7299 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7300 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7301 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7302 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7303 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7304 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7305 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7306 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7307 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7308 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7309 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7311 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_load:
7312 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7313 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7314 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7315 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7316 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7317 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7318 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7319 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7320 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7321 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7322 ; GFX940-TGSPLIT-NEXT: s_endpgm
7324 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_load:
7325 ; GFX11-WGP: ; %bb.0: ; %entry
7326 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7327 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7328 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7329 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
7330 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7331 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7332 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7333 ; GFX11-WGP-NEXT: s_endpgm
7335 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_load:
7336 ; GFX11-CU: ; %bb.0: ; %entry
7337 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7338 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7339 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7340 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
7341 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7342 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7343 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7344 ; GFX11-CU-NEXT: s_endpgm
7345 ptr %in, ptr %out) {
7347 %val = load atomic i32, ptr %in syncscope("one-as") monotonic, align 4
7348 store i32 %val, ptr %out
7352 define amdgpu_kernel void @flat_system_one_as_acquire_load(
7353 ; GFX7-LABEL: flat_system_one_as_acquire_load:
7354 ; GFX7: ; %bb.0: ; %entry
7355 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7356 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7357 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7358 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7359 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
7360 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7361 ; GFX7-NEXT: buffer_wbinvl1_vol
7362 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
7363 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
7364 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7365 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7366 ; GFX7-NEXT: s_endpgm
7368 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_load:
7369 ; GFX10-WGP: ; %bb.0: ; %entry
7370 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7371 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7372 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7373 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7374 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
7375 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7376 ; GFX10-WGP-NEXT: buffer_gl0_inv
7377 ; GFX10-WGP-NEXT: buffer_gl1_inv
7378 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
7379 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
7380 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7381 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7382 ; GFX10-WGP-NEXT: s_endpgm
7384 ; GFX10-CU-LABEL: flat_system_one_as_acquire_load:
7385 ; GFX10-CU: ; %bb.0: ; %entry
7386 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7387 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7388 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7389 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7390 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
7391 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7392 ; GFX10-CU-NEXT: buffer_gl0_inv
7393 ; GFX10-CU-NEXT: buffer_gl1_inv
7394 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
7395 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
7396 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7397 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7398 ; GFX10-CU-NEXT: s_endpgm
7400 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_load:
7401 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7402 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7403 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7404 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7405 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7406 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
7407 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7408 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7409 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7410 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7411 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7412 ; SKIP-CACHE-INV-NEXT: s_endpgm
7414 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_load:
7415 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7416 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7417 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7418 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7419 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7420 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7421 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7422 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7423 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7424 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7425 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7426 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7427 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7428 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7430 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_load:
7431 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7432 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7433 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7434 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7435 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7436 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7437 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7438 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7439 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7440 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7441 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7442 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7443 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7445 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_load:
7446 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7447 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7448 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7449 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7450 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7451 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7452 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7453 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7454 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7455 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7456 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7457 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7458 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7460 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_load:
7461 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7462 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7463 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7464 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7465 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7466 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7467 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7468 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7469 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7470 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7471 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7472 ; GFX940-TGSPLIT-NEXT: s_endpgm
7474 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_load:
7475 ; GFX11-WGP: ; %bb.0: ; %entry
7476 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7477 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7478 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7479 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
7480 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7481 ; GFX11-WGP-NEXT: buffer_gl0_inv
7482 ; GFX11-WGP-NEXT: buffer_gl1_inv
7483 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7484 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7485 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7486 ; GFX11-WGP-NEXT: s_endpgm
7488 ; GFX11-CU-LABEL: flat_system_one_as_acquire_load:
7489 ; GFX11-CU: ; %bb.0: ; %entry
7490 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7491 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7492 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7493 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
7494 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7495 ; GFX11-CU-NEXT: buffer_gl0_inv
7496 ; GFX11-CU-NEXT: buffer_gl1_inv
7497 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7498 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7499 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7500 ; GFX11-CU-NEXT: s_endpgm
7501 ptr %in, ptr %out) {
7503 %val = load atomic i32, ptr %in syncscope("one-as") acquire, align 4
7504 store i32 %val, ptr %out
7508 define amdgpu_kernel void @flat_system_one_as_seq_cst_load(
7509 ; GFX7-LABEL: flat_system_one_as_seq_cst_load:
7510 ; GFX7: ; %bb.0: ; %entry
7511 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7512 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7513 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7514 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7515 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7516 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
7517 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7518 ; GFX7-NEXT: buffer_wbinvl1_vol
7519 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
7520 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
7521 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7522 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7523 ; GFX7-NEXT: s_endpgm
7525 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_load:
7526 ; GFX10-WGP: ; %bb.0: ; %entry
7527 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7528 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7529 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7530 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7531 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7532 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7533 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
7534 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7535 ; GFX10-WGP-NEXT: buffer_gl0_inv
7536 ; GFX10-WGP-NEXT: buffer_gl1_inv
7537 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
7538 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
7539 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7540 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7541 ; GFX10-WGP-NEXT: s_endpgm
7543 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_load:
7544 ; GFX10-CU: ; %bb.0: ; %entry
7545 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7546 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7547 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7548 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7549 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7550 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7551 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
7552 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7553 ; GFX10-CU-NEXT: buffer_gl0_inv
7554 ; GFX10-CU-NEXT: buffer_gl1_inv
7555 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
7556 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
7557 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7558 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7559 ; GFX10-CU-NEXT: s_endpgm
7561 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_load:
7562 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7563 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7564 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7565 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7566 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7567 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7568 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
7569 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7570 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7571 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7572 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7573 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7574 ; SKIP-CACHE-INV-NEXT: s_endpgm
7576 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_load:
7577 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7578 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7579 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7580 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7581 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7582 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7583 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7584 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7585 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7586 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7587 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7588 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7589 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7590 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7591 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7593 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_load:
7594 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7595 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7596 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7597 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7598 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7599 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7600 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7601 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7602 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7603 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7604 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7605 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7606 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7607 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7609 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_load:
7610 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7611 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7612 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7613 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7614 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7615 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7616 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7617 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7618 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7619 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7620 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7621 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7622 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7623 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7625 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_load:
7626 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7627 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7628 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7629 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7630 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7631 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7632 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7633 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7634 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7635 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7636 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7637 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7638 ; GFX940-TGSPLIT-NEXT: s_endpgm
7640 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_load:
7641 ; GFX11-WGP: ; %bb.0: ; %entry
7642 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7643 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7644 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7645 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7646 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7647 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
7648 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7649 ; GFX11-WGP-NEXT: buffer_gl0_inv
7650 ; GFX11-WGP-NEXT: buffer_gl1_inv
7651 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7652 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7653 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7654 ; GFX11-WGP-NEXT: s_endpgm
7656 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_load:
7657 ; GFX11-CU: ; %bb.0: ; %entry
7658 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7659 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7660 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7661 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7662 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
7663 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
7664 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7665 ; GFX11-CU-NEXT: buffer_gl0_inv
7666 ; GFX11-CU-NEXT: buffer_gl1_inv
7667 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7668 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7669 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7670 ; GFX11-CU-NEXT: s_endpgm
7671 ptr %in, ptr %out) {
7673 %val = load atomic i32, ptr %in syncscope("one-as") seq_cst, align 4
7674 store i32 %val, ptr %out
7678 define amdgpu_kernel void @flat_system_one_as_unordered_store(
7679 ; GFX7-LABEL: flat_system_one_as_unordered_store:
7680 ; GFX7: ; %bb.0: ; %entry
7681 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7682 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7683 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7684 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7685 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7686 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7687 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7688 ; GFX7-NEXT: s_endpgm
7690 ; GFX10-WGP-LABEL: flat_system_one_as_unordered_store:
7691 ; GFX10-WGP: ; %bb.0: ; %entry
7692 ; GFX10-WGP-NEXT: s_clause 0x1
7693 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7694 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7695 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7696 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7697 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7698 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
7699 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7700 ; GFX10-WGP-NEXT: s_endpgm
7702 ; GFX10-CU-LABEL: flat_system_one_as_unordered_store:
7703 ; GFX10-CU: ; %bb.0: ; %entry
7704 ; GFX10-CU-NEXT: s_clause 0x1
7705 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7706 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7707 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7708 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7709 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7710 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
7711 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7712 ; GFX10-CU-NEXT: s_endpgm
7714 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_unordered_store:
7715 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7716 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
7717 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
7718 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7719 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7720 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7721 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
7722 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7723 ; SKIP-CACHE-INV-NEXT: s_endpgm
7725 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_unordered_store:
7726 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7727 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7728 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7729 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7730 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7731 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7732 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7733 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7735 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_unordered_store:
7736 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7737 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7738 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7739 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7740 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7741 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7742 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7743 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7745 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_unordered_store:
7746 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7747 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7748 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7749 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7750 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
7751 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
7752 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7753 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7755 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_unordered_store:
7756 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7757 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7758 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7759 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7760 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
7761 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
7762 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7763 ; GFX940-TGSPLIT-NEXT: s_endpgm
7765 ; GFX11-WGP-LABEL: flat_system_one_as_unordered_store:
7766 ; GFX11-WGP: ; %bb.0: ; %entry
7767 ; GFX11-WGP-NEXT: s_clause 0x1
7768 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
7769 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
7770 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7771 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7772 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
7773 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7774 ; GFX11-WGP-NEXT: s_endpgm
7776 ; GFX11-CU-LABEL: flat_system_one_as_unordered_store:
7777 ; GFX11-CU: ; %bb.0: ; %entry
7778 ; GFX11-CU-NEXT: s_clause 0x1
7779 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
7780 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
7781 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7782 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7783 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
7784 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7785 ; GFX11-CU-NEXT: s_endpgm
7786 i32 %in, ptr %out) {
7788 store atomic i32 %in, ptr %out syncscope("one-as") unordered, align 4
7792 define amdgpu_kernel void @flat_system_one_as_monotonic_store(
7793 ; GFX7-LABEL: flat_system_one_as_monotonic_store:
7794 ; GFX7: ; %bb.0: ; %entry
7795 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7796 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7797 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7798 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7799 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7800 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7801 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7802 ; GFX7-NEXT: s_endpgm
7804 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_store:
7805 ; GFX10-WGP: ; %bb.0: ; %entry
7806 ; GFX10-WGP-NEXT: s_clause 0x1
7807 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7808 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7809 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7810 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7811 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7812 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
7813 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7814 ; GFX10-WGP-NEXT: s_endpgm
7816 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_store:
7817 ; GFX10-CU: ; %bb.0: ; %entry
7818 ; GFX10-CU-NEXT: s_clause 0x1
7819 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7820 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7821 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7822 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7823 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7824 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
7825 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7826 ; GFX10-CU-NEXT: s_endpgm
7828 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_store:
7829 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7830 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
7831 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
7832 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7833 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7834 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7835 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
7836 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7837 ; SKIP-CACHE-INV-NEXT: s_endpgm
7839 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_store:
7840 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7841 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7842 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7843 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7844 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7845 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7846 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7847 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7849 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_store:
7850 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7851 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7852 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7853 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7854 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7855 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7856 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7857 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7859 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_store:
7860 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7861 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7862 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7863 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7864 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
7865 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
7866 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7867 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7869 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_store:
7870 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7871 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7872 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7873 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7874 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
7875 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
7876 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7877 ; GFX940-TGSPLIT-NEXT: s_endpgm
7879 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_store:
7880 ; GFX11-WGP: ; %bb.0: ; %entry
7881 ; GFX11-WGP-NEXT: s_clause 0x1
7882 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
7883 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
7884 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7885 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7886 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
7887 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7888 ; GFX11-WGP-NEXT: s_endpgm
7890 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_store:
7891 ; GFX11-CU: ; %bb.0: ; %entry
7892 ; GFX11-CU-NEXT: s_clause 0x1
7893 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
7894 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
7895 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7896 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7897 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
7898 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7899 ; GFX11-CU-NEXT: s_endpgm
7900 i32 %in, ptr %out) {
7902 store atomic i32 %in, ptr %out syncscope("one-as") monotonic, align 4
7906 define amdgpu_kernel void @flat_system_one_as_release_store(
7907 ; GFX7-LABEL: flat_system_one_as_release_store:
7908 ; GFX7: ; %bb.0: ; %entry
7909 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7910 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7911 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7912 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7913 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7914 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7915 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7916 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7917 ; GFX7-NEXT: s_endpgm
7919 ; GFX10-WGP-LABEL: flat_system_one_as_release_store:
7920 ; GFX10-WGP: ; %bb.0: ; %entry
7921 ; GFX10-WGP-NEXT: s_clause 0x1
7922 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7923 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7924 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7925 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7926 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7927 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
7928 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7929 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7930 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7931 ; GFX10-WGP-NEXT: s_endpgm
7933 ; GFX10-CU-LABEL: flat_system_one_as_release_store:
7934 ; GFX10-CU: ; %bb.0: ; %entry
7935 ; GFX10-CU-NEXT: s_clause 0x1
7936 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7937 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7938 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7939 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7940 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7941 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
7942 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7943 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7944 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7945 ; GFX10-CU-NEXT: s_endpgm
7947 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_store:
7948 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7949 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
7950 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
7951 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7952 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7953 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7954 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
7955 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7956 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7957 ; SKIP-CACHE-INV-NEXT: s_endpgm
7959 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_store:
7960 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7961 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7962 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7963 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7964 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7965 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7966 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
7967 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7968 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7969 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7971 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_store:
7972 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7973 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7974 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7975 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7976 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7977 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7978 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
7979 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7980 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7981 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7983 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_store:
7984 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7985 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7986 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7987 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7988 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
7989 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
7990 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7991 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7992 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7993 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7995 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_store:
7996 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7997 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7998 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7999 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8000 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8001 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8002 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8003 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8004 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
8005 ; GFX940-TGSPLIT-NEXT: s_endpgm
8007 ; GFX11-WGP-LABEL: flat_system_one_as_release_store:
8008 ; GFX11-WGP: ; %bb.0: ; %entry
8009 ; GFX11-WGP-NEXT: s_clause 0x1
8010 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
8011 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
8012 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8013 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8014 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8015 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8016 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8017 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
8018 ; GFX11-WGP-NEXT: s_endpgm
8020 ; GFX11-CU-LABEL: flat_system_one_as_release_store:
8021 ; GFX11-CU: ; %bb.0: ; %entry
8022 ; GFX11-CU-NEXT: s_clause 0x1
8023 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
8024 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
8025 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8026 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8027 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8028 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8029 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8030 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
8031 ; GFX11-CU-NEXT: s_endpgm
8032 i32 %in, ptr %out) {
8034 store atomic i32 %in, ptr %out syncscope("one-as") release, align 4
8038 define amdgpu_kernel void @flat_system_one_as_seq_cst_store(
8039 ; GFX7-LABEL: flat_system_one_as_seq_cst_store:
8040 ; GFX7: ; %bb.0: ; %entry
8041 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
8042 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
8043 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8044 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8045 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8046 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8047 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8048 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8049 ; GFX7-NEXT: s_endpgm
8051 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_store:
8052 ; GFX10-WGP: ; %bb.0: ; %entry
8053 ; GFX10-WGP-NEXT: s_clause 0x1
8054 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8055 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
8056 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8057 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8058 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8059 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8060 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8061 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8062 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
8063 ; GFX10-WGP-NEXT: s_endpgm
8065 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_store:
8066 ; GFX10-CU: ; %bb.0: ; %entry
8067 ; GFX10-CU-NEXT: s_clause 0x1
8068 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8069 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
8070 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8071 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8072 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8073 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8074 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8075 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8076 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
8077 ; GFX10-CU-NEXT: s_endpgm
8079 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_store:
8080 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8081 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
8082 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
8083 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8084 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8085 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8086 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8087 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8088 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
8089 ; SKIP-CACHE-INV-NEXT: s_endpgm
8091 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_store:
8092 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8093 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8094 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
8095 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8096 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8097 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8098 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8099 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8100 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
8101 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8103 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_store:
8104 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8105 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8106 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
8107 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8108 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8109 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8110 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8111 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8112 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
8113 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8115 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_store:
8116 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8117 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
8118 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
8119 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8120 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8121 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8122 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8123 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8124 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
8125 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8127 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_store:
8128 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8129 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
8130 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
8131 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8132 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8133 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8134 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8135 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8136 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
8137 ; GFX940-TGSPLIT-NEXT: s_endpgm
8139 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_store:
8140 ; GFX11-WGP: ; %bb.0: ; %entry
8141 ; GFX11-WGP-NEXT: s_clause 0x1
8142 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
8143 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
8144 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8145 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8146 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8147 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8148 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8149 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
8150 ; GFX11-WGP-NEXT: s_endpgm
8152 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_store:
8153 ; GFX11-CU: ; %bb.0: ; %entry
8154 ; GFX11-CU-NEXT: s_clause 0x1
8155 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
8156 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
8157 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8158 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8159 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8160 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8161 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8162 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
8163 ; GFX11-CU-NEXT: s_endpgm
8164 i32 %in, ptr %out) {
8166 store atomic i32 %in, ptr %out syncscope("one-as") seq_cst, align 4
8170 define amdgpu_kernel void @flat_system_one_as_monotonic_atomicrmw(
8171 ; GFX7-LABEL: flat_system_one_as_monotonic_atomicrmw:
8172 ; GFX7: ; %bb.0: ; %entry
8173 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8174 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8175 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8176 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8177 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8178 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8179 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8180 ; GFX7-NEXT: s_endpgm
8182 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_atomicrmw:
8183 ; GFX10-WGP: ; %bb.0: ; %entry
8184 ; GFX10-WGP-NEXT: s_clause 0x1
8185 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8186 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8187 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8188 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8189 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8190 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8191 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8192 ; GFX10-WGP-NEXT: s_endpgm
8194 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_atomicrmw:
8195 ; GFX10-CU: ; %bb.0: ; %entry
8196 ; GFX10-CU-NEXT: s_clause 0x1
8197 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8198 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8199 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8200 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8201 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8202 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8203 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8204 ; GFX10-CU-NEXT: s_endpgm
8206 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_atomicrmw:
8207 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8208 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8209 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8210 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8211 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8212 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8213 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8214 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8215 ; SKIP-CACHE-INV-NEXT: s_endpgm
8217 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_atomicrmw:
8218 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8219 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8220 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8221 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8222 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8223 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8224 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8225 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8227 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_atomicrmw:
8228 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8229 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8230 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8231 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8232 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8233 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8234 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8235 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8237 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_atomicrmw:
8238 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8239 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8240 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8241 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8242 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8243 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8244 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8245 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8247 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_atomicrmw:
8248 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8249 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8250 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8251 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8252 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8253 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8254 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8255 ; GFX940-TGSPLIT-NEXT: s_endpgm
8257 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_atomicrmw:
8258 ; GFX11-WGP: ; %bb.0: ; %entry
8259 ; GFX11-WGP-NEXT: s_clause 0x1
8260 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8261 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8262 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8263 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8264 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8265 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8266 ; GFX11-WGP-NEXT: s_endpgm
8268 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_atomicrmw:
8269 ; GFX11-CU: ; %bb.0: ; %entry
8270 ; GFX11-CU-NEXT: s_clause 0x1
8271 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8272 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8273 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8274 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8275 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8276 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8277 ; GFX11-CU-NEXT: s_endpgm
8278 ptr %out, i32 %in) {
8280 %val = atomicrmw volatile xchg ptr %out, i32 %in syncscope("one-as") monotonic
8284 define amdgpu_kernel void @flat_system_one_as_acquire_atomicrmw(
8285 ; GFX7-LABEL: flat_system_one_as_acquire_atomicrmw:
8286 ; GFX7: ; %bb.0: ; %entry
8287 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8288 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8289 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8290 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8291 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8292 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8293 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8294 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8295 ; GFX7-NEXT: buffer_wbinvl1_vol
8296 ; GFX7-NEXT: s_endpgm
8298 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_atomicrmw:
8299 ; GFX10-WGP: ; %bb.0: ; %entry
8300 ; GFX10-WGP-NEXT: s_clause 0x1
8301 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8302 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8303 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8304 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8305 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8306 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8307 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8308 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8309 ; GFX10-WGP-NEXT: buffer_gl0_inv
8310 ; GFX10-WGP-NEXT: buffer_gl1_inv
8311 ; GFX10-WGP-NEXT: s_endpgm
8313 ; GFX10-CU-LABEL: flat_system_one_as_acquire_atomicrmw:
8314 ; GFX10-CU: ; %bb.0: ; %entry
8315 ; GFX10-CU-NEXT: s_clause 0x1
8316 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8317 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8318 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8319 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8320 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8321 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8322 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8323 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8324 ; GFX10-CU-NEXT: buffer_gl0_inv
8325 ; GFX10-CU-NEXT: buffer_gl1_inv
8326 ; GFX10-CU-NEXT: s_endpgm
8328 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_atomicrmw:
8329 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8330 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8331 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8332 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8333 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8334 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8335 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8336 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8337 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8338 ; SKIP-CACHE-INV-NEXT: s_endpgm
8340 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_atomicrmw:
8341 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8342 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8343 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8344 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8345 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8346 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8347 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8348 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8349 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8350 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8351 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8353 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_atomicrmw:
8354 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8355 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8356 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8357 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8358 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8359 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8360 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8361 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8362 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8363 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8364 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8366 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_atomicrmw:
8367 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8368 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8369 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8370 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8371 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8372 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8373 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8374 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8375 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8376 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8378 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_atomicrmw:
8379 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8380 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8381 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8382 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8383 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8384 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8385 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8386 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8387 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8388 ; GFX940-TGSPLIT-NEXT: s_endpgm
8390 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_atomicrmw:
8391 ; GFX11-WGP: ; %bb.0: ; %entry
8392 ; GFX11-WGP-NEXT: s_clause 0x1
8393 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8394 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8395 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8396 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8397 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8398 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8399 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8400 ; GFX11-WGP-NEXT: buffer_gl0_inv
8401 ; GFX11-WGP-NEXT: buffer_gl1_inv
8402 ; GFX11-WGP-NEXT: s_endpgm
8404 ; GFX11-CU-LABEL: flat_system_one_as_acquire_atomicrmw:
8405 ; GFX11-CU: ; %bb.0: ; %entry
8406 ; GFX11-CU-NEXT: s_clause 0x1
8407 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8408 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8409 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8410 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8411 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8412 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8413 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8414 ; GFX11-CU-NEXT: buffer_gl0_inv
8415 ; GFX11-CU-NEXT: buffer_gl1_inv
8416 ; GFX11-CU-NEXT: s_endpgm
8417 ptr %out, i32 %in) {
8419 %val = atomicrmw volatile xchg ptr %out, i32 %in syncscope("one-as") acquire
8423 define amdgpu_kernel void @flat_system_one_as_release_atomicrmw(
8424 ; GFX7-LABEL: flat_system_one_as_release_atomicrmw:
8425 ; GFX7: ; %bb.0: ; %entry
8426 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8427 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8428 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8429 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8430 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8431 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8432 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8433 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8434 ; GFX7-NEXT: s_endpgm
8436 ; GFX10-WGP-LABEL: flat_system_one_as_release_atomicrmw:
8437 ; GFX10-WGP: ; %bb.0: ; %entry
8438 ; GFX10-WGP-NEXT: s_clause 0x1
8439 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8440 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8441 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8442 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8443 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8444 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8445 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8446 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8447 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8448 ; GFX10-WGP-NEXT: s_endpgm
8450 ; GFX10-CU-LABEL: flat_system_one_as_release_atomicrmw:
8451 ; GFX10-CU: ; %bb.0: ; %entry
8452 ; GFX10-CU-NEXT: s_clause 0x1
8453 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8454 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8455 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8456 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8457 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8458 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8459 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8460 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8461 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8462 ; GFX10-CU-NEXT: s_endpgm
8464 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_atomicrmw:
8465 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8466 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8467 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8468 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8469 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8470 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8471 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8472 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8473 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8474 ; SKIP-CACHE-INV-NEXT: s_endpgm
8476 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_atomicrmw:
8477 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8478 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8479 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8480 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8481 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8482 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8483 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8484 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8485 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8486 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8488 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_atomicrmw:
8489 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8490 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8491 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8492 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8493 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8494 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8495 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8496 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8497 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8498 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8500 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_atomicrmw:
8501 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8502 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8503 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8504 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8505 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8506 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8507 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8508 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8509 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8510 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8512 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_atomicrmw:
8513 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8514 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8515 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8516 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8517 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8518 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8519 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8520 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8521 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8522 ; GFX940-TGSPLIT-NEXT: s_endpgm
8524 ; GFX11-WGP-LABEL: flat_system_one_as_release_atomicrmw:
8525 ; GFX11-WGP: ; %bb.0: ; %entry
8526 ; GFX11-WGP-NEXT: s_clause 0x1
8527 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8528 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8529 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8530 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8531 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8532 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8533 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8534 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8535 ; GFX11-WGP-NEXT: s_endpgm
8537 ; GFX11-CU-LABEL: flat_system_one_as_release_atomicrmw:
8538 ; GFX11-CU: ; %bb.0: ; %entry
8539 ; GFX11-CU-NEXT: s_clause 0x1
8540 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8541 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8542 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8543 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8544 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8545 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8546 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8547 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8548 ; GFX11-CU-NEXT: s_endpgm
8549 ptr %out, i32 %in) {
8551 %val = atomicrmw volatile xchg ptr %out, i32 %in syncscope("one-as") release
8555 define amdgpu_kernel void @flat_system_one_as_acq_rel_atomicrmw(
8556 ; GFX7-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8557 ; GFX7: ; %bb.0: ; %entry
8558 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8559 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8560 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8561 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8562 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8563 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8564 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8565 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8566 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8567 ; GFX7-NEXT: buffer_wbinvl1_vol
8568 ; GFX7-NEXT: s_endpgm
8570 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8571 ; GFX10-WGP: ; %bb.0: ; %entry
8572 ; GFX10-WGP-NEXT: s_clause 0x1
8573 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8574 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8575 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8576 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8577 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8578 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8579 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8580 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8581 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8582 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8583 ; GFX10-WGP-NEXT: buffer_gl0_inv
8584 ; GFX10-WGP-NEXT: buffer_gl1_inv
8585 ; GFX10-WGP-NEXT: s_endpgm
8587 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8588 ; GFX10-CU: ; %bb.0: ; %entry
8589 ; GFX10-CU-NEXT: s_clause 0x1
8590 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8591 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8592 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8593 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8594 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8595 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8596 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8597 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8598 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8599 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8600 ; GFX10-CU-NEXT: buffer_gl0_inv
8601 ; GFX10-CU-NEXT: buffer_gl1_inv
8602 ; GFX10-CU-NEXT: s_endpgm
8604 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8605 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8606 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8607 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8608 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8609 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8610 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8611 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8612 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8613 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8614 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8615 ; SKIP-CACHE-INV-NEXT: s_endpgm
8617 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8618 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8619 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8620 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8621 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8622 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8623 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8624 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8625 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8626 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8627 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8628 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8629 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8630 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8632 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8633 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8634 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8635 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8636 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8637 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8638 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8639 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8640 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8641 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8642 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8643 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8644 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8645 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8647 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8648 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8649 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8650 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8651 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8652 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8653 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8654 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8655 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8656 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8657 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8658 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8659 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8661 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8662 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8663 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8664 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8665 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8666 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8667 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8668 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8669 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8670 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8671 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8672 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8673 ; GFX940-TGSPLIT-NEXT: s_endpgm
8675 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8676 ; GFX11-WGP: ; %bb.0: ; %entry
8677 ; GFX11-WGP-NEXT: s_clause 0x1
8678 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8679 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8680 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8681 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8682 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8683 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8684 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8685 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8686 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8687 ; GFX11-WGP-NEXT: buffer_gl0_inv
8688 ; GFX11-WGP-NEXT: buffer_gl1_inv
8689 ; GFX11-WGP-NEXT: s_endpgm
8691 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8692 ; GFX11-CU: ; %bb.0: ; %entry
8693 ; GFX11-CU-NEXT: s_clause 0x1
8694 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8695 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8696 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8697 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8698 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8699 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8700 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8701 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8702 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8703 ; GFX11-CU-NEXT: buffer_gl0_inv
8704 ; GFX11-CU-NEXT: buffer_gl1_inv
8705 ; GFX11-CU-NEXT: s_endpgm
8706 ptr %out, i32 %in) {
8708 %val = atomicrmw volatile xchg ptr %out, i32 %in syncscope("one-as") acq_rel
8712 define amdgpu_kernel void @flat_system_one_as_seq_cst_atomicrmw(
8713 ; GFX7-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8714 ; GFX7: ; %bb.0: ; %entry
8715 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8716 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8717 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8718 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8719 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8720 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8721 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8722 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8723 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8724 ; GFX7-NEXT: buffer_wbinvl1_vol
8725 ; GFX7-NEXT: s_endpgm
8727 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8728 ; GFX10-WGP: ; %bb.0: ; %entry
8729 ; GFX10-WGP-NEXT: s_clause 0x1
8730 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8731 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8732 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8733 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8734 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8735 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8736 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8737 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8738 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8739 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8740 ; GFX10-WGP-NEXT: buffer_gl0_inv
8741 ; GFX10-WGP-NEXT: buffer_gl1_inv
8742 ; GFX10-WGP-NEXT: s_endpgm
8744 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8745 ; GFX10-CU: ; %bb.0: ; %entry
8746 ; GFX10-CU-NEXT: s_clause 0x1
8747 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8748 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8749 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8750 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8751 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8752 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8753 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8754 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8755 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8756 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8757 ; GFX10-CU-NEXT: buffer_gl0_inv
8758 ; GFX10-CU-NEXT: buffer_gl1_inv
8759 ; GFX10-CU-NEXT: s_endpgm
8761 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8762 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8763 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8764 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8765 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8766 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8767 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8768 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8769 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8770 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8771 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8772 ; SKIP-CACHE-INV-NEXT: s_endpgm
8774 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8775 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8776 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8777 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8778 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8779 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8780 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8781 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8782 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8783 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8784 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8785 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8786 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8787 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8789 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8790 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8791 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8792 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8793 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8794 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8795 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8796 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8797 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8798 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8799 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8800 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8801 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8802 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8804 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8805 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8806 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8807 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8808 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8809 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8810 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8811 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8812 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8813 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8814 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8815 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8816 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8818 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8819 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8820 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8821 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8822 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8823 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8824 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8825 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8826 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8827 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8828 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8829 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8830 ; GFX940-TGSPLIT-NEXT: s_endpgm
8832 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8833 ; GFX11-WGP: ; %bb.0: ; %entry
8834 ; GFX11-WGP-NEXT: s_clause 0x1
8835 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8836 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8837 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8838 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8839 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8840 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8841 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8842 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8843 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8844 ; GFX11-WGP-NEXT: buffer_gl0_inv
8845 ; GFX11-WGP-NEXT: buffer_gl1_inv
8846 ; GFX11-WGP-NEXT: s_endpgm
8848 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8849 ; GFX11-CU: ; %bb.0: ; %entry
8850 ; GFX11-CU-NEXT: s_clause 0x1
8851 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8852 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8853 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8854 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8855 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8856 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8857 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8858 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8859 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8860 ; GFX11-CU-NEXT: buffer_gl0_inv
8861 ; GFX11-CU-NEXT: buffer_gl1_inv
8862 ; GFX11-CU-NEXT: s_endpgm
8863 ptr %out, i32 %in) {
8865 %val = atomicrmw volatile xchg ptr %out, i32 %in syncscope("one-as") seq_cst
8869 define amdgpu_kernel void @flat_system_one_as_acquire_ret_atomicrmw(
8870 ; GFX7-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8871 ; GFX7: ; %bb.0: ; %entry
8872 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8873 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8874 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8875 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8876 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8877 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8878 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8879 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8880 ; GFX7-NEXT: buffer_wbinvl1_vol
8881 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8882 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8883 ; GFX7-NEXT: s_endpgm
8885 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8886 ; GFX10-WGP: ; %bb.0: ; %entry
8887 ; GFX10-WGP-NEXT: s_clause 0x1
8888 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8889 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8890 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8891 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8892 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8893 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8894 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8895 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8896 ; GFX10-WGP-NEXT: buffer_gl0_inv
8897 ; GFX10-WGP-NEXT: buffer_gl1_inv
8898 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8899 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
8900 ; GFX10-WGP-NEXT: s_endpgm
8902 ; GFX10-CU-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8903 ; GFX10-CU: ; %bb.0: ; %entry
8904 ; GFX10-CU-NEXT: s_clause 0x1
8905 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8906 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8907 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8908 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8909 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8910 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8911 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8912 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8913 ; GFX10-CU-NEXT: buffer_gl0_inv
8914 ; GFX10-CU-NEXT: buffer_gl1_inv
8915 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8916 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
8917 ; GFX10-CU-NEXT: s_endpgm
8919 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8920 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8921 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8922 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8923 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8924 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8925 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8926 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8927 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8928 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
8929 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
8930 ; SKIP-CACHE-INV-NEXT: s_endpgm
8932 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8933 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8934 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8935 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8936 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8937 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8938 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8939 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8940 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8941 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8942 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8943 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8944 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
8945 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8947 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8948 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8949 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8950 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8951 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8952 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8953 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8954 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8955 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8956 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8957 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8958 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
8959 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8961 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8962 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8963 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8964 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8965 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8966 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8967 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8968 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
8969 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8970 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8971 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8972 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
8973 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8975 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8976 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8977 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8978 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8979 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8980 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8981 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8982 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
8983 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8984 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8985 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
8986 ; GFX940-TGSPLIT-NEXT: s_endpgm
8988 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8989 ; GFX11-WGP: ; %bb.0: ; %entry
8990 ; GFX11-WGP-NEXT: s_clause 0x1
8991 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8992 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8993 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8994 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8995 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8996 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
8997 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8998 ; GFX11-WGP-NEXT: buffer_gl0_inv
8999 ; GFX11-WGP-NEXT: buffer_gl1_inv
9000 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9001 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
9002 ; GFX11-WGP-NEXT: s_endpgm
9004 ; GFX11-CU-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
9005 ; GFX11-CU: ; %bb.0: ; %entry
9006 ; GFX11-CU-NEXT: s_clause 0x1
9007 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9008 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
9009 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9010 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9011 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
9012 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9013 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9014 ; GFX11-CU-NEXT: buffer_gl0_inv
9015 ; GFX11-CU-NEXT: buffer_gl1_inv
9016 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9017 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
9018 ; GFX11-CU-NEXT: s_endpgm
9019 ptr %out, i32 %in) {
9021 %val = atomicrmw volatile xchg ptr %out, i32 %in syncscope("one-as") acquire
9022 store i32 %val, ptr %out, align 4
9026 define amdgpu_kernel void @flat_system_one_as_acq_rel_ret_atomicrmw(
9027 ; GFX7-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9028 ; GFX7: ; %bb.0: ; %entry
9029 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9030 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
9031 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9032 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9033 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9034 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9035 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9036 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9037 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9038 ; GFX7-NEXT: buffer_wbinvl1_vol
9039 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9040 ; GFX7-NEXT: flat_store_dword v[0:1], v2
9041 ; GFX7-NEXT: s_endpgm
9043 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9044 ; GFX10-WGP: ; %bb.0: ; %entry
9045 ; GFX10-WGP-NEXT: s_clause 0x1
9046 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9047 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
9048 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9049 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9050 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9051 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9052 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9053 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9054 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9055 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9056 ; GFX10-WGP-NEXT: buffer_gl0_inv
9057 ; GFX10-WGP-NEXT: buffer_gl1_inv
9058 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9059 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
9060 ; GFX10-WGP-NEXT: s_endpgm
9062 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9063 ; GFX10-CU: ; %bb.0: ; %entry
9064 ; GFX10-CU-NEXT: s_clause 0x1
9065 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9066 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
9067 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9068 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9069 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9070 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9071 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9072 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9073 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9074 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9075 ; GFX10-CU-NEXT: buffer_gl0_inv
9076 ; GFX10-CU-NEXT: buffer_gl1_inv
9077 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9078 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
9079 ; GFX10-CU-NEXT: s_endpgm
9081 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9082 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9083 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9084 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
9085 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9086 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9087 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9088 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
9089 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9090 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9091 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9092 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
9093 ; SKIP-CACHE-INV-NEXT: s_endpgm
9095 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9096 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9097 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9098 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9099 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9100 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9101 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9102 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9103 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9104 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9105 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9106 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9107 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9108 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9109 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
9110 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9112 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9113 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9114 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9115 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9116 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9117 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9118 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9119 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9120 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9121 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9122 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9123 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9124 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9125 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
9126 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9128 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9129 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9130 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9131 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9132 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9133 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9134 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9135 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9136 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9137 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9138 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9139 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9140 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9141 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
9142 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9144 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9145 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9146 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9147 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9148 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9149 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9150 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9151 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9152 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9153 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9154 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9155 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9156 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
9157 ; GFX940-TGSPLIT-NEXT: s_endpgm
9159 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9160 ; GFX11-WGP: ; %bb.0: ; %entry
9161 ; GFX11-WGP-NEXT: s_clause 0x1
9162 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9163 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
9164 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9165 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9166 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
9167 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9168 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9169 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9170 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9171 ; GFX11-WGP-NEXT: buffer_gl0_inv
9172 ; GFX11-WGP-NEXT: buffer_gl1_inv
9173 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9174 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
9175 ; GFX11-WGP-NEXT: s_endpgm
9177 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9178 ; GFX11-CU: ; %bb.0: ; %entry
9179 ; GFX11-CU-NEXT: s_clause 0x1
9180 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9181 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
9182 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9183 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9184 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
9185 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9186 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9187 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9188 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9189 ; GFX11-CU-NEXT: buffer_gl0_inv
9190 ; GFX11-CU-NEXT: buffer_gl1_inv
9191 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9192 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
9193 ; GFX11-CU-NEXT: s_endpgm
9194 ptr %out, i32 %in) {
9196 %val = atomicrmw volatile xchg ptr %out, i32 %in syncscope("one-as") acq_rel
9197 store i32 %val, ptr %out, align 4
9201 define amdgpu_kernel void @flat_system_one_as_seq_cst_ret_atomicrmw(
9202 ; GFX7-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9203 ; GFX7: ; %bb.0: ; %entry
9204 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9205 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
9206 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9207 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9208 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9209 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9210 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9211 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9212 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9213 ; GFX7-NEXT: buffer_wbinvl1_vol
9214 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9215 ; GFX7-NEXT: flat_store_dword v[0:1], v2
9216 ; GFX7-NEXT: s_endpgm
9218 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9219 ; GFX10-WGP: ; %bb.0: ; %entry
9220 ; GFX10-WGP-NEXT: s_clause 0x1
9221 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9222 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
9223 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9224 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9225 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9226 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9227 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9228 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9229 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9230 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9231 ; GFX10-WGP-NEXT: buffer_gl0_inv
9232 ; GFX10-WGP-NEXT: buffer_gl1_inv
9233 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9234 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
9235 ; GFX10-WGP-NEXT: s_endpgm
9237 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9238 ; GFX10-CU: ; %bb.0: ; %entry
9239 ; GFX10-CU-NEXT: s_clause 0x1
9240 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9241 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
9242 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9243 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9244 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9245 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9246 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9247 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9248 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9249 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9250 ; GFX10-CU-NEXT: buffer_gl0_inv
9251 ; GFX10-CU-NEXT: buffer_gl1_inv
9252 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9253 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
9254 ; GFX10-CU-NEXT: s_endpgm
9256 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9257 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9258 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9259 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
9260 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9261 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9262 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9263 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
9264 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9265 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9266 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9267 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
9268 ; SKIP-CACHE-INV-NEXT: s_endpgm
9270 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9271 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9272 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9273 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9274 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9275 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9276 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9277 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9278 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9279 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9280 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9281 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9282 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9283 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9284 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
9285 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9287 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9288 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9289 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9290 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9291 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9292 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9293 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9294 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9295 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9296 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9297 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9298 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9299 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9300 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
9301 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9303 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9304 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9305 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9306 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9307 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9308 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9309 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9310 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9311 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9312 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9313 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9314 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9315 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9316 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
9317 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9319 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9320 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9321 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9322 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9323 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9324 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9325 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9326 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9327 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9328 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9329 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9330 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9331 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
9332 ; GFX940-TGSPLIT-NEXT: s_endpgm
9334 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9335 ; GFX11-WGP: ; %bb.0: ; %entry
9336 ; GFX11-WGP-NEXT: s_clause 0x1
9337 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9338 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
9339 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9340 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9341 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
9342 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9343 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9344 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9345 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9346 ; GFX11-WGP-NEXT: buffer_gl0_inv
9347 ; GFX11-WGP-NEXT: buffer_gl1_inv
9348 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9349 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
9350 ; GFX11-WGP-NEXT: s_endpgm
9352 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9353 ; GFX11-CU: ; %bb.0: ; %entry
9354 ; GFX11-CU-NEXT: s_clause 0x1
9355 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9356 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
9357 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9358 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9359 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
9360 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9361 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9362 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9363 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9364 ; GFX11-CU-NEXT: buffer_gl0_inv
9365 ; GFX11-CU-NEXT: buffer_gl1_inv
9366 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9367 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
9368 ; GFX11-CU-NEXT: s_endpgm
9369 ptr %out, i32 %in) {
9371 %val = atomicrmw volatile xchg ptr %out, i32 %in syncscope("one-as") seq_cst
9372 store i32 %val, ptr %out, align 4
9376 define amdgpu_kernel void @flat_system_one_as_monotonic_monotonic_cmpxchg(
9377 ; GFX7-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9378 ; GFX7: ; %bb.0: ; %entry
9379 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9380 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9381 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9382 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9383 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9384 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9385 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9386 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9387 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9388 ; GFX7-NEXT: s_endpgm
9390 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9391 ; GFX10-WGP: ; %bb.0: ; %entry
9392 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9393 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9394 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
9395 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
9396 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9397 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9398 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9399 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
9400 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9401 ; GFX10-WGP-NEXT: s_endpgm
9403 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9404 ; GFX10-CU: ; %bb.0: ; %entry
9405 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9406 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9407 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
9408 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
9409 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9410 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9411 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9412 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
9413 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9414 ; GFX10-CU-NEXT: s_endpgm
9416 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9417 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9418 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9419 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9420 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
9421 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
9422 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9423 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
9424 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
9425 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
9426 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9427 ; SKIP-CACHE-INV-NEXT: s_endpgm
9429 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9430 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9431 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9432 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9433 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9434 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9435 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9436 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9438 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9439 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9440 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9441 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9442 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9443 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9444 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9445 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9447 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9448 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9449 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9450 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9451 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9452 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9453 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9454 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9456 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9457 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9458 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9459 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9460 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9461 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9462 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9463 ; GFX940-TGSPLIT-NEXT: s_endpgm
9465 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9466 ; GFX11-WGP: ; %bb.0: ; %entry
9467 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9468 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9469 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9470 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9471 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9472 ; GFX11-WGP-NEXT: s_endpgm
9474 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9475 ; GFX11-CU: ; %bb.0: ; %entry
9476 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9477 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9478 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9479 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9480 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9481 ; GFX11-CU-NEXT: s_endpgm
9482 ptr %out, i32 %in, i32 %old) {
9484 %gep = getelementptr i32, ptr %out, i32 4
9485 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") monotonic monotonic
9489 define amdgpu_kernel void @flat_system_one_as_acquire_monotonic_cmpxchg(
9490 ; GFX7-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9491 ; GFX7: ; %bb.0: ; %entry
9492 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9493 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9494 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9495 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9496 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9497 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9498 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9499 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9500 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9501 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9502 ; GFX7-NEXT: buffer_wbinvl1_vol
9503 ; GFX7-NEXT: s_endpgm
9505 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9506 ; GFX10-WGP: ; %bb.0: ; %entry
9507 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9508 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9509 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
9510 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
9511 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9512 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9513 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9514 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
9515 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9516 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9517 ; GFX10-WGP-NEXT: buffer_gl0_inv
9518 ; GFX10-WGP-NEXT: buffer_gl1_inv
9519 ; GFX10-WGP-NEXT: s_endpgm
9521 ; GFX10-CU-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9522 ; GFX10-CU: ; %bb.0: ; %entry
9523 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9524 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9525 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
9526 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
9527 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9528 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9529 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9530 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
9531 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9532 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9533 ; GFX10-CU-NEXT: buffer_gl0_inv
9534 ; GFX10-CU-NEXT: buffer_gl1_inv
9535 ; GFX10-CU-NEXT: s_endpgm
9537 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9538 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9539 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9540 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9541 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
9542 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
9543 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9544 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
9545 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
9546 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
9547 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9548 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9549 ; SKIP-CACHE-INV-NEXT: s_endpgm
9551 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9552 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9553 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9554 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9555 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9556 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9557 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9558 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9559 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9560 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9561 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9563 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9564 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9565 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9566 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9567 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9568 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9569 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9570 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9571 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9572 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9573 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9575 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9576 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9577 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9578 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9579 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9580 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9581 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9582 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9583 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9584 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9586 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9587 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9588 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9589 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9590 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9591 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9592 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9593 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9594 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9595 ; GFX940-TGSPLIT-NEXT: s_endpgm
9597 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9598 ; GFX11-WGP: ; %bb.0: ; %entry
9599 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9600 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9601 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9602 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9603 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9604 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9605 ; GFX11-WGP-NEXT: buffer_gl0_inv
9606 ; GFX11-WGP-NEXT: buffer_gl1_inv
9607 ; GFX11-WGP-NEXT: s_endpgm
9609 ; GFX11-CU-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9610 ; GFX11-CU: ; %bb.0: ; %entry
9611 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9612 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9613 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9614 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9615 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9616 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9617 ; GFX11-CU-NEXT: buffer_gl0_inv
9618 ; GFX11-CU-NEXT: buffer_gl1_inv
9619 ; GFX11-CU-NEXT: s_endpgm
9620 ptr %out, i32 %in, i32 %old) {
9622 %gep = getelementptr i32, ptr %out, i32 4
9623 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acquire monotonic
9627 define amdgpu_kernel void @flat_system_one_as_release_monotonic_cmpxchg(
9628 ; GFX7-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9629 ; GFX7: ; %bb.0: ; %entry
9630 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9631 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9632 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9633 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9634 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9635 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9636 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9637 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9638 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9639 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9640 ; GFX7-NEXT: s_endpgm
9642 ; GFX10-WGP-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9643 ; GFX10-WGP: ; %bb.0: ; %entry
9644 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9645 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9646 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
9647 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
9648 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9649 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9650 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9651 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
9652 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9653 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9654 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9655 ; GFX10-WGP-NEXT: s_endpgm
9657 ; GFX10-CU-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9658 ; GFX10-CU: ; %bb.0: ; %entry
9659 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9660 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9661 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
9662 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
9663 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9664 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9665 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9666 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
9667 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9668 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9669 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9670 ; GFX10-CU-NEXT: s_endpgm
9672 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9673 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9674 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9675 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9676 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
9677 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
9678 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9679 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
9680 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
9681 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
9682 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9683 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9684 ; SKIP-CACHE-INV-NEXT: s_endpgm
9686 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9687 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9688 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9689 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9690 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9691 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9692 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9693 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9694 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9695 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9697 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9698 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9699 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9700 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9701 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9702 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9703 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9704 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9705 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9706 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9708 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9709 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9710 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9711 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9712 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9713 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9714 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9715 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9716 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9717 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9719 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9720 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9721 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9722 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9723 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9724 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9725 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9726 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9727 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9728 ; GFX940-TGSPLIT-NEXT: s_endpgm
9730 ; GFX11-WGP-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9731 ; GFX11-WGP: ; %bb.0: ; %entry
9732 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9733 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9734 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9735 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9736 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9737 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9738 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9739 ; GFX11-WGP-NEXT: s_endpgm
9741 ; GFX11-CU-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9742 ; GFX11-CU: ; %bb.0: ; %entry
9743 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9744 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9745 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9746 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9747 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9748 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9749 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9750 ; GFX11-CU-NEXT: s_endpgm
9751 ptr %out, i32 %in, i32 %old) {
9753 %gep = getelementptr i32, ptr %out, i32 4
9754 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") release monotonic
9758 define amdgpu_kernel void @flat_system_one_as_acq_rel_monotonic_cmpxchg(
9759 ; GFX7-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9760 ; GFX7: ; %bb.0: ; %entry
9761 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9762 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9763 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9764 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9765 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9766 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9767 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9768 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9769 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9770 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9771 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9772 ; GFX7-NEXT: buffer_wbinvl1_vol
9773 ; GFX7-NEXT: s_endpgm
9775 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9776 ; GFX10-WGP: ; %bb.0: ; %entry
9777 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9778 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9779 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
9780 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
9781 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9782 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9783 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9784 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
9785 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9786 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9787 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9788 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9789 ; GFX10-WGP-NEXT: buffer_gl0_inv
9790 ; GFX10-WGP-NEXT: buffer_gl1_inv
9791 ; GFX10-WGP-NEXT: s_endpgm
9793 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9794 ; GFX10-CU: ; %bb.0: ; %entry
9795 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9796 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9797 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
9798 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
9799 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9800 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9801 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9802 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
9803 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9804 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9805 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9806 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9807 ; GFX10-CU-NEXT: buffer_gl0_inv
9808 ; GFX10-CU-NEXT: buffer_gl1_inv
9809 ; GFX10-CU-NEXT: s_endpgm
9811 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9812 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9813 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9814 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9815 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
9816 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
9817 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9818 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
9819 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
9820 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
9821 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9822 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9823 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9824 ; SKIP-CACHE-INV-NEXT: s_endpgm
9826 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9827 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9828 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9829 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9830 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9831 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9832 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9833 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9834 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9835 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9836 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9837 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9838 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9840 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9841 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9842 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9843 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9844 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9845 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9846 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9847 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9848 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9849 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9850 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9851 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9852 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9854 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9855 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9856 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9857 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9858 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9859 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9860 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9861 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9862 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9863 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9864 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9865 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9867 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9868 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9869 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9870 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9871 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9872 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9873 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9874 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9875 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9876 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9877 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9878 ; GFX940-TGSPLIT-NEXT: s_endpgm
9880 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9881 ; GFX11-WGP: ; %bb.0: ; %entry
9882 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9883 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9884 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9885 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9886 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9887 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9888 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9889 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9890 ; GFX11-WGP-NEXT: buffer_gl0_inv
9891 ; GFX11-WGP-NEXT: buffer_gl1_inv
9892 ; GFX11-WGP-NEXT: s_endpgm
9894 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9895 ; GFX11-CU: ; %bb.0: ; %entry
9896 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9897 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9898 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9899 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9900 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9901 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9902 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9903 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9904 ; GFX11-CU-NEXT: buffer_gl0_inv
9905 ; GFX11-CU-NEXT: buffer_gl1_inv
9906 ; GFX11-CU-NEXT: s_endpgm
9907 ptr %out, i32 %in, i32 %old) {
9909 %gep = getelementptr i32, ptr %out, i32 4
9910 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acq_rel monotonic
9914 define amdgpu_kernel void @flat_system_one_as_seq_cst_monotonic_cmpxchg(
9915 ; GFX7-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
9916 ; GFX7: ; %bb.0: ; %entry
9917 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9918 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9919 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9920 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9921 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9922 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9923 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9924 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9925 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9926 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9927 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9928 ; GFX7-NEXT: buffer_wbinvl1_vol
9929 ; GFX7-NEXT: s_endpgm
9931 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
9932 ; GFX10-WGP: ; %bb.0: ; %entry
9933 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9934 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9935 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
9936 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
9937 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9938 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9939 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9940 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
9941 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9942 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9943 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9944 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9945 ; GFX10-WGP-NEXT: buffer_gl0_inv
9946 ; GFX10-WGP-NEXT: buffer_gl1_inv
9947 ; GFX10-WGP-NEXT: s_endpgm
9949 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
9950 ; GFX10-CU: ; %bb.0: ; %entry
9951 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9952 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9953 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
9954 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
9955 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9956 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9957 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9958 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
9959 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9960 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9961 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9962 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9963 ; GFX10-CU-NEXT: buffer_gl0_inv
9964 ; GFX10-CU-NEXT: buffer_gl1_inv
9965 ; GFX10-CU-NEXT: s_endpgm
9967 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
9968 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9969 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9970 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9971 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
9972 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
9973 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9974 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
9975 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
9976 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
9977 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9978 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9979 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9980 ; SKIP-CACHE-INV-NEXT: s_endpgm
9982 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
9983 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9984 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9985 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9986 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9987 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9988 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9989 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9990 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9991 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9992 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9993 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9994 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9996 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
9997 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9998 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9999 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10000 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10001 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10002 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10003 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10004 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10005 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10006 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10007 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10008 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10010 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10011 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10012 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10013 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10014 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10015 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10016 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10017 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10018 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10019 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10020 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10021 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10023 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10024 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10025 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10026 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10027 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10028 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10029 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10030 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10031 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10032 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10033 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10034 ; GFX940-TGSPLIT-NEXT: s_endpgm
10036 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10037 ; GFX11-WGP: ; %bb.0: ; %entry
10038 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10039 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10040 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10041 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10042 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10043 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10044 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10045 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10046 ; GFX11-WGP-NEXT: buffer_gl0_inv
10047 ; GFX11-WGP-NEXT: buffer_gl1_inv
10048 ; GFX11-WGP-NEXT: s_endpgm
10050 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10051 ; GFX11-CU: ; %bb.0: ; %entry
10052 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10053 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10054 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10055 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10056 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10057 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10058 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10059 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10060 ; GFX11-CU-NEXT: buffer_gl0_inv
10061 ; GFX11-CU-NEXT: buffer_gl1_inv
10062 ; GFX11-CU-NEXT: s_endpgm
10063 ptr %out, i32 %in, i32 %old) {
10065 %gep = getelementptr i32, ptr %out, i32 4
10066 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") seq_cst monotonic
10070 define amdgpu_kernel void @flat_system_one_as_monotonic_acquire_cmpxchg(
10071 ; GFX7-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10072 ; GFX7: ; %bb.0: ; %entry
10073 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10074 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10075 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10076 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10077 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10078 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10079 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10080 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10081 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10082 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10083 ; GFX7-NEXT: buffer_wbinvl1_vol
10084 ; GFX7-NEXT: s_endpgm
10086 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10087 ; GFX10-WGP: ; %bb.0: ; %entry
10088 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10089 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10090 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10091 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10092 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10093 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10094 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10095 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10096 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10097 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10098 ; GFX10-WGP-NEXT: buffer_gl0_inv
10099 ; GFX10-WGP-NEXT: buffer_gl1_inv
10100 ; GFX10-WGP-NEXT: s_endpgm
10102 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10103 ; GFX10-CU: ; %bb.0: ; %entry
10104 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10105 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10106 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10107 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10108 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10109 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10110 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10111 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10112 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10113 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10114 ; GFX10-CU-NEXT: buffer_gl0_inv
10115 ; GFX10-CU-NEXT: buffer_gl1_inv
10116 ; GFX10-CU-NEXT: s_endpgm
10118 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10119 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10120 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10121 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10122 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10123 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10124 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10125 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10126 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10127 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10128 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10129 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10130 ; SKIP-CACHE-INV-NEXT: s_endpgm
10132 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10133 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10134 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10135 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10136 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10137 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10138 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10139 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10140 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10141 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10142 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10144 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10145 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10146 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10147 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10148 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10149 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10150 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10151 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10152 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10153 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10154 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10156 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10157 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10158 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10159 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10160 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10161 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10162 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10163 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10164 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10165 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10167 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10168 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10169 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10170 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10171 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10172 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10173 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10174 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10175 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10176 ; GFX940-TGSPLIT-NEXT: s_endpgm
10178 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10179 ; GFX11-WGP: ; %bb.0: ; %entry
10180 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10181 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10182 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10183 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10184 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10185 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10186 ; GFX11-WGP-NEXT: buffer_gl0_inv
10187 ; GFX11-WGP-NEXT: buffer_gl1_inv
10188 ; GFX11-WGP-NEXT: s_endpgm
10190 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10191 ; GFX11-CU: ; %bb.0: ; %entry
10192 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10193 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10194 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10195 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10196 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10197 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10198 ; GFX11-CU-NEXT: buffer_gl0_inv
10199 ; GFX11-CU-NEXT: buffer_gl1_inv
10200 ; GFX11-CU-NEXT: s_endpgm
10201 ptr %out, i32 %in, i32 %old) {
10203 %gep = getelementptr i32, ptr %out, i32 4
10204 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") monotonic acquire
10208 define amdgpu_kernel void @flat_system_one_as_acquire_acquire_cmpxchg(
10209 ; GFX7-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10210 ; GFX7: ; %bb.0: ; %entry
10211 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10212 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10213 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10214 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10215 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10216 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10217 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10218 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10219 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10220 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10221 ; GFX7-NEXT: buffer_wbinvl1_vol
10222 ; GFX7-NEXT: s_endpgm
10224 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10225 ; GFX10-WGP: ; %bb.0: ; %entry
10226 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10227 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10228 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10229 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10230 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10231 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10232 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10233 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10234 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10235 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10236 ; GFX10-WGP-NEXT: buffer_gl0_inv
10237 ; GFX10-WGP-NEXT: buffer_gl1_inv
10238 ; GFX10-WGP-NEXT: s_endpgm
10240 ; GFX10-CU-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10241 ; GFX10-CU: ; %bb.0: ; %entry
10242 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10243 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10244 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10245 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10246 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10247 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10248 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10249 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10250 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10251 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10252 ; GFX10-CU-NEXT: buffer_gl0_inv
10253 ; GFX10-CU-NEXT: buffer_gl1_inv
10254 ; GFX10-CU-NEXT: s_endpgm
10256 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10257 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10258 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10259 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10260 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10261 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10262 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10263 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10264 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10265 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10266 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10267 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10268 ; SKIP-CACHE-INV-NEXT: s_endpgm
10270 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10271 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10272 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10273 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10274 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10275 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10276 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10277 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10278 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10279 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10280 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10282 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10283 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10284 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10285 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10286 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10287 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10288 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10289 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10290 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10291 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10292 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10294 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10295 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10296 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10297 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10298 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10299 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10300 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10301 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10302 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10303 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10305 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10306 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10307 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10308 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10309 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10310 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10311 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10312 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10313 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10314 ; GFX940-TGSPLIT-NEXT: s_endpgm
10316 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10317 ; GFX11-WGP: ; %bb.0: ; %entry
10318 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10319 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10320 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10321 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10322 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10323 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10324 ; GFX11-WGP-NEXT: buffer_gl0_inv
10325 ; GFX11-WGP-NEXT: buffer_gl1_inv
10326 ; GFX11-WGP-NEXT: s_endpgm
10328 ; GFX11-CU-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10329 ; GFX11-CU: ; %bb.0: ; %entry
10330 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10331 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10332 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10333 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10334 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10335 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10336 ; GFX11-CU-NEXT: buffer_gl0_inv
10337 ; GFX11-CU-NEXT: buffer_gl1_inv
10338 ; GFX11-CU-NEXT: s_endpgm
10339 ptr %out, i32 %in, i32 %old) {
10341 %gep = getelementptr i32, ptr %out, i32 4
10342 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acquire acquire
10346 define amdgpu_kernel void @flat_system_one_as_release_acquire_cmpxchg(
10347 ; GFX7-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10348 ; GFX7: ; %bb.0: ; %entry
10349 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10350 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10351 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10352 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10353 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10354 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10355 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10356 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10357 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10358 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10359 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10360 ; GFX7-NEXT: buffer_wbinvl1_vol
10361 ; GFX7-NEXT: s_endpgm
10363 ; GFX10-WGP-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10364 ; GFX10-WGP: ; %bb.0: ; %entry
10365 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10366 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10367 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10368 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10369 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10370 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10371 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10372 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10373 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10374 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10375 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10376 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10377 ; GFX10-WGP-NEXT: buffer_gl0_inv
10378 ; GFX10-WGP-NEXT: buffer_gl1_inv
10379 ; GFX10-WGP-NEXT: s_endpgm
10381 ; GFX10-CU-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10382 ; GFX10-CU: ; %bb.0: ; %entry
10383 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10384 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10385 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10386 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10387 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10388 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10389 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10390 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10391 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10392 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10393 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10394 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10395 ; GFX10-CU-NEXT: buffer_gl0_inv
10396 ; GFX10-CU-NEXT: buffer_gl1_inv
10397 ; GFX10-CU-NEXT: s_endpgm
10399 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10400 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10401 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10402 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10403 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10404 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10405 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10406 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10407 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10408 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10409 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10410 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10411 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10412 ; SKIP-CACHE-INV-NEXT: s_endpgm
10414 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10415 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10416 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10417 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10418 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10419 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10420 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10421 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10422 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10423 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10424 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10425 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10426 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10428 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10429 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10430 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10431 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10432 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10433 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10434 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10435 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10436 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10437 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10438 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10439 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10440 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10442 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10443 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10444 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10445 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10446 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10447 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10448 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10449 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10450 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10451 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10452 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10453 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10455 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10456 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10457 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10458 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10459 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10460 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10461 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10462 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10463 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10464 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10465 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10466 ; GFX940-TGSPLIT-NEXT: s_endpgm
10468 ; GFX11-WGP-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10469 ; GFX11-WGP: ; %bb.0: ; %entry
10470 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10471 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10472 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10473 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10474 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10475 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10476 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10477 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10478 ; GFX11-WGP-NEXT: buffer_gl0_inv
10479 ; GFX11-WGP-NEXT: buffer_gl1_inv
10480 ; GFX11-WGP-NEXT: s_endpgm
10482 ; GFX11-CU-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10483 ; GFX11-CU: ; %bb.0: ; %entry
10484 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10485 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10486 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10487 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10488 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10489 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10490 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10491 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10492 ; GFX11-CU-NEXT: buffer_gl0_inv
10493 ; GFX11-CU-NEXT: buffer_gl1_inv
10494 ; GFX11-CU-NEXT: s_endpgm
10495 ptr %out, i32 %in, i32 %old) {
10497 %gep = getelementptr i32, ptr %out, i32 4
10498 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") release acquire
10502 define amdgpu_kernel void @flat_system_one_as_acq_rel_acquire_cmpxchg(
10503 ; GFX7-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10504 ; GFX7: ; %bb.0: ; %entry
10505 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10506 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10507 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10508 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10509 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10510 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10511 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10512 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10513 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10514 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10515 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10516 ; GFX7-NEXT: buffer_wbinvl1_vol
10517 ; GFX7-NEXT: s_endpgm
10519 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10520 ; GFX10-WGP: ; %bb.0: ; %entry
10521 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10522 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10523 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10524 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10525 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10526 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10527 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10528 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10529 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10530 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10531 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10532 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10533 ; GFX10-WGP-NEXT: buffer_gl0_inv
10534 ; GFX10-WGP-NEXT: buffer_gl1_inv
10535 ; GFX10-WGP-NEXT: s_endpgm
10537 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10538 ; GFX10-CU: ; %bb.0: ; %entry
10539 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10540 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10541 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10542 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10543 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10544 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10545 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10546 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10547 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10548 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10549 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10550 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10551 ; GFX10-CU-NEXT: buffer_gl0_inv
10552 ; GFX10-CU-NEXT: buffer_gl1_inv
10553 ; GFX10-CU-NEXT: s_endpgm
10555 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10556 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10557 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10558 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10559 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10560 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10561 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10562 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10563 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10564 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10565 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10566 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10567 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10568 ; SKIP-CACHE-INV-NEXT: s_endpgm
10570 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10571 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10572 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10573 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10574 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10575 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10576 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10577 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10578 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10579 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10580 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10581 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10582 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10584 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10585 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10586 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10587 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10588 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10589 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10590 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10591 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10592 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10593 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10594 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10595 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10596 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10598 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10599 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10600 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10601 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10602 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10603 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10604 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10605 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10606 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10607 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10608 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10609 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10611 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10612 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10613 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10614 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10615 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10616 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10617 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10618 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10619 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10620 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10621 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10622 ; GFX940-TGSPLIT-NEXT: s_endpgm
10624 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10625 ; GFX11-WGP: ; %bb.0: ; %entry
10626 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10627 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10628 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10629 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10630 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10631 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10632 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10633 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10634 ; GFX11-WGP-NEXT: buffer_gl0_inv
10635 ; GFX11-WGP-NEXT: buffer_gl1_inv
10636 ; GFX11-WGP-NEXT: s_endpgm
10638 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10639 ; GFX11-CU: ; %bb.0: ; %entry
10640 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10641 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10642 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10643 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10644 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10645 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10646 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10647 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10648 ; GFX11-CU-NEXT: buffer_gl0_inv
10649 ; GFX11-CU-NEXT: buffer_gl1_inv
10650 ; GFX11-CU-NEXT: s_endpgm
10651 ptr %out, i32 %in, i32 %old) {
10653 %gep = getelementptr i32, ptr %out, i32 4
10654 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acq_rel acquire
10658 define amdgpu_kernel void @flat_system_one_as_seq_cst_acquire_cmpxchg(
10659 ; GFX7-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10660 ; GFX7: ; %bb.0: ; %entry
10661 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10662 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10663 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10664 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10665 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10666 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10667 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10668 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10669 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10670 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10671 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10672 ; GFX7-NEXT: buffer_wbinvl1_vol
10673 ; GFX7-NEXT: s_endpgm
10675 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10676 ; GFX10-WGP: ; %bb.0: ; %entry
10677 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10678 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10679 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10680 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10681 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10682 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10683 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10684 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10685 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10686 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10687 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10688 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10689 ; GFX10-WGP-NEXT: buffer_gl0_inv
10690 ; GFX10-WGP-NEXT: buffer_gl1_inv
10691 ; GFX10-WGP-NEXT: s_endpgm
10693 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10694 ; GFX10-CU: ; %bb.0: ; %entry
10695 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10696 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10697 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10698 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10699 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10700 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10701 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10702 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10703 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10704 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10705 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10706 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10707 ; GFX10-CU-NEXT: buffer_gl0_inv
10708 ; GFX10-CU-NEXT: buffer_gl1_inv
10709 ; GFX10-CU-NEXT: s_endpgm
10711 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10712 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10713 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10714 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10715 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10716 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10717 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10718 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10719 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10720 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10721 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10722 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10723 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10724 ; SKIP-CACHE-INV-NEXT: s_endpgm
10726 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10727 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10728 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10729 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10730 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10731 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10732 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10733 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10734 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10735 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10736 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10737 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10738 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10740 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10741 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10742 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10743 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10744 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10745 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10746 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10747 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10748 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10749 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10750 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10751 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10752 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10754 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10755 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10756 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10757 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10758 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10759 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10760 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10761 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10762 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10763 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10764 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10765 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10767 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10768 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10769 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10770 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10771 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10772 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10773 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10774 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10775 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10776 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10777 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10778 ; GFX940-TGSPLIT-NEXT: s_endpgm
10780 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10781 ; GFX11-WGP: ; %bb.0: ; %entry
10782 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10783 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10784 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10785 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10786 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10787 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10788 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10789 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10790 ; GFX11-WGP-NEXT: buffer_gl0_inv
10791 ; GFX11-WGP-NEXT: buffer_gl1_inv
10792 ; GFX11-WGP-NEXT: s_endpgm
10794 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10795 ; GFX11-CU: ; %bb.0: ; %entry
10796 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10797 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10798 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10799 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10800 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10801 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10802 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10803 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10804 ; GFX11-CU-NEXT: buffer_gl0_inv
10805 ; GFX11-CU-NEXT: buffer_gl1_inv
10806 ; GFX11-CU-NEXT: s_endpgm
10807 ptr %out, i32 %in, i32 %old) {
10809 %gep = getelementptr i32, ptr %out, i32 4
10810 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") seq_cst acquire
10814 define amdgpu_kernel void @flat_system_one_as_monotonic_seq_cst_cmpxchg(
10815 ; GFX7-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10816 ; GFX7: ; %bb.0: ; %entry
10817 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10818 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10819 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10820 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10821 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10822 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10823 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10824 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10825 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10826 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10827 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10828 ; GFX7-NEXT: buffer_wbinvl1_vol
10829 ; GFX7-NEXT: s_endpgm
10831 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10832 ; GFX10-WGP: ; %bb.0: ; %entry
10833 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10834 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10835 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10836 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10837 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10838 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10839 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10840 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10841 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10842 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10843 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10844 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10845 ; GFX10-WGP-NEXT: buffer_gl0_inv
10846 ; GFX10-WGP-NEXT: buffer_gl1_inv
10847 ; GFX10-WGP-NEXT: s_endpgm
10849 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10850 ; GFX10-CU: ; %bb.0: ; %entry
10851 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10852 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10853 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10854 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10855 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10856 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10857 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10858 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10859 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10860 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10861 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10862 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10863 ; GFX10-CU-NEXT: buffer_gl0_inv
10864 ; GFX10-CU-NEXT: buffer_gl1_inv
10865 ; GFX10-CU-NEXT: s_endpgm
10867 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10868 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10869 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10870 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10871 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10872 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10873 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10874 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10875 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10876 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10877 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10878 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10879 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10880 ; SKIP-CACHE-INV-NEXT: s_endpgm
10882 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10883 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10884 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10885 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10886 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10887 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10888 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10889 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10890 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10891 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10892 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10893 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10894 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10896 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10897 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10898 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10899 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10900 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10901 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10902 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10903 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10904 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10905 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10906 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10907 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10908 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10910 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10911 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10912 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10913 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10914 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10915 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10916 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10917 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10918 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10919 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10920 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10921 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10923 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10924 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10925 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10926 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10927 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10928 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10929 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10930 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10931 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10932 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10933 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10934 ; GFX940-TGSPLIT-NEXT: s_endpgm
10936 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10937 ; GFX11-WGP: ; %bb.0: ; %entry
10938 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10939 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10940 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10941 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10942 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10943 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10944 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10945 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10946 ; GFX11-WGP-NEXT: buffer_gl0_inv
10947 ; GFX11-WGP-NEXT: buffer_gl1_inv
10948 ; GFX11-WGP-NEXT: s_endpgm
10950 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10951 ; GFX11-CU: ; %bb.0: ; %entry
10952 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10953 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10954 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10955 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10956 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10957 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10958 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10959 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10960 ; GFX11-CU-NEXT: buffer_gl0_inv
10961 ; GFX11-CU-NEXT: buffer_gl1_inv
10962 ; GFX11-CU-NEXT: s_endpgm
10963 ptr %out, i32 %in, i32 %old) {
10965 %gep = getelementptr i32, ptr %out, i32 4
10966 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") monotonic seq_cst
10970 define amdgpu_kernel void @flat_system_one_as_acquire_seq_cst_cmpxchg(
10971 ; GFX7-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
10972 ; GFX7: ; %bb.0: ; %entry
10973 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10974 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10975 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10976 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10977 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10978 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10979 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10980 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10981 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10982 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10983 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10984 ; GFX7-NEXT: buffer_wbinvl1_vol
10985 ; GFX7-NEXT: s_endpgm
10987 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
10988 ; GFX10-WGP: ; %bb.0: ; %entry
10989 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10990 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10991 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10992 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10993 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10994 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10995 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10996 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10997 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10998 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10999 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11000 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11001 ; GFX10-WGP-NEXT: buffer_gl0_inv
11002 ; GFX10-WGP-NEXT: buffer_gl1_inv
11003 ; GFX10-WGP-NEXT: s_endpgm
11005 ; GFX10-CU-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11006 ; GFX10-CU: ; %bb.0: ; %entry
11007 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11008 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11009 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
11010 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
11011 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11012 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11013 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11014 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11015 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11016 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11017 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11018 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11019 ; GFX10-CU-NEXT: buffer_gl0_inv
11020 ; GFX10-CU-NEXT: buffer_gl1_inv
11021 ; GFX10-CU-NEXT: s_endpgm
11023 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11024 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11025 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11026 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11027 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
11028 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
11029 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11030 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11031 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11032 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11033 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11034 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11035 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11036 ; SKIP-CACHE-INV-NEXT: s_endpgm
11038 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11039 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11040 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11041 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11042 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11043 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11044 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11045 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11046 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11047 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11048 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11049 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11050 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11052 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11053 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11054 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11055 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11056 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11057 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11058 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11059 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11060 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11061 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11062 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11063 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11064 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11066 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11067 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11068 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11069 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11070 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11071 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11072 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11073 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11074 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11075 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11076 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11077 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11079 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11080 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11081 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11082 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11083 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11084 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11085 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11086 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11087 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11088 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11089 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11090 ; GFX940-TGSPLIT-NEXT: s_endpgm
11092 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11093 ; GFX11-WGP: ; %bb.0: ; %entry
11094 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11095 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11096 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11097 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11098 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11099 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11100 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11101 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11102 ; GFX11-WGP-NEXT: buffer_gl0_inv
11103 ; GFX11-WGP-NEXT: buffer_gl1_inv
11104 ; GFX11-WGP-NEXT: s_endpgm
11106 ; GFX11-CU-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11107 ; GFX11-CU: ; %bb.0: ; %entry
11108 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11109 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11110 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11111 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11112 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11113 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11114 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11115 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11116 ; GFX11-CU-NEXT: buffer_gl0_inv
11117 ; GFX11-CU-NEXT: buffer_gl1_inv
11118 ; GFX11-CU-NEXT: s_endpgm
11119 ptr %out, i32 %in, i32 %old) {
11121 %gep = getelementptr i32, ptr %out, i32 4
11122 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acquire seq_cst
11126 define amdgpu_kernel void @flat_system_one_as_release_seq_cst_cmpxchg(
11127 ; GFX7-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11128 ; GFX7: ; %bb.0: ; %entry
11129 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11130 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11131 ; GFX7-NEXT: s_add_u32 s0, s0, 16
11132 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
11133 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11134 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11135 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11136 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11137 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11138 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11139 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11140 ; GFX7-NEXT: buffer_wbinvl1_vol
11141 ; GFX7-NEXT: s_endpgm
11143 ; GFX10-WGP-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11144 ; GFX10-WGP: ; %bb.0: ; %entry
11145 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11146 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11147 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
11148 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
11149 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11150 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11151 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11152 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11153 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11154 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11155 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11156 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11157 ; GFX10-WGP-NEXT: buffer_gl0_inv
11158 ; GFX10-WGP-NEXT: buffer_gl1_inv
11159 ; GFX10-WGP-NEXT: s_endpgm
11161 ; GFX10-CU-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11162 ; GFX10-CU: ; %bb.0: ; %entry
11163 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11164 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11165 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
11166 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
11167 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11168 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11169 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11170 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11171 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11172 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11173 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11174 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11175 ; GFX10-CU-NEXT: buffer_gl0_inv
11176 ; GFX10-CU-NEXT: buffer_gl1_inv
11177 ; GFX10-CU-NEXT: s_endpgm
11179 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11180 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11181 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11182 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11183 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
11184 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
11185 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11186 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11187 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11188 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11189 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11190 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11191 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11192 ; SKIP-CACHE-INV-NEXT: s_endpgm
11194 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11195 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11196 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11197 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11198 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11199 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11200 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11201 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11202 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11203 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11204 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11205 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11206 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11208 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11209 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11210 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11211 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11212 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11213 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11214 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11215 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11216 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11217 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11218 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11219 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11220 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11222 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11223 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11224 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11225 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11226 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11227 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11228 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11229 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11230 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11231 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11232 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11233 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11235 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11236 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11237 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11238 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11239 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11240 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11241 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11242 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11243 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11244 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11245 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11246 ; GFX940-TGSPLIT-NEXT: s_endpgm
11248 ; GFX11-WGP-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11249 ; GFX11-WGP: ; %bb.0: ; %entry
11250 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11251 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11252 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11253 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11254 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11255 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11256 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11257 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11258 ; GFX11-WGP-NEXT: buffer_gl0_inv
11259 ; GFX11-WGP-NEXT: buffer_gl1_inv
11260 ; GFX11-WGP-NEXT: s_endpgm
11262 ; GFX11-CU-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11263 ; GFX11-CU: ; %bb.0: ; %entry
11264 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11265 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11266 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11267 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11268 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11269 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11270 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11271 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11272 ; GFX11-CU-NEXT: buffer_gl0_inv
11273 ; GFX11-CU-NEXT: buffer_gl1_inv
11274 ; GFX11-CU-NEXT: s_endpgm
11275 ptr %out, i32 %in, i32 %old) {
11277 %gep = getelementptr i32, ptr %out, i32 4
11278 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") release seq_cst
11282 define amdgpu_kernel void @flat_system_one_as_acq_rel_seq_cst_cmpxchg(
11283 ; GFX7-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11284 ; GFX7: ; %bb.0: ; %entry
11285 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11286 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11287 ; GFX7-NEXT: s_add_u32 s0, s0, 16
11288 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
11289 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11290 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11291 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11292 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11293 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11294 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11295 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11296 ; GFX7-NEXT: buffer_wbinvl1_vol
11297 ; GFX7-NEXT: s_endpgm
11299 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11300 ; GFX10-WGP: ; %bb.0: ; %entry
11301 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11302 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11303 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
11304 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
11305 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11306 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11307 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11308 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11309 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11310 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11311 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11312 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11313 ; GFX10-WGP-NEXT: buffer_gl0_inv
11314 ; GFX10-WGP-NEXT: buffer_gl1_inv
11315 ; GFX10-WGP-NEXT: s_endpgm
11317 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11318 ; GFX10-CU: ; %bb.0: ; %entry
11319 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11320 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11321 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
11322 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
11323 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11324 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11325 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11326 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11327 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11328 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11329 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11330 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11331 ; GFX10-CU-NEXT: buffer_gl0_inv
11332 ; GFX10-CU-NEXT: buffer_gl1_inv
11333 ; GFX10-CU-NEXT: s_endpgm
11335 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11336 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11337 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11338 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11339 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
11340 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
11341 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11342 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11343 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11344 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11345 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11346 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11347 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11348 ; SKIP-CACHE-INV-NEXT: s_endpgm
11350 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11351 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11352 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11353 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11354 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11355 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11356 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11357 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11358 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11359 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11360 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11361 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11362 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11364 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11365 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11366 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11367 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11368 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11369 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11370 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11371 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11372 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11373 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11374 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11375 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11376 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11378 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_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: s_waitcnt lgkmcnt(0)
11382 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11383 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11384 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11385 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11386 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11387 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11388 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11389 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11391 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11392 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11393 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11394 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11395 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11396 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11397 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11398 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11399 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11400 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11401 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11402 ; GFX940-TGSPLIT-NEXT: s_endpgm
11404 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11405 ; GFX11-WGP: ; %bb.0: ; %entry
11406 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11407 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11408 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11409 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11410 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11411 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11412 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11413 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11414 ; GFX11-WGP-NEXT: buffer_gl0_inv
11415 ; GFX11-WGP-NEXT: buffer_gl1_inv
11416 ; GFX11-WGP-NEXT: s_endpgm
11418 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11419 ; GFX11-CU: ; %bb.0: ; %entry
11420 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11421 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11422 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11423 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11424 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11425 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11426 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11427 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11428 ; GFX11-CU-NEXT: buffer_gl0_inv
11429 ; GFX11-CU-NEXT: buffer_gl1_inv
11430 ; GFX11-CU-NEXT: s_endpgm
11431 ptr %out, i32 %in, i32 %old) {
11433 %gep = getelementptr i32, ptr %out, i32 4
11434 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acq_rel seq_cst
11438 define amdgpu_kernel void @flat_system_one_as_seq_cst_seq_cst_cmpxchg(
11439 ; GFX7-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11440 ; GFX7: ; %bb.0: ; %entry
11441 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11442 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11443 ; GFX7-NEXT: s_add_u32 s0, s0, 16
11444 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
11445 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11446 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11447 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11448 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11449 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11450 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11451 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11452 ; GFX7-NEXT: buffer_wbinvl1_vol
11453 ; GFX7-NEXT: s_endpgm
11455 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11456 ; GFX10-WGP: ; %bb.0: ; %entry
11457 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11458 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11459 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
11460 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
11461 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11462 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11463 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11464 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11465 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11466 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11467 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11468 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11469 ; GFX10-WGP-NEXT: buffer_gl0_inv
11470 ; GFX10-WGP-NEXT: buffer_gl1_inv
11471 ; GFX10-WGP-NEXT: s_endpgm
11473 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11474 ; GFX10-CU: ; %bb.0: ; %entry
11475 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11476 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11477 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
11478 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
11479 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11480 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11481 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11482 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11483 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11484 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11485 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11486 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11487 ; GFX10-CU-NEXT: buffer_gl0_inv
11488 ; GFX10-CU-NEXT: buffer_gl1_inv
11489 ; GFX10-CU-NEXT: s_endpgm
11491 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11492 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11493 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11494 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11495 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
11496 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
11497 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11498 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11499 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11500 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11501 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11502 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11503 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11504 ; SKIP-CACHE-INV-NEXT: s_endpgm
11506 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11507 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11508 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11509 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11510 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11511 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11512 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11513 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11514 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11515 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11516 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11517 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11518 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11520 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11521 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11522 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11523 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11524 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11525 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11526 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11527 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11528 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11529 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11530 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11531 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11532 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11534 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11535 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11536 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11537 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11538 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11539 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11540 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11541 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11542 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11543 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11544 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11545 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11547 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11548 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11549 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11550 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11551 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11552 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11553 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11554 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11555 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11556 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11557 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11558 ; GFX940-TGSPLIT-NEXT: s_endpgm
11560 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_seq_cst_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: s_waitcnt lgkmcnt(0)
11564 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11565 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11566 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11567 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11568 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11569 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11570 ; GFX11-WGP-NEXT: buffer_gl0_inv
11571 ; GFX11-WGP-NEXT: buffer_gl1_inv
11572 ; GFX11-WGP-NEXT: s_endpgm
11574 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_seq_cst_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: s_waitcnt lgkmcnt(0)
11578 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11579 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11580 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11581 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11582 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11583 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11584 ; GFX11-CU-NEXT: buffer_gl0_inv
11585 ; GFX11-CU-NEXT: buffer_gl1_inv
11586 ; GFX11-CU-NEXT: s_endpgm
11587 ptr %out, i32 %in, i32 %old) {
11589 %gep = getelementptr i32, ptr %out, i32 4
11590 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") seq_cst seq_cst
11594 define amdgpu_kernel void @flat_system_one_as_monotonic_monotonic_ret_cmpxchg(
11595 ; GFX7-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11596 ; GFX7: ; %bb.0: ; %entry
11597 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11598 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11599 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11600 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11601 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11602 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11603 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11604 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11605 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11606 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11607 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11608 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11609 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11610 ; GFX7-NEXT: s_endpgm
11612 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11613 ; GFX10-WGP: ; %bb.0: ; %entry
11614 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11615 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11616 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
11617 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
11618 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
11619 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11620 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11621 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11622 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11623 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11624 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11625 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11626 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
11627 ; GFX10-WGP-NEXT: s_endpgm
11629 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11630 ; GFX10-CU: ; %bb.0: ; %entry
11631 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11632 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11633 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
11634 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
11635 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
11636 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11637 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11638 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11639 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11640 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11641 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11642 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11643 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
11644 ; GFX10-CU-NEXT: s_endpgm
11646 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11647 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11648 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11649 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11650 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
11651 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
11652 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11653 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11654 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
11655 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11656 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11657 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11658 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11659 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11660 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
11661 ; SKIP-CACHE-INV-NEXT: s_endpgm
11663 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11664 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11665 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11666 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11667 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11668 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11669 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
11670 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11671 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
11672 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11674 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11675 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11676 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11677 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11678 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11679 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11680 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
11681 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11682 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
11683 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11685 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11686 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11687 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11688 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11689 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11690 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11691 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
11692 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11693 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
11694 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11696 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11697 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11698 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11699 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11700 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11701 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11702 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
11703 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11704 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
11705 ; GFX940-TGSPLIT-NEXT: s_endpgm
11707 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11708 ; GFX11-WGP: ; %bb.0: ; %entry
11709 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11710 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11711 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11712 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11713 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
11714 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11715 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
11716 ; GFX11-WGP-NEXT: s_endpgm
11718 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11719 ; GFX11-CU: ; %bb.0: ; %entry
11720 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11721 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11722 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11723 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11724 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
11725 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11726 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
11727 ; GFX11-CU-NEXT: s_endpgm
11728 ptr %out, i32 %in, i32 %old) {
11730 %gep = getelementptr i32, ptr %out, i32 4
11731 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") monotonic monotonic
11732 %val0 = extractvalue { i32, i1 } %val, 0
11733 store i32 %val0, ptr %out, align 4
11737 define amdgpu_kernel void @flat_system_one_as_acquire_monotonic_ret_cmpxchg(
11738 ; GFX7-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11739 ; GFX7: ; %bb.0: ; %entry
11740 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11741 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11742 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11743 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11744 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11745 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11746 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11747 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11748 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11749 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11750 ; GFX7-NEXT: buffer_wbinvl1_vol
11751 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11752 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11753 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11754 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11755 ; GFX7-NEXT: s_endpgm
11757 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11758 ; GFX10-WGP: ; %bb.0: ; %entry
11759 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11760 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11761 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
11762 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
11763 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
11764 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11765 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11766 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11767 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11768 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11769 ; GFX10-WGP-NEXT: buffer_gl0_inv
11770 ; GFX10-WGP-NEXT: buffer_gl1_inv
11771 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11772 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11773 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11774 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
11775 ; GFX10-WGP-NEXT: s_endpgm
11777 ; GFX10-CU-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11778 ; GFX10-CU: ; %bb.0: ; %entry
11779 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11780 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11781 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
11782 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
11783 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
11784 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11785 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11786 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11787 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11788 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11789 ; GFX10-CU-NEXT: buffer_gl0_inv
11790 ; GFX10-CU-NEXT: buffer_gl1_inv
11791 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11792 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11793 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11794 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
11795 ; GFX10-CU-NEXT: s_endpgm
11797 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11798 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11799 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11800 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11801 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
11802 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
11803 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11804 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11805 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
11806 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11807 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11808 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11809 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11810 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11811 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11812 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
11813 ; SKIP-CACHE-INV-NEXT: s_endpgm
11815 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11816 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11817 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11818 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11819 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11820 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11821 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
11822 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11823 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11824 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11825 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11826 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
11827 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11829 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11830 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11831 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11832 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11833 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11834 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11835 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
11836 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11837 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11838 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11839 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
11840 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11842 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11843 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11844 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11845 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11846 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11847 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11848 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
11849 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11850 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11851 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11852 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
11853 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11855 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11856 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11857 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11858 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11859 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11860 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11861 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
11862 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11863 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11864 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
11865 ; GFX940-TGSPLIT-NEXT: s_endpgm
11867 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11868 ; GFX11-WGP: ; %bb.0: ; %entry
11869 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11870 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11871 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11872 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11873 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
11874 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11875 ; GFX11-WGP-NEXT: buffer_gl0_inv
11876 ; GFX11-WGP-NEXT: buffer_gl1_inv
11877 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11878 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
11879 ; GFX11-WGP-NEXT: s_endpgm
11881 ; GFX11-CU-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11882 ; GFX11-CU: ; %bb.0: ; %entry
11883 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11884 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11885 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11886 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11887 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
11888 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11889 ; GFX11-CU-NEXT: buffer_gl0_inv
11890 ; GFX11-CU-NEXT: buffer_gl1_inv
11891 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11892 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
11893 ; GFX11-CU-NEXT: s_endpgm
11894 ptr %out, i32 %in, i32 %old) {
11896 %gep = getelementptr i32, ptr %out, i32 4
11897 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acquire monotonic
11898 %val0 = extractvalue { i32, i1 } %val, 0
11899 store i32 %val0, ptr %out, align 4
11903 define amdgpu_kernel void @flat_system_one_as_release_monotonic_ret_cmpxchg(
11904 ; GFX7-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
11905 ; GFX7: ; %bb.0: ; %entry
11906 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11907 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11908 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11909 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11910 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11911 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11912 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11913 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11914 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11915 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11916 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11917 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11918 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11919 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11920 ; GFX7-NEXT: s_endpgm
11922 ; GFX10-WGP-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
11923 ; GFX10-WGP: ; %bb.0: ; %entry
11924 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11925 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11926 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
11927 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
11928 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
11929 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11930 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11931 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11932 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11933 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11934 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11935 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11936 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11937 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11938 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
11939 ; GFX10-WGP-NEXT: s_endpgm
11941 ; GFX10-CU-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
11942 ; GFX10-CU: ; %bb.0: ; %entry
11943 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11944 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11945 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
11946 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
11947 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
11948 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11949 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11950 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11951 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11952 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11953 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11954 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11955 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11956 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11957 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
11958 ; GFX10-CU-NEXT: s_endpgm
11960 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
11961 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11962 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11963 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11964 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
11965 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
11966 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11967 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11968 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
11969 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11970 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11971 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11972 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11973 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11974 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11975 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
11976 ; SKIP-CACHE-INV-NEXT: s_endpgm
11978 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
11979 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11980 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11981 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11982 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11983 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11984 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11985 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11986 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
11987 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11988 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
11989 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11991 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
11992 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11993 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11994 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11995 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11996 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11997 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11998 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11999 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12000 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12001 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12002 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12004 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12005 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12006 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12007 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12008 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12009 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12010 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12011 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12012 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12013 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12014 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12015 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12017 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12018 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12019 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12020 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12021 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12022 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12023 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12024 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12025 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12026 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12027 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12028 ; GFX940-TGSPLIT-NEXT: s_endpgm
12030 ; GFX11-WGP-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12031 ; GFX11-WGP: ; %bb.0: ; %entry
12032 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12033 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12034 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12035 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12036 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12037 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12038 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12039 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12040 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12041 ; GFX11-WGP-NEXT: s_endpgm
12043 ; GFX11-CU-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12044 ; GFX11-CU: ; %bb.0: ; %entry
12045 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12046 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12047 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12048 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12049 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12050 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12051 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12052 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12053 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12054 ; GFX11-CU-NEXT: s_endpgm
12055 ptr %out, i32 %in, i32 %old) {
12057 %gep = getelementptr i32, ptr %out, i32 4
12058 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") release monotonic
12059 %val0 = extractvalue { i32, i1 } %val, 0
12060 store i32 %val0, ptr %out, align 4
12064 define amdgpu_kernel void @flat_system_one_as_acq_rel_monotonic_ret_cmpxchg(
12065 ; GFX7-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12066 ; GFX7: ; %bb.0: ; %entry
12067 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12068 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12069 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12070 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12071 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12072 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12073 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12074 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12075 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12076 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12077 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12078 ; GFX7-NEXT: buffer_wbinvl1_vol
12079 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12080 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12081 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12082 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12083 ; GFX7-NEXT: s_endpgm
12085 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12086 ; GFX10-WGP: ; %bb.0: ; %entry
12087 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12088 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12089 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12090 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12091 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12092 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12093 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12094 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12095 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12096 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12097 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12098 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12099 ; GFX10-WGP-NEXT: buffer_gl0_inv
12100 ; GFX10-WGP-NEXT: buffer_gl1_inv
12101 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12102 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12103 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12104 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12105 ; GFX10-WGP-NEXT: s_endpgm
12107 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12108 ; GFX10-CU: ; %bb.0: ; %entry
12109 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12110 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12111 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12112 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12113 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12114 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12115 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12116 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12117 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12118 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12119 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12120 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12121 ; GFX10-CU-NEXT: buffer_gl0_inv
12122 ; GFX10-CU-NEXT: buffer_gl1_inv
12123 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12124 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12125 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12126 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12127 ; GFX10-CU-NEXT: s_endpgm
12129 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12130 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12131 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12132 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12133 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12134 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12135 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12136 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12137 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12138 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12139 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12140 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12141 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12142 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12143 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12144 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12145 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12146 ; SKIP-CACHE-INV-NEXT: s_endpgm
12148 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12149 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12150 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12151 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12152 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12153 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12154 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12155 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12156 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12157 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12158 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12159 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12160 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12161 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12162 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12164 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12165 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12166 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12167 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12168 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12169 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12170 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12171 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12172 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12173 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12174 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12175 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12176 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12177 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12179 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12180 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12181 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12182 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12183 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12184 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12185 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12186 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12187 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12188 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12189 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12190 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12191 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12192 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12194 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12195 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12196 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12197 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12198 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12199 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12200 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12201 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12202 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12203 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12204 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12205 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12206 ; GFX940-TGSPLIT-NEXT: s_endpgm
12208 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12209 ; GFX11-WGP: ; %bb.0: ; %entry
12210 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12211 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12212 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12213 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12214 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12215 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12216 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12217 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12218 ; GFX11-WGP-NEXT: buffer_gl0_inv
12219 ; GFX11-WGP-NEXT: buffer_gl1_inv
12220 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12221 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12222 ; GFX11-WGP-NEXT: s_endpgm
12224 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12225 ; GFX11-CU: ; %bb.0: ; %entry
12226 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12227 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12228 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12229 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12230 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12231 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12232 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12233 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12234 ; GFX11-CU-NEXT: buffer_gl0_inv
12235 ; GFX11-CU-NEXT: buffer_gl1_inv
12236 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12237 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12238 ; GFX11-CU-NEXT: s_endpgm
12239 ptr %out, i32 %in, i32 %old) {
12241 %gep = getelementptr i32, ptr %out, i32 4
12242 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acq_rel monotonic
12243 %val0 = extractvalue { i32, i1 } %val, 0
12244 store i32 %val0, ptr %out, align 4
12248 define amdgpu_kernel void @flat_system_one_as_seq_cst_monotonic_ret_cmpxchg(
12249 ; GFX7-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12250 ; GFX7: ; %bb.0: ; %entry
12251 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12252 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12253 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12254 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12255 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12256 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12257 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12258 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12259 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12260 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12261 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12262 ; GFX7-NEXT: buffer_wbinvl1_vol
12263 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12264 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12265 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12266 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12267 ; GFX7-NEXT: s_endpgm
12269 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12270 ; GFX10-WGP: ; %bb.0: ; %entry
12271 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12272 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12273 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12274 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12275 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12276 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12277 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12278 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12279 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12280 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12281 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12282 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12283 ; GFX10-WGP-NEXT: buffer_gl0_inv
12284 ; GFX10-WGP-NEXT: buffer_gl1_inv
12285 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12286 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12287 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12288 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12289 ; GFX10-WGP-NEXT: s_endpgm
12291 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12292 ; GFX10-CU: ; %bb.0: ; %entry
12293 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12294 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12295 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12296 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12297 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12298 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12299 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12300 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12301 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12302 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12303 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12304 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12305 ; GFX10-CU-NEXT: buffer_gl0_inv
12306 ; GFX10-CU-NEXT: buffer_gl1_inv
12307 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12308 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12309 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12310 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12311 ; GFX10-CU-NEXT: s_endpgm
12313 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12314 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12315 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12316 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12317 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12318 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12319 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12320 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12321 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12322 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12323 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12324 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12325 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12326 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12327 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12328 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12329 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12330 ; SKIP-CACHE-INV-NEXT: s_endpgm
12332 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12333 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12334 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12335 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12336 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12337 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12338 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12339 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12340 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12341 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12342 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12343 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12344 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12345 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12346 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12348 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12349 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12350 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12351 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12352 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12353 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12354 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12355 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12356 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12357 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12358 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12359 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12360 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12361 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12363 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12364 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12365 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12366 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12367 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12368 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12369 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12370 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12371 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12372 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12373 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12374 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12375 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12376 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12378 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12379 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12380 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12381 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12382 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12383 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12384 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12385 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12386 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12387 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12388 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12389 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12390 ; GFX940-TGSPLIT-NEXT: s_endpgm
12392 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12393 ; GFX11-WGP: ; %bb.0: ; %entry
12394 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12395 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12396 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12397 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12398 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12399 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12400 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12401 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12402 ; GFX11-WGP-NEXT: buffer_gl0_inv
12403 ; GFX11-WGP-NEXT: buffer_gl1_inv
12404 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12405 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12406 ; GFX11-WGP-NEXT: s_endpgm
12408 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12409 ; GFX11-CU: ; %bb.0: ; %entry
12410 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12411 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12412 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12413 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12414 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12415 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12416 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12417 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12418 ; GFX11-CU-NEXT: buffer_gl0_inv
12419 ; GFX11-CU-NEXT: buffer_gl1_inv
12420 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12421 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12422 ; GFX11-CU-NEXT: s_endpgm
12423 ptr %out, i32 %in, i32 %old) {
12425 %gep = getelementptr i32, ptr %out, i32 4
12426 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") seq_cst monotonic
12427 %val0 = extractvalue { i32, i1 } %val, 0
12428 store i32 %val0, ptr %out, align 4
12432 define amdgpu_kernel void @flat_system_one_as_monotonic_acquire_ret_cmpxchg(
12433 ; GFX7-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12434 ; GFX7: ; %bb.0: ; %entry
12435 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12436 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12437 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12438 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12439 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12440 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12441 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12442 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12443 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12444 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12445 ; GFX7-NEXT: buffer_wbinvl1_vol
12446 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12447 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12448 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12449 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12450 ; GFX7-NEXT: s_endpgm
12452 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12453 ; GFX10-WGP: ; %bb.0: ; %entry
12454 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12455 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12456 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12457 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12458 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12459 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12460 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12461 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12462 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12463 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12464 ; GFX10-WGP-NEXT: buffer_gl0_inv
12465 ; GFX10-WGP-NEXT: buffer_gl1_inv
12466 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12467 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12468 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12469 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12470 ; GFX10-WGP-NEXT: s_endpgm
12472 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12473 ; GFX10-CU: ; %bb.0: ; %entry
12474 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12475 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12476 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12477 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12478 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12479 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12480 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12481 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12482 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12483 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12484 ; GFX10-CU-NEXT: buffer_gl0_inv
12485 ; GFX10-CU-NEXT: buffer_gl1_inv
12486 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12487 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12488 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12489 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12490 ; GFX10-CU-NEXT: s_endpgm
12492 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12493 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12494 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12495 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12496 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12497 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12498 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12499 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12500 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12501 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12502 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12503 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12504 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12505 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12506 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12507 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12508 ; SKIP-CACHE-INV-NEXT: s_endpgm
12510 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12511 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12512 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12513 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12514 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12515 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12516 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12517 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12518 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12519 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12520 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12521 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12522 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12524 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12525 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12526 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12527 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12528 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12529 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12530 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12531 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12532 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12533 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12534 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12535 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12537 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12538 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12539 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12540 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12541 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12542 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12543 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12544 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12545 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12546 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12547 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12548 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12550 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12551 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12552 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12553 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12554 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12555 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12556 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12557 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12558 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12559 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12560 ; GFX940-TGSPLIT-NEXT: s_endpgm
12562 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12563 ; GFX11-WGP: ; %bb.0: ; %entry
12564 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12565 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12566 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12567 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12568 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12569 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12570 ; GFX11-WGP-NEXT: buffer_gl0_inv
12571 ; GFX11-WGP-NEXT: buffer_gl1_inv
12572 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12573 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12574 ; GFX11-WGP-NEXT: s_endpgm
12576 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12577 ; GFX11-CU: ; %bb.0: ; %entry
12578 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12579 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12580 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12581 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12582 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12583 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12584 ; GFX11-CU-NEXT: buffer_gl0_inv
12585 ; GFX11-CU-NEXT: buffer_gl1_inv
12586 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12587 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12588 ; GFX11-CU-NEXT: s_endpgm
12589 ptr %out, i32 %in, i32 %old) {
12591 %gep = getelementptr i32, ptr %out, i32 4
12592 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") monotonic acquire
12593 %val0 = extractvalue { i32, i1 } %val, 0
12594 store i32 %val0, ptr %out, align 4
12598 define amdgpu_kernel void @flat_system_one_as_acquire_acquire_ret_cmpxchg(
12599 ; GFX7-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12600 ; GFX7: ; %bb.0: ; %entry
12601 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12602 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12603 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12604 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12605 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12606 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12607 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12608 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12609 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12610 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12611 ; GFX7-NEXT: buffer_wbinvl1_vol
12612 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12613 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12614 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12615 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12616 ; GFX7-NEXT: s_endpgm
12618 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12619 ; GFX10-WGP: ; %bb.0: ; %entry
12620 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12621 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12622 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12623 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12624 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12625 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12626 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12627 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12628 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12629 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12630 ; GFX10-WGP-NEXT: buffer_gl0_inv
12631 ; GFX10-WGP-NEXT: buffer_gl1_inv
12632 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12633 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12634 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12635 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12636 ; GFX10-WGP-NEXT: s_endpgm
12638 ; GFX10-CU-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12639 ; GFX10-CU: ; %bb.0: ; %entry
12640 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12641 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12642 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12643 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12644 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12645 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12646 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12647 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12648 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12649 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12650 ; GFX10-CU-NEXT: buffer_gl0_inv
12651 ; GFX10-CU-NEXT: buffer_gl1_inv
12652 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12653 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12654 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12655 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12656 ; GFX10-CU-NEXT: s_endpgm
12658 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12659 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12660 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12661 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12662 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12663 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12664 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12665 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12666 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12667 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12668 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12669 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12670 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12671 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12672 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12673 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12674 ; SKIP-CACHE-INV-NEXT: s_endpgm
12676 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12677 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12678 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12679 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12680 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12681 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12682 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12683 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12684 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12685 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12686 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12687 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12688 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12690 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12691 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12692 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12693 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12694 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12695 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12696 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12697 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12698 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12699 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12700 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12701 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12703 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12704 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12705 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12706 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12707 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12708 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12709 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12710 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12711 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12712 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12713 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12714 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12716 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12717 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12718 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12719 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12720 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12721 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12722 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12723 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12724 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12725 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12726 ; GFX940-TGSPLIT-NEXT: s_endpgm
12728 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12729 ; GFX11-WGP: ; %bb.0: ; %entry
12730 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12731 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12732 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12733 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12734 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12735 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12736 ; GFX11-WGP-NEXT: buffer_gl0_inv
12737 ; GFX11-WGP-NEXT: buffer_gl1_inv
12738 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12739 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12740 ; GFX11-WGP-NEXT: s_endpgm
12742 ; GFX11-CU-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12743 ; GFX11-CU: ; %bb.0: ; %entry
12744 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12745 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12746 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12747 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12748 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12749 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12750 ; GFX11-CU-NEXT: buffer_gl0_inv
12751 ; GFX11-CU-NEXT: buffer_gl1_inv
12752 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12753 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12754 ; GFX11-CU-NEXT: s_endpgm
12755 ptr %out, i32 %in, i32 %old) {
12757 %gep = getelementptr i32, ptr %out, i32 4
12758 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acquire acquire
12759 %val0 = extractvalue { i32, i1 } %val, 0
12760 store i32 %val0, ptr %out, align 4
12764 define amdgpu_kernel void @flat_system_one_as_release_acquire_ret_cmpxchg(
12765 ; GFX7-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12766 ; GFX7: ; %bb.0: ; %entry
12767 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12768 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12769 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12770 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12771 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12772 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12773 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12774 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12775 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12776 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12777 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12778 ; GFX7-NEXT: buffer_wbinvl1_vol
12779 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12780 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12781 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12782 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12783 ; GFX7-NEXT: s_endpgm
12785 ; GFX10-WGP-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12786 ; GFX10-WGP: ; %bb.0: ; %entry
12787 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12788 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12789 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12790 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12791 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12792 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12793 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12794 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12795 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12796 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12797 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12798 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12799 ; GFX10-WGP-NEXT: buffer_gl0_inv
12800 ; GFX10-WGP-NEXT: buffer_gl1_inv
12801 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12802 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12803 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12804 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12805 ; GFX10-WGP-NEXT: s_endpgm
12807 ; GFX10-CU-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12808 ; GFX10-CU: ; %bb.0: ; %entry
12809 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12810 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12811 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12812 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12813 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12814 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12815 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12816 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12817 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12818 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12819 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12820 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12821 ; GFX10-CU-NEXT: buffer_gl0_inv
12822 ; GFX10-CU-NEXT: buffer_gl1_inv
12823 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12824 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12825 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12826 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12827 ; GFX10-CU-NEXT: s_endpgm
12829 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12830 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12831 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12832 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12833 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12834 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12835 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12836 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12837 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12838 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12839 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12840 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12841 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12842 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12843 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12844 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12845 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12846 ; SKIP-CACHE-INV-NEXT: s_endpgm
12848 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12849 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12850 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12851 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12852 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12853 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12854 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12855 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12856 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12857 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12858 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12859 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12860 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12861 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12862 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12864 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12865 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12866 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12867 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12868 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12869 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12870 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12871 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12872 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12873 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12874 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12875 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12876 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12877 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12879 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12880 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12881 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12882 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12883 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12884 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12885 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12886 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12887 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12888 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12889 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12890 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12891 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12892 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12894 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12895 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12896 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12897 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12898 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12899 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12900 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12901 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12902 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12903 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12904 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12905 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
12906 ; GFX940-TGSPLIT-NEXT: s_endpgm
12908 ; GFX11-WGP-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12909 ; GFX11-WGP: ; %bb.0: ; %entry
12910 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12911 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12912 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12913 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12914 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12915 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12916 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12917 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12918 ; GFX11-WGP-NEXT: buffer_gl0_inv
12919 ; GFX11-WGP-NEXT: buffer_gl1_inv
12920 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12921 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12922 ; GFX11-WGP-NEXT: s_endpgm
12924 ; GFX11-CU-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12925 ; GFX11-CU: ; %bb.0: ; %entry
12926 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12927 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12928 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12929 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12930 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12931 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12932 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12933 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12934 ; GFX11-CU-NEXT: buffer_gl0_inv
12935 ; GFX11-CU-NEXT: buffer_gl1_inv
12936 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12937 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12938 ; GFX11-CU-NEXT: s_endpgm
12939 ptr %out, i32 %in, i32 %old) {
12941 %gep = getelementptr i32, ptr %out, i32 4
12942 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") release acquire
12943 %val0 = extractvalue { i32, i1 } %val, 0
12944 store i32 %val0, ptr %out, align 4
12948 define amdgpu_kernel void @flat_system_one_as_acq_rel_acquire_ret_cmpxchg(
12949 ; GFX7-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
12950 ; GFX7: ; %bb.0: ; %entry
12951 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12952 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12953 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12954 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12955 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12956 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12957 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12958 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12959 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12960 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12961 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12962 ; GFX7-NEXT: buffer_wbinvl1_vol
12963 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12964 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12965 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12966 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12967 ; GFX7-NEXT: s_endpgm
12969 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
12970 ; GFX10-WGP: ; %bb.0: ; %entry
12971 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12972 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12973 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12974 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12975 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12976 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12977 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12978 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12979 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12980 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12981 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12982 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12983 ; GFX10-WGP-NEXT: buffer_gl0_inv
12984 ; GFX10-WGP-NEXT: buffer_gl1_inv
12985 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12986 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12987 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12988 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12989 ; GFX10-WGP-NEXT: s_endpgm
12991 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
12992 ; GFX10-CU: ; %bb.0: ; %entry
12993 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12994 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12995 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12996 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12997 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12998 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12999 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13000 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13001 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13002 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13003 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13004 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13005 ; GFX10-CU-NEXT: buffer_gl0_inv
13006 ; GFX10-CU-NEXT: buffer_gl1_inv
13007 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13008 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13009 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13010 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13011 ; GFX10-CU-NEXT: s_endpgm
13013 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13014 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13015 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13016 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13017 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13018 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13019 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13020 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13021 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13022 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13023 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13024 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13025 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13026 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13027 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13028 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13029 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13030 ; SKIP-CACHE-INV-NEXT: s_endpgm
13032 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13033 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13034 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13035 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13036 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13037 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13038 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13039 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13040 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13041 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13042 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13043 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13044 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13045 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13046 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13048 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13049 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13050 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13051 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13052 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13053 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13054 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13055 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13056 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13057 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13058 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13059 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13060 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13061 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13063 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13064 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13065 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13066 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13067 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13068 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13069 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13070 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13071 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13072 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13073 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13074 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13075 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13076 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13078 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13079 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13080 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13081 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13082 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13083 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13084 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13085 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13086 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13087 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13088 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13089 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13090 ; GFX940-TGSPLIT-NEXT: s_endpgm
13092 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13093 ; GFX11-WGP: ; %bb.0: ; %entry
13094 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13095 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13096 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13097 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13098 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13099 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13100 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13101 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13102 ; GFX11-WGP-NEXT: buffer_gl0_inv
13103 ; GFX11-WGP-NEXT: buffer_gl1_inv
13104 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13105 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13106 ; GFX11-WGP-NEXT: s_endpgm
13108 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13109 ; GFX11-CU: ; %bb.0: ; %entry
13110 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13111 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13112 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13113 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13114 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13115 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13116 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13117 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13118 ; GFX11-CU-NEXT: buffer_gl0_inv
13119 ; GFX11-CU-NEXT: buffer_gl1_inv
13120 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13121 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13122 ; GFX11-CU-NEXT: s_endpgm
13123 ptr %out, i32 %in, i32 %old) {
13125 %gep = getelementptr i32, ptr %out, i32 4
13126 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acq_rel acquire
13127 %val0 = extractvalue { i32, i1 } %val, 0
13128 store i32 %val0, ptr %out, align 4
13132 define amdgpu_kernel void @flat_system_one_as_seq_cst_acquire_ret_cmpxchg(
13133 ; GFX7-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13134 ; GFX7: ; %bb.0: ; %entry
13135 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13136 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13137 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13138 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13139 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13140 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13141 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13142 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13143 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13144 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13145 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13146 ; GFX7-NEXT: buffer_wbinvl1_vol
13147 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13148 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13149 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13150 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13151 ; GFX7-NEXT: s_endpgm
13153 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13154 ; GFX10-WGP: ; %bb.0: ; %entry
13155 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13156 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13157 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13158 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13159 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13160 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13161 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13162 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13163 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13164 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13165 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13166 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13167 ; GFX10-WGP-NEXT: buffer_gl0_inv
13168 ; GFX10-WGP-NEXT: buffer_gl1_inv
13169 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13170 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13171 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13172 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13173 ; GFX10-WGP-NEXT: s_endpgm
13175 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13176 ; GFX10-CU: ; %bb.0: ; %entry
13177 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13178 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13179 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13180 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13181 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13182 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13183 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13184 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13185 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13186 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13187 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13188 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13189 ; GFX10-CU-NEXT: buffer_gl0_inv
13190 ; GFX10-CU-NEXT: buffer_gl1_inv
13191 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13192 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13193 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13194 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13195 ; GFX10-CU-NEXT: s_endpgm
13197 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13198 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13199 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13200 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13201 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13202 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13203 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13204 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13205 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13206 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13207 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13208 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13209 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13210 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13211 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13212 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13213 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13214 ; SKIP-CACHE-INV-NEXT: s_endpgm
13216 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13217 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13218 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13219 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13220 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13221 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13222 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13223 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13224 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13225 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13226 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13227 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13228 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13229 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13230 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13232 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13233 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13234 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13235 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13236 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13237 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13238 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13239 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13240 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13241 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13242 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13243 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13244 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13245 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13247 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13248 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13249 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13250 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13251 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13252 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13253 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13254 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13255 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13256 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13257 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13258 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13259 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13260 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13262 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13263 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13264 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13265 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13266 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13267 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13268 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13269 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13270 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13271 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13272 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13273 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13274 ; GFX940-TGSPLIT-NEXT: s_endpgm
13276 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13277 ; GFX11-WGP: ; %bb.0: ; %entry
13278 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13279 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13280 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13281 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13282 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13283 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13284 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13285 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13286 ; GFX11-WGP-NEXT: buffer_gl0_inv
13287 ; GFX11-WGP-NEXT: buffer_gl1_inv
13288 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13289 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13290 ; GFX11-WGP-NEXT: s_endpgm
13292 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13293 ; GFX11-CU: ; %bb.0: ; %entry
13294 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13295 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13296 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13297 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13298 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13299 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13300 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13301 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13302 ; GFX11-CU-NEXT: buffer_gl0_inv
13303 ; GFX11-CU-NEXT: buffer_gl1_inv
13304 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13305 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13306 ; GFX11-CU-NEXT: s_endpgm
13307 ptr %out, i32 %in, i32 %old) {
13309 %gep = getelementptr i32, ptr %out, i32 4
13310 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") seq_cst acquire
13311 %val0 = extractvalue { i32, i1 } %val, 0
13312 store i32 %val0, ptr %out, align 4
13316 define amdgpu_kernel void @flat_system_one_as_monotonic_seq_cst_ret_cmpxchg(
13317 ; GFX7-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13318 ; GFX7: ; %bb.0: ; %entry
13319 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13320 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13321 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13322 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13323 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13324 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13325 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13326 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13327 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13328 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13329 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13330 ; GFX7-NEXT: buffer_wbinvl1_vol
13331 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13332 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13333 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13334 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13335 ; GFX7-NEXT: s_endpgm
13337 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13338 ; GFX10-WGP: ; %bb.0: ; %entry
13339 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13340 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13341 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13342 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13343 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13344 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13345 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13346 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13347 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13348 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13349 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13350 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13351 ; GFX10-WGP-NEXT: buffer_gl0_inv
13352 ; GFX10-WGP-NEXT: buffer_gl1_inv
13353 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13354 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13355 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13356 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13357 ; GFX10-WGP-NEXT: s_endpgm
13359 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13360 ; GFX10-CU: ; %bb.0: ; %entry
13361 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13362 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13363 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13364 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13365 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13366 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13367 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13368 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13369 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13370 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13371 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13372 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13373 ; GFX10-CU-NEXT: buffer_gl0_inv
13374 ; GFX10-CU-NEXT: buffer_gl1_inv
13375 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13376 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13377 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13378 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13379 ; GFX10-CU-NEXT: s_endpgm
13381 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13382 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13383 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13384 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13385 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13386 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13387 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13388 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13389 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13390 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13391 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13392 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13393 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13394 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13395 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13396 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13397 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13398 ; SKIP-CACHE-INV-NEXT: s_endpgm
13400 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13401 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13402 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13403 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13404 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13405 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13406 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13407 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13408 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13409 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13410 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13411 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13412 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13413 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13414 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13416 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13417 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13418 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13419 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13420 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13421 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13422 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13423 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13424 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13425 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13426 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13427 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13428 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13429 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13431 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13432 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13433 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13434 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13435 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13436 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13437 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13438 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13439 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13440 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13441 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13442 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13443 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13444 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13446 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13447 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13448 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13449 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13450 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13451 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13452 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13453 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13454 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13455 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13456 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13457 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13458 ; GFX940-TGSPLIT-NEXT: s_endpgm
13460 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13461 ; GFX11-WGP: ; %bb.0: ; %entry
13462 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13463 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13464 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13465 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13466 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13467 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13468 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13469 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13470 ; GFX11-WGP-NEXT: buffer_gl0_inv
13471 ; GFX11-WGP-NEXT: buffer_gl1_inv
13472 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13473 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13474 ; GFX11-WGP-NEXT: s_endpgm
13476 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13477 ; GFX11-CU: ; %bb.0: ; %entry
13478 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13479 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13480 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13481 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13482 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13483 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13484 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13485 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13486 ; GFX11-CU-NEXT: buffer_gl0_inv
13487 ; GFX11-CU-NEXT: buffer_gl1_inv
13488 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13489 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13490 ; GFX11-CU-NEXT: s_endpgm
13491 ptr %out, i32 %in, i32 %old) {
13493 %gep = getelementptr i32, ptr %out, i32 4
13494 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") monotonic seq_cst
13495 %val0 = extractvalue { i32, i1 } %val, 0
13496 store i32 %val0, ptr %out, align 4
13500 define amdgpu_kernel void @flat_system_one_as_acquire_seq_cst_ret_cmpxchg(
13501 ; GFX7-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13502 ; GFX7: ; %bb.0: ; %entry
13503 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13504 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13505 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13506 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13507 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13508 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13509 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13510 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13511 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13512 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13513 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13514 ; GFX7-NEXT: buffer_wbinvl1_vol
13515 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13516 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13517 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13518 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13519 ; GFX7-NEXT: s_endpgm
13521 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13522 ; GFX10-WGP: ; %bb.0: ; %entry
13523 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13524 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13525 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13526 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13527 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13528 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13529 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13530 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13531 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13532 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13533 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13534 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13535 ; GFX10-WGP-NEXT: buffer_gl0_inv
13536 ; GFX10-WGP-NEXT: buffer_gl1_inv
13537 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13538 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13539 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13540 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13541 ; GFX10-WGP-NEXT: s_endpgm
13543 ; GFX10-CU-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13544 ; GFX10-CU: ; %bb.0: ; %entry
13545 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13546 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13547 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13548 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13549 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13550 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13551 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13552 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13553 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13554 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13555 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13556 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13557 ; GFX10-CU-NEXT: buffer_gl0_inv
13558 ; GFX10-CU-NEXT: buffer_gl1_inv
13559 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13560 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13561 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13562 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13563 ; GFX10-CU-NEXT: s_endpgm
13565 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13566 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13567 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13568 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13569 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13570 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13571 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13572 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13573 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13574 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13575 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13576 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13577 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13578 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13579 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13580 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13581 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13582 ; SKIP-CACHE-INV-NEXT: s_endpgm
13584 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13585 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13586 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13587 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13588 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13589 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13590 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13591 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13592 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13593 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13594 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13595 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13596 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13597 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13598 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13600 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13601 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13602 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13603 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13604 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13605 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13606 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13607 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13608 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13609 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13610 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13611 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13612 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13613 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13615 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13616 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13617 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13618 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13619 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13620 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13621 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13622 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13623 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13624 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13625 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13626 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13627 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13628 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13630 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13631 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13632 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13633 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13634 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13635 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13636 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13637 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13638 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13639 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13640 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13641 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13642 ; GFX940-TGSPLIT-NEXT: s_endpgm
13644 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13645 ; GFX11-WGP: ; %bb.0: ; %entry
13646 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13647 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13648 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13649 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13650 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13651 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13652 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13653 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13654 ; GFX11-WGP-NEXT: buffer_gl0_inv
13655 ; GFX11-WGP-NEXT: buffer_gl1_inv
13656 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13657 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13658 ; GFX11-WGP-NEXT: s_endpgm
13660 ; GFX11-CU-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13661 ; GFX11-CU: ; %bb.0: ; %entry
13662 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13663 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13664 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13665 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13666 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13667 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13668 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13669 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13670 ; GFX11-CU-NEXT: buffer_gl0_inv
13671 ; GFX11-CU-NEXT: buffer_gl1_inv
13672 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13673 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13674 ; GFX11-CU-NEXT: s_endpgm
13675 ptr %out, i32 %in, i32 %old) {
13677 %gep = getelementptr i32, ptr %out, i32 4
13678 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acquire seq_cst
13679 %val0 = extractvalue { i32, i1 } %val, 0
13680 store i32 %val0, ptr %out, align 4
13684 define amdgpu_kernel void @flat_system_one_as_release_seq_cst_ret_cmpxchg(
13685 ; GFX7-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13686 ; GFX7: ; %bb.0: ; %entry
13687 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13688 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13689 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13690 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13691 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13692 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13693 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13694 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13695 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13696 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13697 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13698 ; GFX7-NEXT: buffer_wbinvl1_vol
13699 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13700 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13701 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13702 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13703 ; GFX7-NEXT: s_endpgm
13705 ; GFX10-WGP-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13706 ; GFX10-WGP: ; %bb.0: ; %entry
13707 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13708 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13709 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13710 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13711 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13712 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13713 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13714 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13715 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13716 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13717 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13718 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13719 ; GFX10-WGP-NEXT: buffer_gl0_inv
13720 ; GFX10-WGP-NEXT: buffer_gl1_inv
13721 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13722 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13723 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13724 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13725 ; GFX10-WGP-NEXT: s_endpgm
13727 ; GFX10-CU-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13728 ; GFX10-CU: ; %bb.0: ; %entry
13729 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13730 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13731 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13732 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13733 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13734 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13735 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13736 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13737 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13738 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13739 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13740 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13741 ; GFX10-CU-NEXT: buffer_gl0_inv
13742 ; GFX10-CU-NEXT: buffer_gl1_inv
13743 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13744 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13745 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13746 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13747 ; GFX10-CU-NEXT: s_endpgm
13749 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13750 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13751 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13752 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13753 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13754 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13755 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13756 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13757 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13758 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13759 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13760 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13761 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13762 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13763 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13764 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13765 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13766 ; SKIP-CACHE-INV-NEXT: s_endpgm
13768 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13769 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13770 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13771 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13772 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13773 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13774 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13775 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13776 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13777 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13778 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13779 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13780 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13781 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13782 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13784 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13785 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13786 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13787 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13788 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13789 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13790 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13791 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13792 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13793 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13794 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13795 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13796 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13797 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13799 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13800 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13801 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13802 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13803 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13804 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13805 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13806 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13807 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13808 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13809 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13810 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13811 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13812 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13814 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13815 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13816 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13817 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13818 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13819 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13820 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13821 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13822 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13823 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13824 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13825 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13826 ; GFX940-TGSPLIT-NEXT: s_endpgm
13828 ; GFX11-WGP-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13829 ; GFX11-WGP: ; %bb.0: ; %entry
13830 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13831 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13832 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13833 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13834 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13835 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13836 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13837 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13838 ; GFX11-WGP-NEXT: buffer_gl0_inv
13839 ; GFX11-WGP-NEXT: buffer_gl1_inv
13840 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13841 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13842 ; GFX11-WGP-NEXT: s_endpgm
13844 ; GFX11-CU-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13845 ; GFX11-CU: ; %bb.0: ; %entry
13846 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13847 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13848 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13849 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13850 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13851 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13852 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13853 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13854 ; GFX11-CU-NEXT: buffer_gl0_inv
13855 ; GFX11-CU-NEXT: buffer_gl1_inv
13856 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13857 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13858 ; GFX11-CU-NEXT: s_endpgm
13859 ptr %out, i32 %in, i32 %old) {
13861 %gep = getelementptr i32, ptr %out, i32 4
13862 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") release seq_cst
13863 %val0 = extractvalue { i32, i1 } %val, 0
13864 store i32 %val0, ptr %out, align 4
13868 define amdgpu_kernel void @flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg(
13869 ; GFX7-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13870 ; GFX7: ; %bb.0: ; %entry
13871 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13872 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13873 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13874 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13875 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13876 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13877 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13878 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13879 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13880 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13881 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13882 ; GFX7-NEXT: buffer_wbinvl1_vol
13883 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13884 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13885 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13886 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13887 ; GFX7-NEXT: s_endpgm
13889 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13890 ; GFX10-WGP: ; %bb.0: ; %entry
13891 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13892 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13893 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13894 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13895 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13896 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13897 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13898 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13899 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13900 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13901 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13902 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13903 ; GFX10-WGP-NEXT: buffer_gl0_inv
13904 ; GFX10-WGP-NEXT: buffer_gl1_inv
13905 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13906 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13907 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13908 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13909 ; GFX10-WGP-NEXT: s_endpgm
13911 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13912 ; GFX10-CU: ; %bb.0: ; %entry
13913 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13914 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13915 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13916 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13917 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13918 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13919 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13920 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13921 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13922 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13923 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13924 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13925 ; GFX10-CU-NEXT: buffer_gl0_inv
13926 ; GFX10-CU-NEXT: buffer_gl1_inv
13927 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13928 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13929 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13930 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13931 ; GFX10-CU-NEXT: s_endpgm
13933 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13934 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13935 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13936 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13937 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13938 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13939 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13940 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13941 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13942 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13943 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13944 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13945 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13946 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13947 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13948 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13949 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13950 ; SKIP-CACHE-INV-NEXT: s_endpgm
13952 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13953 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13954 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13955 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13956 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13957 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13958 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13959 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13960 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13961 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13962 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13963 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13964 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13965 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13966 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13968 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13969 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13970 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13971 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13972 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13973 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13974 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13975 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13976 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13977 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13978 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13979 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13980 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13981 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13983 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13984 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13985 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13986 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13987 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13988 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13989 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13990 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13991 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13992 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13993 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13994 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13995 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
13996 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13998 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13999 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14000 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14001 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14002 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
14003 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
14004 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14005 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14006 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
14007 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14008 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
14009 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
14010 ; GFX940-TGSPLIT-NEXT: s_endpgm
14012 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14013 ; GFX11-WGP: ; %bb.0: ; %entry
14014 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
14015 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14016 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
14017 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
14018 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14019 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14020 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
14021 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14022 ; GFX11-WGP-NEXT: buffer_gl0_inv
14023 ; GFX11-WGP-NEXT: buffer_gl1_inv
14024 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14025 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
14026 ; GFX11-WGP-NEXT: s_endpgm
14028 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14029 ; GFX11-CU: ; %bb.0: ; %entry
14030 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
14031 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14032 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
14033 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
14034 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14035 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
14036 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
14037 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14038 ; GFX11-CU-NEXT: buffer_gl0_inv
14039 ; GFX11-CU-NEXT: buffer_gl1_inv
14040 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14041 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
14042 ; GFX11-CU-NEXT: s_endpgm
14043 ptr %out, i32 %in, i32 %old) {
14045 %gep = getelementptr i32, ptr %out, i32 4
14046 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") acq_rel seq_cst
14047 %val0 = extractvalue { i32, i1 } %val, 0
14048 store i32 %val0, ptr %out, align 4
14052 define amdgpu_kernel void @flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg(
14053 ; GFX7-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14054 ; GFX7: ; %bb.0: ; %entry
14055 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14056 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14057 ; GFX7-NEXT: s_add_u32 s4, s0, 16
14058 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
14059 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14060 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
14061 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
14062 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
14063 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14064 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14065 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14066 ; GFX7-NEXT: buffer_wbinvl1_vol
14067 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
14068 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
14069 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14070 ; GFX7-NEXT: flat_store_dword v[0:1], v2
14071 ; GFX7-NEXT: s_endpgm
14073 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14074 ; GFX10-WGP: ; %bb.0: ; %entry
14075 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14076 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14077 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
14078 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
14079 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14080 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
14081 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
14082 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
14083 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
14084 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14085 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14086 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
14087 ; GFX10-WGP-NEXT: buffer_gl0_inv
14088 ; GFX10-WGP-NEXT: buffer_gl1_inv
14089 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
14090 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
14091 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14092 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
14093 ; GFX10-WGP-NEXT: s_endpgm
14095 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14096 ; GFX10-CU: ; %bb.0: ; %entry
14097 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14098 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14099 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
14100 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
14101 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14102 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
14103 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
14104 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
14105 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
14106 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
14107 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14108 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
14109 ; GFX10-CU-NEXT: buffer_gl0_inv
14110 ; GFX10-CU-NEXT: buffer_gl1_inv
14111 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
14112 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
14113 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14114 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
14115 ; GFX10-CU-NEXT: s_endpgm
14117 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14118 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14119 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14120 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14121 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
14122 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
14123 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
14124 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
14125 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
14126 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
14127 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14128 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14129 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14130 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14131 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
14132 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14133 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
14134 ; SKIP-CACHE-INV-NEXT: s_endpgm
14136 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14137 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14138 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14139 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14140 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
14141 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
14142 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
14143 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14144 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
14145 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14146 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
14147 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
14148 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14149 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
14150 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14152 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14153 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14154 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14155 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14156 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
14157 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
14158 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
14159 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14160 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
14161 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14162 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
14163 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
14164 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
14165 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14167 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14168 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14169 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14170 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14171 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
14172 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
14173 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14174 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14175 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
14176 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14177 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
14178 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14179 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
14180 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14182 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14183 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14184 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14185 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14186 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
14187 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
14188 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14189 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14190 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
14191 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14192 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
14193 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
14194 ; GFX940-TGSPLIT-NEXT: s_endpgm
14196 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14197 ; GFX11-WGP: ; %bb.0: ; %entry
14198 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
14199 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14200 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
14201 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
14202 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14203 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14204 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
14205 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14206 ; GFX11-WGP-NEXT: buffer_gl0_inv
14207 ; GFX11-WGP-NEXT: buffer_gl1_inv
14208 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14209 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
14210 ; GFX11-WGP-NEXT: s_endpgm
14212 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14213 ; GFX11-CU: ; %bb.0: ; %entry
14214 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
14215 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14216 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
14217 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
14218 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14219 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
14220 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
14221 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14222 ; GFX11-CU-NEXT: buffer_gl0_inv
14223 ; GFX11-CU-NEXT: buffer_gl1_inv
14224 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14225 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
14226 ; GFX11-CU-NEXT: s_endpgm
14227 ptr %out, i32 %in, i32 %old) {
14229 %gep = getelementptr i32, ptr %out, i32 4
14230 %val = cmpxchg volatile ptr %gep, i32 %old, i32 %in syncscope("one-as") seq_cst seq_cst
14231 %val0 = extractvalue { i32, i1 } %val, 0
14232 store i32 %val0, ptr %out, align 4