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
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
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_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
128 ; GFX11-WGP-NEXT: s_endpgm
130 ; GFX11-CU-LABEL: flat_system_unordered_load:
131 ; GFX11-CU: ; %bb.0: ; %entry
132 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
133 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
134 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
135 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1]
136 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
137 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
138 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
139 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
140 ; GFX11-CU-NEXT: s_endpgm
141 i32* %in, i32* %out) {
143 %val = load atomic i32, i32* %in unordered, align 4
144 store i32 %val, i32* %out
148 define amdgpu_kernel void @flat_system_monotonic_load(
149 ; GFX7-LABEL: flat_system_monotonic_load:
150 ; GFX7: ; %bb.0: ; %entry
151 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
152 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
153 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
154 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
155 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
156 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
157 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
158 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
159 ; GFX7-NEXT: flat_store_dword v[0:1], v2
160 ; GFX7-NEXT: s_endpgm
162 ; GFX10-WGP-LABEL: flat_system_monotonic_load:
163 ; GFX10-WGP: ; %bb.0: ; %entry
164 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
165 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
166 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
167 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
168 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
169 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
170 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
171 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
172 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
173 ; GFX10-WGP-NEXT: s_endpgm
175 ; GFX10-CU-LABEL: flat_system_monotonic_load:
176 ; GFX10-CU: ; %bb.0: ; %entry
177 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
178 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
179 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
180 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
181 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
182 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
183 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
184 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
185 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
186 ; GFX10-CU-NEXT: s_endpgm
188 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_load:
189 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
190 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
191 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
192 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
193 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
194 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
195 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
196 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
197 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
198 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
199 ; SKIP-CACHE-INV-NEXT: s_endpgm
201 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_load:
202 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
203 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
204 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
205 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
206 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
207 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
208 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
209 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
210 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
211 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
212 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
214 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_load:
215 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
216 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
217 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
218 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
219 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
220 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
221 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
222 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
223 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
224 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
225 ; GFX90A-TGSPLIT-NEXT: s_endpgm
227 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_load:
228 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
229 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
230 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
231 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
232 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
233 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
234 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
235 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
236 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
237 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
238 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
240 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_load:
241 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
242 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
243 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
244 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
245 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
246 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
247 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
248 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
249 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
250 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
251 ; GFX940-TGSPLIT-NEXT: s_endpgm
253 ; GFX11-WGP-LABEL: flat_system_monotonic_load:
254 ; GFX11-WGP: ; %bb.0: ; %entry
255 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
256 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
257 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
258 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
259 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
260 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
261 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
262 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
263 ; GFX11-WGP-NEXT: s_endpgm
265 ; GFX11-CU-LABEL: flat_system_monotonic_load:
266 ; GFX11-CU: ; %bb.0: ; %entry
267 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
268 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
269 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
270 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
271 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
272 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
273 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
274 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
275 ; GFX11-CU-NEXT: s_endpgm
276 i32* %in, i32* %out) {
278 %val = load atomic i32, i32* %in monotonic, align 4
279 store i32 %val, i32* %out
283 define amdgpu_kernel void @flat_system_acquire_load(
284 ; GFX7-LABEL: flat_system_acquire_load:
285 ; GFX7: ; %bb.0: ; %entry
286 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
287 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
288 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
289 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
290 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
291 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
292 ; GFX7-NEXT: buffer_wbinvl1_vol
293 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
294 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
295 ; GFX7-NEXT: flat_store_dword v[0:1], v2
296 ; GFX7-NEXT: s_endpgm
298 ; GFX10-WGP-LABEL: flat_system_acquire_load:
299 ; GFX10-WGP: ; %bb.0: ; %entry
300 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
301 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
302 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
303 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
304 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
305 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
306 ; GFX10-WGP-NEXT: buffer_gl0_inv
307 ; GFX10-WGP-NEXT: buffer_gl1_inv
308 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
309 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
310 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
311 ; GFX10-WGP-NEXT: s_endpgm
313 ; GFX10-CU-LABEL: flat_system_acquire_load:
314 ; GFX10-CU: ; %bb.0: ; %entry
315 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
316 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
317 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
318 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
319 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
320 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
321 ; GFX10-CU-NEXT: buffer_gl0_inv
322 ; GFX10-CU-NEXT: buffer_gl1_inv
323 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
324 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
325 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
326 ; GFX10-CU-NEXT: s_endpgm
328 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_load:
329 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
330 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
331 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
332 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
333 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
334 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
335 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
336 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
337 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
338 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
339 ; SKIP-CACHE-INV-NEXT: s_endpgm
341 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_load:
342 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
343 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
344 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
345 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
346 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
347 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
348 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
349 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
350 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
351 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
352 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
353 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
354 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
356 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_load:
357 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
358 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
359 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
360 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
361 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
362 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
363 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
364 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
365 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
366 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
367 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
368 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
369 ; GFX90A-TGSPLIT-NEXT: s_endpgm
371 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_load:
372 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
373 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
374 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
375 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
376 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
377 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
378 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
379 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
380 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
381 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
382 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
383 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
385 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_load:
386 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
387 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
388 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
389 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
390 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
391 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
392 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
393 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
394 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
395 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
396 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
397 ; GFX940-TGSPLIT-NEXT: s_endpgm
399 ; GFX11-WGP-LABEL: flat_system_acquire_load:
400 ; GFX11-WGP: ; %bb.0: ; %entry
401 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
402 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
403 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
404 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
405 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
406 ; GFX11-WGP-NEXT: buffer_gl0_inv
407 ; GFX11-WGP-NEXT: buffer_gl1_inv
408 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
409 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
410 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
411 ; GFX11-WGP-NEXT: s_endpgm
413 ; GFX11-CU-LABEL: flat_system_acquire_load:
414 ; GFX11-CU: ; %bb.0: ; %entry
415 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
416 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
417 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
418 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
419 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
420 ; GFX11-CU-NEXT: buffer_gl0_inv
421 ; GFX11-CU-NEXT: buffer_gl1_inv
422 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
423 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
424 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
425 ; GFX11-CU-NEXT: s_endpgm
426 i32* %in, i32* %out) {
428 %val = load atomic i32, i32* %in acquire, align 4
429 store i32 %val, i32* %out
433 define amdgpu_kernel void @flat_system_seq_cst_load(
434 ; GFX7-LABEL: flat_system_seq_cst_load:
435 ; GFX7: ; %bb.0: ; %entry
436 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
437 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
438 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
439 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
440 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
441 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
442 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
443 ; GFX7-NEXT: buffer_wbinvl1_vol
444 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
445 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
446 ; GFX7-NEXT: flat_store_dword v[0:1], v2
447 ; GFX7-NEXT: s_endpgm
449 ; GFX10-WGP-LABEL: flat_system_seq_cst_load:
450 ; GFX10-WGP: ; %bb.0: ; %entry
451 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
452 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
453 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
454 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
455 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
456 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
457 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
458 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
459 ; GFX10-WGP-NEXT: buffer_gl0_inv
460 ; GFX10-WGP-NEXT: buffer_gl1_inv
461 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
462 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
463 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
464 ; GFX10-WGP-NEXT: s_endpgm
466 ; GFX10-CU-LABEL: flat_system_seq_cst_load:
467 ; GFX10-CU: ; %bb.0: ; %entry
468 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
469 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
470 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
471 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
472 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
473 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
474 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
475 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
476 ; GFX10-CU-NEXT: buffer_gl0_inv
477 ; GFX10-CU-NEXT: buffer_gl1_inv
478 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
479 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
480 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
481 ; GFX10-CU-NEXT: s_endpgm
483 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_load:
484 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
485 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
486 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
487 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
488 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
489 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
490 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
491 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
492 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
493 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
494 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
495 ; SKIP-CACHE-INV-NEXT: s_endpgm
497 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_load:
498 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
499 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
500 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
501 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
502 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
503 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
504 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
505 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
506 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
507 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
508 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
509 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
510 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
511 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
513 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_load:
514 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
515 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
516 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
517 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
518 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
519 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
520 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
521 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
522 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
523 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
524 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
525 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
526 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
527 ; GFX90A-TGSPLIT-NEXT: s_endpgm
529 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_load:
530 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
531 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
532 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
533 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
534 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
535 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
536 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
537 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
538 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
539 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
540 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
541 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
542 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
544 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_load:
545 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
546 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
547 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
548 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
549 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
550 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
551 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
552 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
553 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
554 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
555 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
556 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
557 ; GFX940-TGSPLIT-NEXT: s_endpgm
559 ; GFX11-WGP-LABEL: flat_system_seq_cst_load:
560 ; GFX11-WGP: ; %bb.0: ; %entry
561 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
562 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
563 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
564 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
565 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
566 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
567 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
568 ; GFX11-WGP-NEXT: buffer_gl0_inv
569 ; GFX11-WGP-NEXT: buffer_gl1_inv
570 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
571 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
572 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
573 ; GFX11-WGP-NEXT: s_endpgm
575 ; GFX11-CU-LABEL: flat_system_seq_cst_load:
576 ; GFX11-CU: ; %bb.0: ; %entry
577 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
578 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
579 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
580 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
581 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
582 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
583 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
584 ; GFX11-CU-NEXT: buffer_gl0_inv
585 ; GFX11-CU-NEXT: buffer_gl1_inv
586 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
587 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
588 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
589 ; GFX11-CU-NEXT: s_endpgm
590 i32* %in, i32* %out) {
592 %val = load atomic i32, i32* %in seq_cst, align 4
593 store i32 %val, i32* %out
597 define amdgpu_kernel void @flat_system_unordered_store(
598 ; GFX7-LABEL: flat_system_unordered_store:
599 ; GFX7: ; %bb.0: ; %entry
600 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
601 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
602 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
603 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
604 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
605 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
606 ; GFX7-NEXT: flat_store_dword v[0:1], v2
607 ; GFX7-NEXT: s_endpgm
609 ; GFX10-WGP-LABEL: flat_system_unordered_store:
610 ; GFX10-WGP: ; %bb.0: ; %entry
611 ; GFX10-WGP-NEXT: s_clause 0x1
612 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
613 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
614 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
615 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
616 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
617 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
618 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
619 ; GFX10-WGP-NEXT: s_endpgm
621 ; GFX10-CU-LABEL: flat_system_unordered_store:
622 ; GFX10-CU: ; %bb.0: ; %entry
623 ; GFX10-CU-NEXT: s_clause 0x1
624 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
625 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
626 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
627 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
628 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
629 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
630 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
631 ; GFX10-CU-NEXT: s_endpgm
633 ; SKIP-CACHE-INV-LABEL: flat_system_unordered_store:
634 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
635 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
636 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
637 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
638 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
639 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
640 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
641 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
642 ; SKIP-CACHE-INV-NEXT: s_endpgm
644 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_unordered_store:
645 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
646 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
647 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
648 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
649 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
650 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
651 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
652 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
654 ; GFX90A-TGSPLIT-LABEL: flat_system_unordered_store:
655 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
656 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
657 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
658 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
659 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
660 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
661 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
662 ; GFX90A-TGSPLIT-NEXT: s_endpgm
664 ; GFX940-NOTTGSPLIT-LABEL: flat_system_unordered_store:
665 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
666 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
667 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
668 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
669 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
670 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
671 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
672 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
674 ; GFX940-TGSPLIT-LABEL: flat_system_unordered_store:
675 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
676 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
677 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
678 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
679 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
680 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
681 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
682 ; GFX940-TGSPLIT-NEXT: s_endpgm
684 ; GFX11-WGP-LABEL: flat_system_unordered_store:
685 ; GFX11-WGP: ; %bb.0: ; %entry
686 ; GFX11-WGP-NEXT: s_clause 0x1
687 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
688 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
689 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
690 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
691 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
692 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
693 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
694 ; GFX11-WGP-NEXT: s_endpgm
696 ; GFX11-CU-LABEL: flat_system_unordered_store:
697 ; GFX11-CU: ; %bb.0: ; %entry
698 ; GFX11-CU-NEXT: s_clause 0x1
699 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
700 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
701 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
702 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
703 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
704 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
705 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
706 ; GFX11-CU-NEXT: s_endpgm
707 i32 %in, i32* %out) {
709 store atomic i32 %in, i32* %out unordered, align 4
713 define amdgpu_kernel void @flat_system_monotonic_store(
714 ; GFX7-LABEL: flat_system_monotonic_store:
715 ; GFX7: ; %bb.0: ; %entry
716 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
717 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
718 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
719 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
720 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
721 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
722 ; GFX7-NEXT: flat_store_dword v[0:1], v2
723 ; GFX7-NEXT: s_endpgm
725 ; GFX10-WGP-LABEL: flat_system_monotonic_store:
726 ; GFX10-WGP: ; %bb.0: ; %entry
727 ; GFX10-WGP-NEXT: s_clause 0x1
728 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
729 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
730 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
731 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
732 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
733 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
734 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
735 ; GFX10-WGP-NEXT: s_endpgm
737 ; GFX10-CU-LABEL: flat_system_monotonic_store:
738 ; GFX10-CU: ; %bb.0: ; %entry
739 ; GFX10-CU-NEXT: s_clause 0x1
740 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
741 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
742 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
743 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
744 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
745 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
746 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
747 ; GFX10-CU-NEXT: s_endpgm
749 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_store:
750 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
751 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
752 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
753 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
754 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
755 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
756 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
757 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
758 ; SKIP-CACHE-INV-NEXT: s_endpgm
760 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_store:
761 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
762 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
763 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
764 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
765 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
766 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
767 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
768 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
770 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_store:
771 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
772 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
773 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
774 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
775 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
776 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
777 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
778 ; GFX90A-TGSPLIT-NEXT: s_endpgm
780 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_store:
781 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
782 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
783 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
784 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
785 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
786 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
787 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
788 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
790 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_store:
791 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
792 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
793 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
794 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
795 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
796 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
797 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
798 ; GFX940-TGSPLIT-NEXT: s_endpgm
800 ; GFX11-WGP-LABEL: flat_system_monotonic_store:
801 ; GFX11-WGP: ; %bb.0: ; %entry
802 ; GFX11-WGP-NEXT: s_clause 0x1
803 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
804 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
805 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
806 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
807 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
808 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
809 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
810 ; GFX11-WGP-NEXT: s_endpgm
812 ; GFX11-CU-LABEL: flat_system_monotonic_store:
813 ; GFX11-CU: ; %bb.0: ; %entry
814 ; GFX11-CU-NEXT: s_clause 0x1
815 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
816 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
817 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
818 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
819 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
820 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
821 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
822 ; GFX11-CU-NEXT: s_endpgm
823 i32 %in, i32* %out) {
825 store atomic i32 %in, i32* %out monotonic, align 4
829 define amdgpu_kernel void @flat_system_release_store(
830 ; GFX7-LABEL: flat_system_release_store:
831 ; GFX7: ; %bb.0: ; %entry
832 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
833 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
834 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
835 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
836 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
837 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
838 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
839 ; GFX7-NEXT: flat_store_dword v[0:1], v2
840 ; GFX7-NEXT: s_endpgm
842 ; GFX10-WGP-LABEL: flat_system_release_store:
843 ; GFX10-WGP: ; %bb.0: ; %entry
844 ; GFX10-WGP-NEXT: s_clause 0x1
845 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
846 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
847 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
848 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
849 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
850 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
851 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
852 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
853 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
854 ; GFX10-WGP-NEXT: s_endpgm
856 ; GFX10-CU-LABEL: flat_system_release_store:
857 ; GFX10-CU: ; %bb.0: ; %entry
858 ; GFX10-CU-NEXT: s_clause 0x1
859 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
860 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
861 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
862 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
863 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
864 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
865 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
866 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
867 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
868 ; GFX10-CU-NEXT: s_endpgm
870 ; SKIP-CACHE-INV-LABEL: flat_system_release_store:
871 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
872 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
873 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
874 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
875 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
876 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
877 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
878 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
879 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
880 ; SKIP-CACHE-INV-NEXT: s_endpgm
882 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_store:
883 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
884 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
885 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
886 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
887 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
888 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
889 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
890 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
891 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
892 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
894 ; GFX90A-TGSPLIT-LABEL: flat_system_release_store:
895 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
896 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
897 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
898 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
899 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
900 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
901 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
902 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
903 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
904 ; GFX90A-TGSPLIT-NEXT: s_endpgm
906 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_store:
907 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
908 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
909 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
910 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
911 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
912 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
913 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
914 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
915 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
916 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
918 ; GFX940-TGSPLIT-LABEL: flat_system_release_store:
919 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
920 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
921 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
922 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
923 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
924 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
925 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
926 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
927 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
928 ; GFX940-TGSPLIT-NEXT: s_endpgm
930 ; GFX11-WGP-LABEL: flat_system_release_store:
931 ; GFX11-WGP: ; %bb.0: ; %entry
932 ; GFX11-WGP-NEXT: s_clause 0x1
933 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
934 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
935 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
936 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
937 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
938 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
939 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
940 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
941 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
942 ; GFX11-WGP-NEXT: s_endpgm
944 ; GFX11-CU-LABEL: flat_system_release_store:
945 ; GFX11-CU: ; %bb.0: ; %entry
946 ; GFX11-CU-NEXT: s_clause 0x1
947 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
948 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
949 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
950 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
951 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
952 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
953 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
954 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
955 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
956 ; GFX11-CU-NEXT: s_endpgm
957 i32 %in, i32* %out) {
959 store atomic i32 %in, i32* %out release, align 4
963 define amdgpu_kernel void @flat_system_seq_cst_store(
964 ; GFX7-LABEL: flat_system_seq_cst_store:
965 ; GFX7: ; %bb.0: ; %entry
966 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
967 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
968 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
969 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
970 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
971 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
972 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
973 ; GFX7-NEXT: flat_store_dword v[0:1], v2
974 ; GFX7-NEXT: s_endpgm
976 ; GFX10-WGP-LABEL: flat_system_seq_cst_store:
977 ; GFX10-WGP: ; %bb.0: ; %entry
978 ; GFX10-WGP-NEXT: s_clause 0x1
979 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
980 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
981 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
982 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
983 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
984 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
985 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
986 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
987 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
988 ; GFX10-WGP-NEXT: s_endpgm
990 ; GFX10-CU-LABEL: flat_system_seq_cst_store:
991 ; GFX10-CU: ; %bb.0: ; %entry
992 ; GFX10-CU-NEXT: s_clause 0x1
993 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
994 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
995 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
996 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
997 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
998 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
999 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1000 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1001 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
1002 ; GFX10-CU-NEXT: s_endpgm
1004 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_store:
1005 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1006 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
1007 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
1008 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1009 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1010 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1011 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1012 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1013 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
1014 ; SKIP-CACHE-INV-NEXT: s_endpgm
1016 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_store:
1017 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1018 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
1019 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
1020 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1021 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1022 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1023 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1024 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1025 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
1026 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1028 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_store:
1029 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1030 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
1031 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
1032 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1033 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1034 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1035 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1036 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1037 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
1038 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1040 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_store:
1041 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1042 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
1043 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
1044 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1045 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1046 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1047 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1048 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1049 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
1050 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1052 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_store:
1053 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1054 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
1055 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
1056 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1057 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1058 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1059 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1060 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1061 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
1062 ; GFX940-TGSPLIT-NEXT: s_endpgm
1064 ; GFX11-WGP-LABEL: flat_system_seq_cst_store:
1065 ; GFX11-WGP: ; %bb.0: ; %entry
1066 ; GFX11-WGP-NEXT: s_clause 0x1
1067 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
1068 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
1069 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1070 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1071 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1072 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1073 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1074 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
1075 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1076 ; GFX11-WGP-NEXT: s_endpgm
1078 ; GFX11-CU-LABEL: flat_system_seq_cst_store:
1079 ; GFX11-CU: ; %bb.0: ; %entry
1080 ; GFX11-CU-NEXT: s_clause 0x1
1081 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
1082 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
1083 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1084 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1085 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1086 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1087 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1088 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
1089 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1090 ; GFX11-CU-NEXT: s_endpgm
1091 i32 %in, i32* %out) {
1093 store atomic i32 %in, i32* %out seq_cst, align 4
1097 define amdgpu_kernel void @flat_system_monotonic_atomicrmw(
1098 ; GFX7-LABEL: flat_system_monotonic_atomicrmw:
1099 ; GFX7: ; %bb.0: ; %entry
1100 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1101 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1102 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1103 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1104 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1105 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1106 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1107 ; GFX7-NEXT: s_endpgm
1109 ; GFX10-WGP-LABEL: flat_system_monotonic_atomicrmw:
1110 ; GFX10-WGP: ; %bb.0: ; %entry
1111 ; GFX10-WGP-NEXT: s_clause 0x1
1112 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1113 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1114 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1115 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1116 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1117 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1118 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1119 ; GFX10-WGP-NEXT: s_endpgm
1121 ; GFX10-CU-LABEL: flat_system_monotonic_atomicrmw:
1122 ; GFX10-CU: ; %bb.0: ; %entry
1123 ; GFX10-CU-NEXT: s_clause 0x1
1124 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1125 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1126 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1127 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1128 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1129 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1130 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1131 ; GFX10-CU-NEXT: s_endpgm
1133 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_atomicrmw:
1134 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1135 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1136 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1137 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1138 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1139 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1140 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1141 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1142 ; SKIP-CACHE-INV-NEXT: s_endpgm
1144 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_atomicrmw:
1145 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1146 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1147 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1148 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1149 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1150 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1151 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1152 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1154 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_atomicrmw:
1155 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1156 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1157 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1158 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1159 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1160 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1161 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1162 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1164 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_atomicrmw:
1165 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1166 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1167 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1168 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1169 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1170 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1171 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1172 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1174 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_atomicrmw:
1175 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1176 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1177 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1178 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1179 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1180 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1181 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1182 ; GFX940-TGSPLIT-NEXT: s_endpgm
1184 ; GFX11-WGP-LABEL: flat_system_monotonic_atomicrmw:
1185 ; GFX11-WGP: ; %bb.0: ; %entry
1186 ; GFX11-WGP-NEXT: s_clause 0x1
1187 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1188 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1189 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1190 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1191 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1192 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1193 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1194 ; GFX11-WGP-NEXT: s_endpgm
1196 ; GFX11-CU-LABEL: flat_system_monotonic_atomicrmw:
1197 ; GFX11-CU: ; %bb.0: ; %entry
1198 ; GFX11-CU-NEXT: s_clause 0x1
1199 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1200 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1201 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1202 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1203 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1204 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1205 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1206 ; GFX11-CU-NEXT: s_endpgm
1207 i32* %out, i32 %in) {
1209 %val = atomicrmw volatile xchg i32* %out, i32 %in monotonic
1213 define amdgpu_kernel void @flat_system_acquire_atomicrmw(
1214 ; GFX7-LABEL: flat_system_acquire_atomicrmw:
1215 ; GFX7: ; %bb.0: ; %entry
1216 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1217 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1218 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1219 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1220 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1221 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1222 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1223 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1224 ; GFX7-NEXT: buffer_wbinvl1_vol
1225 ; GFX7-NEXT: s_endpgm
1227 ; GFX10-WGP-LABEL: flat_system_acquire_atomicrmw:
1228 ; GFX10-WGP: ; %bb.0: ; %entry
1229 ; GFX10-WGP-NEXT: s_clause 0x1
1230 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1231 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1232 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1233 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1234 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1235 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1236 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1237 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1238 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1239 ; GFX10-WGP-NEXT: buffer_gl0_inv
1240 ; GFX10-WGP-NEXT: buffer_gl1_inv
1241 ; GFX10-WGP-NEXT: s_endpgm
1243 ; GFX10-CU-LABEL: flat_system_acquire_atomicrmw:
1244 ; GFX10-CU: ; %bb.0: ; %entry
1245 ; GFX10-CU-NEXT: s_clause 0x1
1246 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1247 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1248 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1249 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1250 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1251 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1252 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1253 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1254 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1255 ; GFX10-CU-NEXT: buffer_gl0_inv
1256 ; GFX10-CU-NEXT: buffer_gl1_inv
1257 ; GFX10-CU-NEXT: s_endpgm
1259 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_atomicrmw:
1260 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1261 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1262 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1263 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1264 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1265 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1266 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1267 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1268 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1269 ; SKIP-CACHE-INV-NEXT: s_endpgm
1271 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_atomicrmw:
1272 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1273 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1274 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1275 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1276 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1277 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1278 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1279 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1280 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1281 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1282 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1284 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_atomicrmw:
1285 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1286 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1287 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1288 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1289 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1290 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1291 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1292 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1293 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1294 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1295 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1297 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_atomicrmw:
1298 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1299 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1300 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1301 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1302 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1303 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1304 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1305 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1306 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1307 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1309 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_atomicrmw:
1310 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1311 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1312 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1313 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1314 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1315 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1316 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1317 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1318 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1319 ; GFX940-TGSPLIT-NEXT: s_endpgm
1321 ; GFX11-WGP-LABEL: flat_system_acquire_atomicrmw:
1322 ; GFX11-WGP: ; %bb.0: ; %entry
1323 ; GFX11-WGP-NEXT: s_clause 0x1
1324 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1325 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1326 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1327 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1328 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1329 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1330 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1331 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1332 ; GFX11-WGP-NEXT: buffer_gl0_inv
1333 ; GFX11-WGP-NEXT: buffer_gl1_inv
1334 ; GFX11-WGP-NEXT: s_endpgm
1336 ; GFX11-CU-LABEL: flat_system_acquire_atomicrmw:
1337 ; GFX11-CU: ; %bb.0: ; %entry
1338 ; GFX11-CU-NEXT: s_clause 0x1
1339 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1340 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1341 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1342 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1343 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1344 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1345 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1346 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1347 ; GFX11-CU-NEXT: buffer_gl0_inv
1348 ; GFX11-CU-NEXT: buffer_gl1_inv
1349 ; GFX11-CU-NEXT: s_endpgm
1350 i32* %out, i32 %in) {
1352 %val = atomicrmw volatile xchg i32* %out, i32 %in acquire
1356 define amdgpu_kernel void @flat_system_release_atomicrmw(
1357 ; GFX7-LABEL: flat_system_release_atomicrmw:
1358 ; GFX7: ; %bb.0: ; %entry
1359 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1360 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1361 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1362 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1363 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1364 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1365 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1366 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1367 ; GFX7-NEXT: s_endpgm
1369 ; GFX10-WGP-LABEL: flat_system_release_atomicrmw:
1370 ; GFX10-WGP: ; %bb.0: ; %entry
1371 ; GFX10-WGP-NEXT: s_clause 0x1
1372 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1373 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1374 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1375 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1376 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1377 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1378 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1379 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1380 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1381 ; GFX10-WGP-NEXT: s_endpgm
1383 ; GFX10-CU-LABEL: flat_system_release_atomicrmw:
1384 ; GFX10-CU: ; %bb.0: ; %entry
1385 ; GFX10-CU-NEXT: s_clause 0x1
1386 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1387 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1388 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1389 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1390 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1391 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1392 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1393 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1394 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1395 ; GFX10-CU-NEXT: s_endpgm
1397 ; SKIP-CACHE-INV-LABEL: flat_system_release_atomicrmw:
1398 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1399 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1400 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1401 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1402 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1403 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1404 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1405 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1406 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1407 ; SKIP-CACHE-INV-NEXT: s_endpgm
1409 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_atomicrmw:
1410 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1411 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1412 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1413 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1414 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1415 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1416 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1417 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1418 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1419 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1421 ; GFX90A-TGSPLIT-LABEL: flat_system_release_atomicrmw:
1422 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1423 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1424 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1425 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1426 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1427 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1428 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1429 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1430 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1431 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1433 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_atomicrmw:
1434 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1435 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1436 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1437 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1438 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1439 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1440 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1441 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1442 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1443 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1445 ; GFX940-TGSPLIT-LABEL: flat_system_release_atomicrmw:
1446 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1447 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1448 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1449 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1450 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1451 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1452 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1453 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1454 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1455 ; GFX940-TGSPLIT-NEXT: s_endpgm
1457 ; GFX11-WGP-LABEL: flat_system_release_atomicrmw:
1458 ; GFX11-WGP: ; %bb.0: ; %entry
1459 ; GFX11-WGP-NEXT: s_clause 0x1
1460 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1461 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1462 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1463 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1464 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1465 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1466 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1467 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1468 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1469 ; GFX11-WGP-NEXT: s_endpgm
1471 ; GFX11-CU-LABEL: flat_system_release_atomicrmw:
1472 ; GFX11-CU: ; %bb.0: ; %entry
1473 ; GFX11-CU-NEXT: s_clause 0x1
1474 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1475 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1476 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1477 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1478 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1479 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1480 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1481 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1482 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1483 ; GFX11-CU-NEXT: s_endpgm
1484 i32* %out, i32 %in) {
1486 %val = atomicrmw volatile xchg i32* %out, i32 %in release
1490 define amdgpu_kernel void @flat_system_acq_rel_atomicrmw(
1491 ; GFX7-LABEL: flat_system_acq_rel_atomicrmw:
1492 ; GFX7: ; %bb.0: ; %entry
1493 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1494 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1495 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1496 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1497 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1498 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1499 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1500 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1501 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1502 ; GFX7-NEXT: buffer_wbinvl1_vol
1503 ; GFX7-NEXT: s_endpgm
1505 ; GFX10-WGP-LABEL: flat_system_acq_rel_atomicrmw:
1506 ; GFX10-WGP: ; %bb.0: ; %entry
1507 ; GFX10-WGP-NEXT: s_clause 0x1
1508 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1509 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1510 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1511 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1512 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1513 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1514 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1515 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1516 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1517 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1518 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1519 ; GFX10-WGP-NEXT: buffer_gl0_inv
1520 ; GFX10-WGP-NEXT: buffer_gl1_inv
1521 ; GFX10-WGP-NEXT: s_endpgm
1523 ; GFX10-CU-LABEL: flat_system_acq_rel_atomicrmw:
1524 ; GFX10-CU: ; %bb.0: ; %entry
1525 ; GFX10-CU-NEXT: s_clause 0x1
1526 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1527 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1528 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1529 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1530 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1531 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1532 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1533 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1534 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1535 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1536 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1537 ; GFX10-CU-NEXT: buffer_gl0_inv
1538 ; GFX10-CU-NEXT: buffer_gl1_inv
1539 ; GFX10-CU-NEXT: s_endpgm
1541 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_atomicrmw:
1542 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1543 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1544 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1545 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1546 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1547 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1548 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1549 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1550 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1551 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1552 ; SKIP-CACHE-INV-NEXT: s_endpgm
1554 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_atomicrmw:
1555 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1556 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1557 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1558 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1559 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1560 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1561 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1562 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1563 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1564 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1565 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1566 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1567 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1569 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_atomicrmw:
1570 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1571 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1572 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1573 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1574 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1575 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1576 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1577 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1578 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1579 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1580 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1581 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1582 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1584 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_atomicrmw:
1585 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1586 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1587 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1588 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1589 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1590 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1591 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1592 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1593 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1594 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1595 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1596 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1598 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_atomicrmw:
1599 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1600 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1601 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1602 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1603 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1604 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1605 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1606 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1607 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1608 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1609 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1610 ; GFX940-TGSPLIT-NEXT: s_endpgm
1612 ; GFX11-WGP-LABEL: flat_system_acq_rel_atomicrmw:
1613 ; GFX11-WGP: ; %bb.0: ; %entry
1614 ; GFX11-WGP-NEXT: s_clause 0x1
1615 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1616 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1617 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1618 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1619 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1620 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1621 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1622 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1623 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1624 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1625 ; GFX11-WGP-NEXT: buffer_gl0_inv
1626 ; GFX11-WGP-NEXT: buffer_gl1_inv
1627 ; GFX11-WGP-NEXT: s_endpgm
1629 ; GFX11-CU-LABEL: flat_system_acq_rel_atomicrmw:
1630 ; GFX11-CU: ; %bb.0: ; %entry
1631 ; GFX11-CU-NEXT: s_clause 0x1
1632 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1633 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1634 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1635 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1636 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1637 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1638 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1639 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1640 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1641 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1642 ; GFX11-CU-NEXT: buffer_gl0_inv
1643 ; GFX11-CU-NEXT: buffer_gl1_inv
1644 ; GFX11-CU-NEXT: s_endpgm
1645 i32* %out, i32 %in) {
1647 %val = atomicrmw volatile xchg i32* %out, i32 %in acq_rel
1651 define amdgpu_kernel void @flat_system_seq_cst_atomicrmw(
1652 ; GFX7-LABEL: flat_system_seq_cst_atomicrmw:
1653 ; GFX7: ; %bb.0: ; %entry
1654 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1655 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1656 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1657 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1658 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1659 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1660 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1661 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
1662 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1663 ; GFX7-NEXT: buffer_wbinvl1_vol
1664 ; GFX7-NEXT: s_endpgm
1666 ; GFX10-WGP-LABEL: flat_system_seq_cst_atomicrmw:
1667 ; GFX10-WGP: ; %bb.0: ; %entry
1668 ; GFX10-WGP-NEXT: s_clause 0x1
1669 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1670 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1671 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1672 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1673 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1674 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1675 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1676 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1677 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
1678 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1679 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1680 ; GFX10-WGP-NEXT: buffer_gl0_inv
1681 ; GFX10-WGP-NEXT: buffer_gl1_inv
1682 ; GFX10-WGP-NEXT: s_endpgm
1684 ; GFX10-CU-LABEL: flat_system_seq_cst_atomicrmw:
1685 ; GFX10-CU: ; %bb.0: ; %entry
1686 ; GFX10-CU-NEXT: s_clause 0x1
1687 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1688 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1689 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1690 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1691 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1692 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1693 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1694 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1695 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
1696 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1697 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
1698 ; GFX10-CU-NEXT: buffer_gl0_inv
1699 ; GFX10-CU-NEXT: buffer_gl1_inv
1700 ; GFX10-CU-NEXT: s_endpgm
1702 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_atomicrmw:
1703 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1704 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1705 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1706 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1707 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1708 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1709 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1710 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1711 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
1712 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1713 ; SKIP-CACHE-INV-NEXT: s_endpgm
1715 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_atomicrmw:
1716 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1717 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1718 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1719 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1720 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1721 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1722 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
1723 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1724 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1725 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1726 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1727 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1728 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1730 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_atomicrmw:
1731 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1732 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1733 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1734 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1735 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1736 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1737 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
1738 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1739 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
1740 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1741 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1742 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1743 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1745 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_atomicrmw:
1746 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1747 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1748 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1749 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1750 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1751 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1752 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1753 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1754 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1755 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1756 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1757 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1759 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_atomicrmw:
1760 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1761 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1762 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1763 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1764 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1765 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1766 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
1767 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1768 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
1769 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1770 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1771 ; GFX940-TGSPLIT-NEXT: s_endpgm
1773 ; GFX11-WGP-LABEL: flat_system_seq_cst_atomicrmw:
1774 ; GFX11-WGP: ; %bb.0: ; %entry
1775 ; GFX11-WGP-NEXT: s_clause 0x1
1776 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1777 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1778 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1779 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1780 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1781 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1782 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1783 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
1784 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1785 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1786 ; GFX11-WGP-NEXT: buffer_gl0_inv
1787 ; GFX11-WGP-NEXT: buffer_gl1_inv
1788 ; GFX11-WGP-NEXT: s_endpgm
1790 ; GFX11-CU-LABEL: flat_system_seq_cst_atomicrmw:
1791 ; GFX11-CU: ; %bb.0: ; %entry
1792 ; GFX11-CU-NEXT: s_clause 0x1
1793 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1794 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1795 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1796 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1797 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1798 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1799 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1800 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
1801 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1802 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
1803 ; GFX11-CU-NEXT: buffer_gl0_inv
1804 ; GFX11-CU-NEXT: buffer_gl1_inv
1805 ; GFX11-CU-NEXT: s_endpgm
1806 i32* %out, i32 %in) {
1808 %val = atomicrmw volatile xchg i32* %out, i32 %in seq_cst
1812 define amdgpu_kernel void @flat_system_acquire_ret_atomicrmw(
1813 ; GFX7-LABEL: flat_system_acquire_ret_atomicrmw:
1814 ; GFX7: ; %bb.0: ; %entry
1815 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1816 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1817 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1818 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1819 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1820 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1821 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1822 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1823 ; GFX7-NEXT: buffer_wbinvl1_vol
1824 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1825 ; GFX7-NEXT: s_endpgm
1827 ; GFX10-WGP-LABEL: flat_system_acquire_ret_atomicrmw:
1828 ; GFX10-WGP: ; %bb.0: ; %entry
1829 ; GFX10-WGP-NEXT: s_clause 0x1
1830 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1831 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1832 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1833 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1834 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1835 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1836 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1837 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1838 ; GFX10-WGP-NEXT: buffer_gl0_inv
1839 ; GFX10-WGP-NEXT: buffer_gl1_inv
1840 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
1841 ; GFX10-WGP-NEXT: s_endpgm
1843 ; GFX10-CU-LABEL: flat_system_acquire_ret_atomicrmw:
1844 ; GFX10-CU: ; %bb.0: ; %entry
1845 ; GFX10-CU-NEXT: s_clause 0x1
1846 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1847 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
1848 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1849 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
1850 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
1851 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
1852 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1853 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1854 ; GFX10-CU-NEXT: buffer_gl0_inv
1855 ; GFX10-CU-NEXT: buffer_gl1_inv
1856 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
1857 ; GFX10-CU-NEXT: s_endpgm
1859 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_ret_atomicrmw:
1860 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1861 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1862 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
1863 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1864 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
1865 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
1866 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
1867 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1868 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1869 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
1870 ; SKIP-CACHE-INV-NEXT: s_endpgm
1872 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_ret_atomicrmw:
1873 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1874 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1875 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1876 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1877 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1878 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1879 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1880 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1881 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
1882 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
1883 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
1884 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1886 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_ret_atomicrmw:
1887 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1888 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1889 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
1890 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1891 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
1892 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
1893 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1894 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1895 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
1896 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
1897 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
1898 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1900 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_ret_atomicrmw:
1901 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1902 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1903 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1904 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1905 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1906 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1907 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
1908 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1909 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
1910 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
1911 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1913 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_ret_atomicrmw:
1914 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1915 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
1916 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
1917 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1918 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
1919 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
1920 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
1921 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
1922 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
1923 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
1924 ; GFX940-TGSPLIT-NEXT: s_endpgm
1926 ; GFX11-WGP-LABEL: flat_system_acquire_ret_atomicrmw:
1927 ; GFX11-WGP: ; %bb.0: ; %entry
1928 ; GFX11-WGP-NEXT: s_clause 0x1
1929 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1930 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
1931 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1932 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1933 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
1934 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
1935 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1936 ; GFX11-WGP-NEXT: buffer_gl0_inv
1937 ; GFX11-WGP-NEXT: buffer_gl1_inv
1938 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
1939 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1940 ; GFX11-WGP-NEXT: s_endpgm
1942 ; GFX11-CU-LABEL: flat_system_acquire_ret_atomicrmw:
1943 ; GFX11-CU: ; %bb.0: ; %entry
1944 ; GFX11-CU-NEXT: s_clause 0x1
1945 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
1946 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
1947 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1948 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
1949 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
1950 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
1951 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1952 ; GFX11-CU-NEXT: buffer_gl0_inv
1953 ; GFX11-CU-NEXT: buffer_gl1_inv
1954 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
1955 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1956 ; GFX11-CU-NEXT: s_endpgm
1957 i32* %out, i32 %in) {
1959 %val = atomicrmw volatile xchg i32* %out, i32 %in acquire
1960 store i32 %val, i32* %out, align 4
1964 define amdgpu_kernel void @flat_system_acq_rel_ret_atomicrmw(
1965 ; GFX7-LABEL: flat_system_acq_rel_ret_atomicrmw:
1966 ; GFX7: ; %bb.0: ; %entry
1967 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1968 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
1969 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1970 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
1971 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
1972 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
1973 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1974 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1975 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1976 ; GFX7-NEXT: buffer_wbinvl1_vol
1977 ; GFX7-NEXT: flat_store_dword v[0:1], v2
1978 ; GFX7-NEXT: s_endpgm
1980 ; GFX10-WGP-LABEL: flat_system_acq_rel_ret_atomicrmw:
1981 ; GFX10-WGP: ; %bb.0: ; %entry
1982 ; GFX10-WGP-NEXT: s_clause 0x1
1983 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
1984 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
1985 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1986 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
1987 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
1988 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
1989 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1990 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
1991 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
1992 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
1993 ; GFX10-WGP-NEXT: buffer_gl0_inv
1994 ; GFX10-WGP-NEXT: buffer_gl1_inv
1995 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
1996 ; GFX10-WGP-NEXT: s_endpgm
1998 ; GFX10-CU-LABEL: flat_system_acq_rel_ret_atomicrmw:
1999 ; GFX10-CU: ; %bb.0: ; %entry
2000 ; GFX10-CU-NEXT: s_clause 0x1
2001 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2002 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
2003 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2004 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2005 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2006 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2007 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2008 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2009 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2010 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2011 ; GFX10-CU-NEXT: buffer_gl0_inv
2012 ; GFX10-CU-NEXT: buffer_gl1_inv
2013 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
2014 ; GFX10-CU-NEXT: s_endpgm
2016 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_ret_atomicrmw:
2017 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2018 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2019 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
2020 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2021 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2022 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2023 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
2024 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2025 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2026 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2027 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
2028 ; SKIP-CACHE-INV-NEXT: s_endpgm
2030 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_ret_atomicrmw:
2031 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2032 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2033 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2034 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2035 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2036 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
2037 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2038 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2039 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2040 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2041 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2042 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2043 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
2044 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2046 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_ret_atomicrmw:
2047 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2048 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2049 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2050 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2051 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2052 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
2053 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2054 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2055 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2056 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2057 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2058 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2059 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
2060 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2062 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_ret_atomicrmw:
2063 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2064 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2065 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2066 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2067 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2068 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2069 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2070 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2071 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
2072 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2073 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2074 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
2075 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2077 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_ret_atomicrmw:
2078 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2079 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2080 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2081 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2082 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2083 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2084 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2085 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2086 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
2087 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2088 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2089 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
2090 ; GFX940-TGSPLIT-NEXT: s_endpgm
2092 ; GFX11-WGP-LABEL: flat_system_acq_rel_ret_atomicrmw:
2093 ; GFX11-WGP: ; %bb.0: ; %entry
2094 ; GFX11-WGP-NEXT: s_clause 0x1
2095 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
2096 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
2097 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2098 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2099 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
2100 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2101 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2102 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
2103 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2104 ; GFX11-WGP-NEXT: buffer_gl0_inv
2105 ; GFX11-WGP-NEXT: buffer_gl1_inv
2106 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
2107 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2108 ; GFX11-WGP-NEXT: s_endpgm
2110 ; GFX11-CU-LABEL: flat_system_acq_rel_ret_atomicrmw:
2111 ; GFX11-CU: ; %bb.0: ; %entry
2112 ; GFX11-CU-NEXT: s_clause 0x1
2113 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
2114 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
2115 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2116 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2117 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
2118 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2119 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2120 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
2121 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2122 ; GFX11-CU-NEXT: buffer_gl0_inv
2123 ; GFX11-CU-NEXT: buffer_gl1_inv
2124 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
2125 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2126 ; GFX11-CU-NEXT: s_endpgm
2127 i32* %out, i32 %in) {
2129 %val = atomicrmw volatile xchg i32* %out, i32 %in acq_rel
2130 store i32 %val, i32* %out, align 4
2134 define amdgpu_kernel void @flat_system_seq_cst_ret_atomicrmw(
2135 ; GFX7-LABEL: flat_system_seq_cst_ret_atomicrmw:
2136 ; GFX7: ; %bb.0: ; %entry
2137 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2138 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
2139 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2140 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2141 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2142 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2143 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2144 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2145 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2146 ; GFX7-NEXT: buffer_wbinvl1_vol
2147 ; GFX7-NEXT: flat_store_dword v[0:1], v2
2148 ; GFX7-NEXT: s_endpgm
2150 ; GFX10-WGP-LABEL: flat_system_seq_cst_ret_atomicrmw:
2151 ; GFX10-WGP: ; %bb.0: ; %entry
2152 ; GFX10-WGP-NEXT: s_clause 0x1
2153 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2154 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
2155 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2156 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2157 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2158 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2159 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2160 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2161 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2162 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2163 ; GFX10-WGP-NEXT: buffer_gl0_inv
2164 ; GFX10-WGP-NEXT: buffer_gl1_inv
2165 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
2166 ; GFX10-WGP-NEXT: s_endpgm
2168 ; GFX10-CU-LABEL: flat_system_seq_cst_ret_atomicrmw:
2169 ; GFX10-CU: ; %bb.0: ; %entry
2170 ; GFX10-CU-NEXT: s_clause 0x1
2171 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2172 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
2173 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2174 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2175 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2176 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2177 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2178 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2179 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2180 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2181 ; GFX10-CU-NEXT: buffer_gl0_inv
2182 ; GFX10-CU-NEXT: buffer_gl1_inv
2183 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
2184 ; GFX10-CU-NEXT: s_endpgm
2186 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_ret_atomicrmw:
2187 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2188 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2189 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
2190 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2191 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2192 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
2193 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
2194 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2195 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2196 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2197 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
2198 ; SKIP-CACHE-INV-NEXT: s_endpgm
2200 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_ret_atomicrmw:
2201 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2202 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2203 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2204 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2205 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2206 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
2207 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2208 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2209 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2210 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2211 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2212 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2213 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
2214 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2216 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_ret_atomicrmw:
2217 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2218 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
2219 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
2220 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2221 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2222 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
2223 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2224 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2225 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
2226 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2227 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2228 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2229 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
2230 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2232 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_ret_atomicrmw:
2233 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2234 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2235 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2236 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2237 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2238 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2239 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2240 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2241 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
2242 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2243 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2244 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
2245 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2247 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_ret_atomicrmw:
2248 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2249 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
2250 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
2251 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2252 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
2253 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2254 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2255 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2256 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
2257 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2258 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2259 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
2260 ; GFX940-TGSPLIT-NEXT: s_endpgm
2262 ; GFX11-WGP-LABEL: flat_system_seq_cst_ret_atomicrmw:
2263 ; GFX11-WGP: ; %bb.0: ; %entry
2264 ; GFX11-WGP-NEXT: s_clause 0x1
2265 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
2266 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
2267 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2268 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2269 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
2270 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2271 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2272 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
2273 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2274 ; GFX11-WGP-NEXT: buffer_gl0_inv
2275 ; GFX11-WGP-NEXT: buffer_gl1_inv
2276 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
2277 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2278 ; GFX11-WGP-NEXT: s_endpgm
2280 ; GFX11-CU-LABEL: flat_system_seq_cst_ret_atomicrmw:
2281 ; GFX11-CU: ; %bb.0: ; %entry
2282 ; GFX11-CU-NEXT: s_clause 0x1
2283 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
2284 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
2285 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2286 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
2287 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
2288 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2289 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2290 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
2291 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2292 ; GFX11-CU-NEXT: buffer_gl0_inv
2293 ; GFX11-CU-NEXT: buffer_gl1_inv
2294 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
2295 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2296 ; GFX11-CU-NEXT: s_endpgm
2297 i32* %out, i32 %in) {
2299 %val = atomicrmw volatile xchg i32* %out, i32 %in seq_cst
2300 store i32 %val, i32* %out, align 4
2304 define amdgpu_kernel void @flat_system_monotonic_monotonic_cmpxchg(
2305 ; GFX7-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2306 ; GFX7: ; %bb.0: ; %entry
2307 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2308 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2309 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2310 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2311 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2312 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2313 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2314 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2315 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2316 ; GFX7-NEXT: s_endpgm
2318 ; GFX10-WGP-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2319 ; GFX10-WGP: ; %bb.0: ; %entry
2320 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2321 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2322 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2323 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2324 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2325 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2326 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2327 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2328 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2329 ; GFX10-WGP-NEXT: s_endpgm
2331 ; GFX10-CU-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2332 ; GFX10-CU: ; %bb.0: ; %entry
2333 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2334 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2335 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2336 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2337 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2338 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2339 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2340 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2341 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2342 ; GFX10-CU-NEXT: s_endpgm
2344 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2345 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2346 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2347 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2348 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2349 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2350 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2351 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2352 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2353 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2354 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2355 ; SKIP-CACHE-INV-NEXT: s_endpgm
2357 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2358 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2359 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2360 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2361 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2362 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2363 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2364 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2366 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2367 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2368 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2369 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2370 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2371 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2372 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2373 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2375 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2376 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2377 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2378 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2379 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2380 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2381 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2382 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2384 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2385 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2386 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2387 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2388 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2389 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2390 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2391 ; GFX940-TGSPLIT-NEXT: s_endpgm
2393 ; GFX11-WGP-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2394 ; GFX11-WGP: ; %bb.0: ; %entry
2395 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2396 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2397 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2398 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2399 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2400 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2401 ; GFX11-WGP-NEXT: s_endpgm
2403 ; GFX11-CU-LABEL: flat_system_monotonic_monotonic_cmpxchg:
2404 ; GFX11-CU: ; %bb.0: ; %entry
2405 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2406 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2407 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2408 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2409 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2410 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2411 ; GFX11-CU-NEXT: s_endpgm
2412 i32* %out, i32 %in, i32 %old) {
2414 %gep = getelementptr i32, i32* %out, i32 4
2415 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in monotonic monotonic
2419 define amdgpu_kernel void @flat_system_acquire_monotonic_cmpxchg(
2420 ; GFX7-LABEL: flat_system_acquire_monotonic_cmpxchg:
2421 ; GFX7: ; %bb.0: ; %entry
2422 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2423 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2424 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2425 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2426 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2427 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2428 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2429 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2430 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2431 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2432 ; GFX7-NEXT: buffer_wbinvl1_vol
2433 ; GFX7-NEXT: s_endpgm
2435 ; GFX10-WGP-LABEL: flat_system_acquire_monotonic_cmpxchg:
2436 ; GFX10-WGP: ; %bb.0: ; %entry
2437 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2438 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2439 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2440 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2441 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2442 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2443 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2444 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2445 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2446 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2447 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2448 ; GFX10-WGP-NEXT: buffer_gl0_inv
2449 ; GFX10-WGP-NEXT: buffer_gl1_inv
2450 ; GFX10-WGP-NEXT: s_endpgm
2452 ; GFX10-CU-LABEL: flat_system_acquire_monotonic_cmpxchg:
2453 ; GFX10-CU: ; %bb.0: ; %entry
2454 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2455 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2456 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2457 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2458 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2459 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2460 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2461 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2462 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2463 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2464 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2465 ; GFX10-CU-NEXT: buffer_gl0_inv
2466 ; GFX10-CU-NEXT: buffer_gl1_inv
2467 ; GFX10-CU-NEXT: s_endpgm
2469 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_monotonic_cmpxchg:
2470 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2471 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2472 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2473 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2474 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2475 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2476 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2477 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2478 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2479 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2480 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2481 ; SKIP-CACHE-INV-NEXT: s_endpgm
2483 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_monotonic_cmpxchg:
2484 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2485 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2486 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2487 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2488 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2489 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2490 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2491 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2492 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2493 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2495 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_monotonic_cmpxchg:
2496 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2497 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2498 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2499 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2500 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2501 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2502 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2503 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2504 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2505 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2507 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_monotonic_cmpxchg:
2508 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2509 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2510 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2511 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2512 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2513 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2514 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2515 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2516 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2518 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_monotonic_cmpxchg:
2519 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2520 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2521 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2522 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2523 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2524 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2525 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2526 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2527 ; GFX940-TGSPLIT-NEXT: s_endpgm
2529 ; GFX11-WGP-LABEL: flat_system_acquire_monotonic_cmpxchg:
2530 ; GFX11-WGP: ; %bb.0: ; %entry
2531 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2532 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2533 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2534 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2535 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2536 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2537 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2538 ; GFX11-WGP-NEXT: buffer_gl0_inv
2539 ; GFX11-WGP-NEXT: buffer_gl1_inv
2540 ; GFX11-WGP-NEXT: s_endpgm
2542 ; GFX11-CU-LABEL: flat_system_acquire_monotonic_cmpxchg:
2543 ; GFX11-CU: ; %bb.0: ; %entry
2544 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2545 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2546 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2547 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2548 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2549 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2550 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2551 ; GFX11-CU-NEXT: buffer_gl0_inv
2552 ; GFX11-CU-NEXT: buffer_gl1_inv
2553 ; GFX11-CU-NEXT: s_endpgm
2554 i32* %out, i32 %in, i32 %old) {
2556 %gep = getelementptr i32, i32* %out, i32 4
2557 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acquire monotonic
2561 define amdgpu_kernel void @flat_system_release_monotonic_cmpxchg(
2562 ; GFX7-LABEL: flat_system_release_monotonic_cmpxchg:
2563 ; GFX7: ; %bb.0: ; %entry
2564 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2565 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2566 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2567 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2568 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2569 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2570 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2571 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2572 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2573 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2574 ; GFX7-NEXT: s_endpgm
2576 ; GFX10-WGP-LABEL: flat_system_release_monotonic_cmpxchg:
2577 ; GFX10-WGP: ; %bb.0: ; %entry
2578 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2579 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2580 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2581 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2582 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2583 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2584 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2585 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2586 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2587 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2588 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2589 ; GFX10-WGP-NEXT: s_endpgm
2591 ; GFX10-CU-LABEL: flat_system_release_monotonic_cmpxchg:
2592 ; GFX10-CU: ; %bb.0: ; %entry
2593 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2594 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2595 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2596 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2597 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2598 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2599 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2600 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2601 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2602 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2603 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2604 ; GFX10-CU-NEXT: s_endpgm
2606 ; SKIP-CACHE-INV-LABEL: flat_system_release_monotonic_cmpxchg:
2607 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2608 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2609 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2610 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2611 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2612 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2613 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2614 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2615 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2616 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2617 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2618 ; SKIP-CACHE-INV-NEXT: s_endpgm
2620 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_monotonic_cmpxchg:
2621 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2622 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2623 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2624 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2625 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2626 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2627 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2628 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2629 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2631 ; GFX90A-TGSPLIT-LABEL: flat_system_release_monotonic_cmpxchg:
2632 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2633 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2634 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2635 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2636 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2637 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2638 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2639 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2640 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2642 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_monotonic_cmpxchg:
2643 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2644 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2645 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2646 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2647 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2648 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2649 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2650 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2651 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2653 ; GFX940-TGSPLIT-LABEL: flat_system_release_monotonic_cmpxchg:
2654 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2655 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2656 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2657 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2658 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2659 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2660 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2661 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2662 ; GFX940-TGSPLIT-NEXT: s_endpgm
2664 ; GFX11-WGP-LABEL: flat_system_release_monotonic_cmpxchg:
2665 ; GFX11-WGP: ; %bb.0: ; %entry
2666 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2667 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2668 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2669 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2670 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2671 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2672 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2673 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2674 ; GFX11-WGP-NEXT: s_endpgm
2676 ; GFX11-CU-LABEL: flat_system_release_monotonic_cmpxchg:
2677 ; GFX11-CU: ; %bb.0: ; %entry
2678 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2679 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2680 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2681 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2682 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2683 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2684 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2685 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2686 ; GFX11-CU-NEXT: s_endpgm
2687 i32* %out, i32 %in, i32 %old) {
2689 %gep = getelementptr i32, i32* %out, i32 4
2690 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in release monotonic
2694 define amdgpu_kernel void @flat_system_acq_rel_monotonic_cmpxchg(
2695 ; GFX7-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2696 ; GFX7: ; %bb.0: ; %entry
2697 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2698 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2699 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2700 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2701 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2702 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2703 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2704 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2705 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2706 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2707 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2708 ; GFX7-NEXT: buffer_wbinvl1_vol
2709 ; GFX7-NEXT: s_endpgm
2711 ; GFX10-WGP-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2712 ; GFX10-WGP: ; %bb.0: ; %entry
2713 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2714 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2715 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2716 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2717 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2718 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2719 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2720 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2721 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2722 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2723 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2724 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2725 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2726 ; GFX10-WGP-NEXT: buffer_gl0_inv
2727 ; GFX10-WGP-NEXT: buffer_gl1_inv
2728 ; GFX10-WGP-NEXT: s_endpgm
2730 ; GFX10-CU-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2731 ; GFX10-CU: ; %bb.0: ; %entry
2732 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2733 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2734 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2735 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2736 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2737 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2738 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2739 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2740 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2741 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2742 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2743 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2744 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2745 ; GFX10-CU-NEXT: buffer_gl0_inv
2746 ; GFX10-CU-NEXT: buffer_gl1_inv
2747 ; GFX10-CU-NEXT: s_endpgm
2749 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2750 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2751 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2752 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2753 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2754 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2755 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2756 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2757 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2758 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2759 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2760 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2761 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2762 ; SKIP-CACHE-INV-NEXT: s_endpgm
2764 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2765 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2766 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2767 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2768 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2769 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2770 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2771 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2772 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2773 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2774 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2775 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2776 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2778 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2779 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2780 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2781 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2782 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2783 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2784 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2785 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2786 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2787 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2788 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2789 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2790 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2792 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2793 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2794 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2795 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2796 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2797 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2798 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2799 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2800 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2801 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2802 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2803 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2805 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2806 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2807 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2808 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2809 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2810 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2811 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2812 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2813 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2814 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2815 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2816 ; GFX940-TGSPLIT-NEXT: s_endpgm
2818 ; GFX11-WGP-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2819 ; GFX11-WGP: ; %bb.0: ; %entry
2820 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2821 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2822 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2823 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2824 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2825 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2826 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2827 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2828 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2829 ; GFX11-WGP-NEXT: buffer_gl0_inv
2830 ; GFX11-WGP-NEXT: buffer_gl1_inv
2831 ; GFX11-WGP-NEXT: s_endpgm
2833 ; GFX11-CU-LABEL: flat_system_acq_rel_monotonic_cmpxchg:
2834 ; GFX11-CU: ; %bb.0: ; %entry
2835 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2836 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2837 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2838 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2839 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2840 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2841 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2842 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2843 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
2844 ; GFX11-CU-NEXT: buffer_gl0_inv
2845 ; GFX11-CU-NEXT: buffer_gl1_inv
2846 ; GFX11-CU-NEXT: s_endpgm
2847 i32* %out, i32 %in, i32 %old) {
2849 %gep = getelementptr i32, i32* %out, i32 4
2850 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acq_rel monotonic
2854 define amdgpu_kernel void @flat_system_seq_cst_monotonic_cmpxchg(
2855 ; GFX7-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2856 ; GFX7: ; %bb.0: ; %entry
2857 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2858 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2859 ; GFX7-NEXT: s_add_u32 s0, s0, 16
2860 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
2861 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
2862 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
2863 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
2864 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
2865 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2866 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2867 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2868 ; GFX7-NEXT: buffer_wbinvl1_vol
2869 ; GFX7-NEXT: s_endpgm
2871 ; GFX10-WGP-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2872 ; GFX10-WGP: ; %bb.0: ; %entry
2873 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2874 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2875 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
2876 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
2877 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
2878 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
2879 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
2880 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
2881 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2882 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2883 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2884 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2885 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2886 ; GFX10-WGP-NEXT: buffer_gl0_inv
2887 ; GFX10-WGP-NEXT: buffer_gl1_inv
2888 ; GFX10-WGP-NEXT: s_endpgm
2890 ; GFX10-CU-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2891 ; GFX10-CU: ; %bb.0: ; %entry
2892 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2893 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2894 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
2895 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
2896 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
2897 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
2898 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
2899 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
2900 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2901 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2902 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2903 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2904 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
2905 ; GFX10-CU-NEXT: buffer_gl0_inv
2906 ; GFX10-CU-NEXT: buffer_gl1_inv
2907 ; GFX10-CU-NEXT: s_endpgm
2909 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2910 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2911 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2912 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2913 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
2914 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
2915 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2916 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
2917 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2918 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
2919 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2920 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
2921 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2922 ; SKIP-CACHE-INV-NEXT: s_endpgm
2924 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2925 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2926 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2927 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2928 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2929 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2930 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
2931 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2932 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2933 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2934 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
2935 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
2936 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2938 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2939 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2940 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
2941 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2942 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
2943 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
2944 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
2945 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2946 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
2947 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2948 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
2949 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
2950 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2952 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2953 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2954 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2955 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2956 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2957 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2958 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2959 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2960 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2961 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2962 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
2963 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2965 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2966 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2967 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
2968 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2969 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
2970 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
2971 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
2972 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2973 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
2974 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
2975 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
2976 ; GFX940-TGSPLIT-NEXT: s_endpgm
2978 ; GFX11-WGP-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2979 ; GFX11-WGP: ; %bb.0: ; %entry
2980 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2981 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2982 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2983 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2984 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2985 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2986 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
2987 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2988 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
2989 ; GFX11-WGP-NEXT: buffer_gl0_inv
2990 ; GFX11-WGP-NEXT: buffer_gl1_inv
2991 ; GFX11-WGP-NEXT: s_endpgm
2993 ; GFX11-CU-LABEL: flat_system_seq_cst_monotonic_cmpxchg:
2994 ; GFX11-CU: ; %bb.0: ; %entry
2995 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
2996 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2997 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
2998 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
2999 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3000 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3001 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3002 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3003 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3004 ; GFX11-CU-NEXT: buffer_gl0_inv
3005 ; GFX11-CU-NEXT: buffer_gl1_inv
3006 ; GFX11-CU-NEXT: s_endpgm
3007 i32* %out, i32 %in, i32 %old) {
3009 %gep = getelementptr i32, i32* %out, i32 4
3010 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in seq_cst monotonic
3014 define amdgpu_kernel void @flat_system_monotonic_acquire_cmpxchg(
3015 ; GFX7-LABEL: flat_system_monotonic_acquire_cmpxchg:
3016 ; GFX7: ; %bb.0: ; %entry
3017 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3018 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3019 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3020 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3021 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3022 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3023 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3024 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3025 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3026 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3027 ; GFX7-NEXT: buffer_wbinvl1_vol
3028 ; GFX7-NEXT: s_endpgm
3030 ; GFX10-WGP-LABEL: flat_system_monotonic_acquire_cmpxchg:
3031 ; GFX10-WGP: ; %bb.0: ; %entry
3032 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3033 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3034 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3035 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3036 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3037 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3038 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3039 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3040 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3041 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3042 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3043 ; GFX10-WGP-NEXT: buffer_gl0_inv
3044 ; GFX10-WGP-NEXT: buffer_gl1_inv
3045 ; GFX10-WGP-NEXT: s_endpgm
3047 ; GFX10-CU-LABEL: flat_system_monotonic_acquire_cmpxchg:
3048 ; GFX10-CU: ; %bb.0: ; %entry
3049 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3050 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3051 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3052 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3053 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3054 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3055 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3056 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3057 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3058 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3059 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3060 ; GFX10-CU-NEXT: buffer_gl0_inv
3061 ; GFX10-CU-NEXT: buffer_gl1_inv
3062 ; GFX10-CU-NEXT: s_endpgm
3064 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_acquire_cmpxchg:
3065 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3066 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3067 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3068 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3069 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3070 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3071 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3072 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3073 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3074 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3075 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3076 ; SKIP-CACHE-INV-NEXT: s_endpgm
3078 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_acquire_cmpxchg:
3079 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3080 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3081 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3082 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3083 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3084 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3085 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3086 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3087 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3088 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3090 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_acquire_cmpxchg:
3091 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3092 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3093 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3094 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3095 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3096 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3097 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3098 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3099 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3100 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3102 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_acquire_cmpxchg:
3103 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3104 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3105 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3106 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3107 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3108 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3109 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3110 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3111 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3113 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_acquire_cmpxchg:
3114 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3115 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3116 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3117 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3118 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3119 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3120 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3121 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3122 ; GFX940-TGSPLIT-NEXT: s_endpgm
3124 ; GFX11-WGP-LABEL: flat_system_monotonic_acquire_cmpxchg:
3125 ; GFX11-WGP: ; %bb.0: ; %entry
3126 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3127 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3128 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3129 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3130 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3131 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3132 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3133 ; GFX11-WGP-NEXT: buffer_gl0_inv
3134 ; GFX11-WGP-NEXT: buffer_gl1_inv
3135 ; GFX11-WGP-NEXT: s_endpgm
3137 ; GFX11-CU-LABEL: flat_system_monotonic_acquire_cmpxchg:
3138 ; GFX11-CU: ; %bb.0: ; %entry
3139 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3140 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3141 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3142 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3143 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3144 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3145 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3146 ; GFX11-CU-NEXT: buffer_gl0_inv
3147 ; GFX11-CU-NEXT: buffer_gl1_inv
3148 ; GFX11-CU-NEXT: s_endpgm
3149 i32* %out, i32 %in, i32 %old) {
3151 %gep = getelementptr i32, i32* %out, i32 4
3152 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in monotonic acquire
3156 define amdgpu_kernel void @flat_system_acquire_acquire_cmpxchg(
3157 ; GFX7-LABEL: flat_system_acquire_acquire_cmpxchg:
3158 ; GFX7: ; %bb.0: ; %entry
3159 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3160 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3161 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3162 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3163 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3164 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3165 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3166 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3167 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3168 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3169 ; GFX7-NEXT: buffer_wbinvl1_vol
3170 ; GFX7-NEXT: s_endpgm
3172 ; GFX10-WGP-LABEL: flat_system_acquire_acquire_cmpxchg:
3173 ; GFX10-WGP: ; %bb.0: ; %entry
3174 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3175 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3176 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3177 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3178 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3179 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3180 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3181 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3182 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3183 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3184 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3185 ; GFX10-WGP-NEXT: buffer_gl0_inv
3186 ; GFX10-WGP-NEXT: buffer_gl1_inv
3187 ; GFX10-WGP-NEXT: s_endpgm
3189 ; GFX10-CU-LABEL: flat_system_acquire_acquire_cmpxchg:
3190 ; GFX10-CU: ; %bb.0: ; %entry
3191 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3192 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3193 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3194 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3195 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3196 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3197 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3198 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3199 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3200 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3201 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3202 ; GFX10-CU-NEXT: buffer_gl0_inv
3203 ; GFX10-CU-NEXT: buffer_gl1_inv
3204 ; GFX10-CU-NEXT: s_endpgm
3206 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_acquire_cmpxchg:
3207 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3208 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3209 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3210 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3211 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3212 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3213 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3214 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3215 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3216 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3217 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3218 ; SKIP-CACHE-INV-NEXT: s_endpgm
3220 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_acquire_cmpxchg:
3221 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3222 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3223 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3224 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3225 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3226 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3227 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3228 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3229 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3230 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3232 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_acquire_cmpxchg:
3233 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3234 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3235 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3236 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3237 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3238 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3239 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3240 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3241 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3242 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3244 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_acquire_cmpxchg:
3245 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3246 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3247 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3248 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3249 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3250 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3251 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3252 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3253 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3255 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_acquire_cmpxchg:
3256 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3257 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3258 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3259 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3260 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3261 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3262 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3263 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3264 ; GFX940-TGSPLIT-NEXT: s_endpgm
3266 ; GFX11-WGP-LABEL: flat_system_acquire_acquire_cmpxchg:
3267 ; GFX11-WGP: ; %bb.0: ; %entry
3268 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3269 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3270 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3271 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3272 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3273 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3274 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3275 ; GFX11-WGP-NEXT: buffer_gl0_inv
3276 ; GFX11-WGP-NEXT: buffer_gl1_inv
3277 ; GFX11-WGP-NEXT: s_endpgm
3279 ; GFX11-CU-LABEL: flat_system_acquire_acquire_cmpxchg:
3280 ; GFX11-CU: ; %bb.0: ; %entry
3281 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3282 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3283 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3284 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3285 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3286 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3287 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3288 ; GFX11-CU-NEXT: buffer_gl0_inv
3289 ; GFX11-CU-NEXT: buffer_gl1_inv
3290 ; GFX11-CU-NEXT: s_endpgm
3291 i32* %out, i32 %in, i32 %old) {
3293 %gep = getelementptr i32, i32* %out, i32 4
3294 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acquire acquire
3298 define amdgpu_kernel void @flat_system_release_acquire_cmpxchg(
3299 ; GFX7-LABEL: flat_system_release_acquire_cmpxchg:
3300 ; GFX7: ; %bb.0: ; %entry
3301 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3302 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3303 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3304 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3305 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3306 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3307 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3308 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3309 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3310 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3311 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3312 ; GFX7-NEXT: buffer_wbinvl1_vol
3313 ; GFX7-NEXT: s_endpgm
3315 ; GFX10-WGP-LABEL: flat_system_release_acquire_cmpxchg:
3316 ; GFX10-WGP: ; %bb.0: ; %entry
3317 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3318 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3319 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3320 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3321 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3322 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3323 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3324 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3325 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3326 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3327 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3328 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3329 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3330 ; GFX10-WGP-NEXT: buffer_gl0_inv
3331 ; GFX10-WGP-NEXT: buffer_gl1_inv
3332 ; GFX10-WGP-NEXT: s_endpgm
3334 ; GFX10-CU-LABEL: flat_system_release_acquire_cmpxchg:
3335 ; GFX10-CU: ; %bb.0: ; %entry
3336 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3337 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3338 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3339 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3340 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3341 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3342 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3343 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3344 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3345 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3346 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3347 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3348 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3349 ; GFX10-CU-NEXT: buffer_gl0_inv
3350 ; GFX10-CU-NEXT: buffer_gl1_inv
3351 ; GFX10-CU-NEXT: s_endpgm
3353 ; SKIP-CACHE-INV-LABEL: flat_system_release_acquire_cmpxchg:
3354 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3355 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3356 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3357 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3358 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3359 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3360 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3361 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3362 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3363 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3364 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3365 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3366 ; SKIP-CACHE-INV-NEXT: s_endpgm
3368 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_acquire_cmpxchg:
3369 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3370 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3371 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3372 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3373 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3374 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3375 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3376 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3377 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3378 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3379 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3380 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3382 ; GFX90A-TGSPLIT-LABEL: flat_system_release_acquire_cmpxchg:
3383 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3384 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3385 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3386 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3387 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3388 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3389 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3390 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3391 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3392 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3393 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3394 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3396 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_acquire_cmpxchg:
3397 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3398 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3399 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3400 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3401 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3402 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3403 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3404 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3405 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3406 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3407 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3409 ; GFX940-TGSPLIT-LABEL: flat_system_release_acquire_cmpxchg:
3410 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3411 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3412 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3413 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3414 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3415 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3416 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3417 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3418 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3419 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3420 ; GFX940-TGSPLIT-NEXT: s_endpgm
3422 ; GFX11-WGP-LABEL: flat_system_release_acquire_cmpxchg:
3423 ; GFX11-WGP: ; %bb.0: ; %entry
3424 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3425 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3426 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3427 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3428 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3429 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3430 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3431 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3432 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3433 ; GFX11-WGP-NEXT: buffer_gl0_inv
3434 ; GFX11-WGP-NEXT: buffer_gl1_inv
3435 ; GFX11-WGP-NEXT: s_endpgm
3437 ; GFX11-CU-LABEL: flat_system_release_acquire_cmpxchg:
3438 ; GFX11-CU: ; %bb.0: ; %entry
3439 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3440 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3441 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3442 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3443 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3444 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3445 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3446 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3447 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3448 ; GFX11-CU-NEXT: buffer_gl0_inv
3449 ; GFX11-CU-NEXT: buffer_gl1_inv
3450 ; GFX11-CU-NEXT: s_endpgm
3451 i32* %out, i32 %in, i32 %old) {
3453 %gep = getelementptr i32, i32* %out, i32 4
3454 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in release acquire
3458 define amdgpu_kernel void @flat_system_acq_rel_acquire_cmpxchg(
3459 ; GFX7-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3460 ; GFX7: ; %bb.0: ; %entry
3461 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3462 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3463 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3464 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3465 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3466 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3467 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3468 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3469 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3470 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3471 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3472 ; GFX7-NEXT: buffer_wbinvl1_vol
3473 ; GFX7-NEXT: s_endpgm
3475 ; GFX10-WGP-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3476 ; GFX10-WGP: ; %bb.0: ; %entry
3477 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3478 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3479 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3480 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3481 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3482 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3483 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3484 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3485 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3486 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3487 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3488 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3489 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3490 ; GFX10-WGP-NEXT: buffer_gl0_inv
3491 ; GFX10-WGP-NEXT: buffer_gl1_inv
3492 ; GFX10-WGP-NEXT: s_endpgm
3494 ; GFX10-CU-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3495 ; GFX10-CU: ; %bb.0: ; %entry
3496 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3497 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3498 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3499 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3500 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3501 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3502 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3503 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3504 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3505 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3506 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3507 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3508 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3509 ; GFX10-CU-NEXT: buffer_gl0_inv
3510 ; GFX10-CU-NEXT: buffer_gl1_inv
3511 ; GFX10-CU-NEXT: s_endpgm
3513 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3514 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3515 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3516 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3517 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3518 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3519 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3520 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3521 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3522 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3523 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3524 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3525 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3526 ; SKIP-CACHE-INV-NEXT: s_endpgm
3528 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3529 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3530 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3531 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3532 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3533 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3534 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3535 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3536 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3537 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3538 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3539 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3540 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3542 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3543 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3544 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3545 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3546 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3547 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3548 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3549 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3550 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3551 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3552 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3553 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3554 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3556 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3557 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3558 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3559 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3560 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3561 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3562 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3563 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3564 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3565 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3566 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3567 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3569 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3570 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3571 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3572 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3573 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3574 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3575 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3576 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3577 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3578 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3579 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3580 ; GFX940-TGSPLIT-NEXT: s_endpgm
3582 ; GFX11-WGP-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3583 ; GFX11-WGP: ; %bb.0: ; %entry
3584 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3585 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3586 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3587 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3588 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3589 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3590 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3591 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3592 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3593 ; GFX11-WGP-NEXT: buffer_gl0_inv
3594 ; GFX11-WGP-NEXT: buffer_gl1_inv
3595 ; GFX11-WGP-NEXT: s_endpgm
3597 ; GFX11-CU-LABEL: flat_system_acq_rel_acquire_cmpxchg:
3598 ; GFX11-CU: ; %bb.0: ; %entry
3599 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3600 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3601 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3602 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3603 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3604 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3605 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3606 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3607 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3608 ; GFX11-CU-NEXT: buffer_gl0_inv
3609 ; GFX11-CU-NEXT: buffer_gl1_inv
3610 ; GFX11-CU-NEXT: s_endpgm
3611 i32* %out, i32 %in, i32 %old) {
3613 %gep = getelementptr i32, i32* %out, i32 4
3614 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acq_rel acquire
3618 define amdgpu_kernel void @flat_system_seq_cst_acquire_cmpxchg(
3619 ; GFX7-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3620 ; GFX7: ; %bb.0: ; %entry
3621 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3622 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3623 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3624 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3625 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3626 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3627 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3628 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3629 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3630 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3631 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3632 ; GFX7-NEXT: buffer_wbinvl1_vol
3633 ; GFX7-NEXT: s_endpgm
3635 ; GFX10-WGP-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3636 ; GFX10-WGP: ; %bb.0: ; %entry
3637 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3638 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3639 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3640 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3641 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3642 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3643 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3644 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3645 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3646 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3647 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3648 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3649 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3650 ; GFX10-WGP-NEXT: buffer_gl0_inv
3651 ; GFX10-WGP-NEXT: buffer_gl1_inv
3652 ; GFX10-WGP-NEXT: s_endpgm
3654 ; GFX10-CU-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3655 ; GFX10-CU: ; %bb.0: ; %entry
3656 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3657 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3658 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3659 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3660 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3661 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3662 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3663 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3664 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3665 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3666 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3667 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3668 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3669 ; GFX10-CU-NEXT: buffer_gl0_inv
3670 ; GFX10-CU-NEXT: buffer_gl1_inv
3671 ; GFX10-CU-NEXT: s_endpgm
3673 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3674 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3675 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3676 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3677 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3678 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3679 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3680 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3681 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3682 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3683 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3684 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3685 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3686 ; SKIP-CACHE-INV-NEXT: s_endpgm
3688 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3689 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3690 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3691 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3692 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3693 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3694 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3695 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3696 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3697 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3698 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3699 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3700 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3702 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3703 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3704 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3705 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3706 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3707 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3708 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3709 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3710 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3711 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3712 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3713 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3714 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3716 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3717 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3718 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3719 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3720 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3721 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3722 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3723 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3724 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3725 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3726 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3727 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3729 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3730 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3731 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3732 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3733 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3734 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3735 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3736 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3737 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3738 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3739 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3740 ; GFX940-TGSPLIT-NEXT: s_endpgm
3742 ; GFX11-WGP-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3743 ; GFX11-WGP: ; %bb.0: ; %entry
3744 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3745 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3746 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3747 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3748 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3749 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3750 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3751 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3752 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3753 ; GFX11-WGP-NEXT: buffer_gl0_inv
3754 ; GFX11-WGP-NEXT: buffer_gl1_inv
3755 ; GFX11-WGP-NEXT: s_endpgm
3757 ; GFX11-CU-LABEL: flat_system_seq_cst_acquire_cmpxchg:
3758 ; GFX11-CU: ; %bb.0: ; %entry
3759 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3760 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3761 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3762 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3763 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3764 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3765 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3766 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3767 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3768 ; GFX11-CU-NEXT: buffer_gl0_inv
3769 ; GFX11-CU-NEXT: buffer_gl1_inv
3770 ; GFX11-CU-NEXT: s_endpgm
3771 i32* %out, i32 %in, i32 %old) {
3773 %gep = getelementptr i32, i32* %out, i32 4
3774 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in seq_cst acquire
3778 define amdgpu_kernel void @flat_system_monotonic_seq_cst_cmpxchg(
3779 ; GFX7-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3780 ; GFX7: ; %bb.0: ; %entry
3781 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3782 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3783 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3784 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3785 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3786 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3787 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3788 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3789 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3790 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3791 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3792 ; GFX7-NEXT: buffer_wbinvl1_vol
3793 ; GFX7-NEXT: s_endpgm
3795 ; GFX10-WGP-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3796 ; GFX10-WGP: ; %bb.0: ; %entry
3797 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3798 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3799 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3800 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3801 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3802 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3803 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3804 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3805 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3806 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3807 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3808 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3809 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3810 ; GFX10-WGP-NEXT: buffer_gl0_inv
3811 ; GFX10-WGP-NEXT: buffer_gl1_inv
3812 ; GFX10-WGP-NEXT: s_endpgm
3814 ; GFX10-CU-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3815 ; GFX10-CU: ; %bb.0: ; %entry
3816 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3817 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3818 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3819 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3820 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3821 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3822 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3823 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3824 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3825 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3826 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3827 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3828 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3829 ; GFX10-CU-NEXT: buffer_gl0_inv
3830 ; GFX10-CU-NEXT: buffer_gl1_inv
3831 ; GFX10-CU-NEXT: s_endpgm
3833 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3834 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3835 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3836 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3837 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3838 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3839 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
3840 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
3841 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3842 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
3843 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3844 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3845 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3846 ; SKIP-CACHE-INV-NEXT: s_endpgm
3848 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3849 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3850 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3851 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3852 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3853 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3854 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
3855 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3856 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3857 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3858 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
3859 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
3860 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3862 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3863 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3864 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3865 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3866 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
3867 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
3868 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
3869 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3870 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
3871 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3872 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
3873 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
3874 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3876 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3877 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3878 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3879 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3880 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3881 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3882 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3883 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3884 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3885 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3886 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
3887 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3889 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3890 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3891 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3892 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3893 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
3894 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
3895 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
3896 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3897 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
3898 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
3899 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
3900 ; GFX940-TGSPLIT-NEXT: s_endpgm
3902 ; GFX11-WGP-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3903 ; GFX11-WGP: ; %bb.0: ; %entry
3904 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3905 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3906 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3907 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3908 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3909 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3910 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3911 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3912 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3913 ; GFX11-WGP-NEXT: buffer_gl0_inv
3914 ; GFX11-WGP-NEXT: buffer_gl1_inv
3915 ; GFX11-WGP-NEXT: s_endpgm
3917 ; GFX11-CU-LABEL: flat_system_monotonic_seq_cst_cmpxchg:
3918 ; GFX11-CU: ; %bb.0: ; %entry
3919 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
3920 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3921 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
3922 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
3923 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3924 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3925 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
3926 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3927 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
3928 ; GFX11-CU-NEXT: buffer_gl0_inv
3929 ; GFX11-CU-NEXT: buffer_gl1_inv
3930 ; GFX11-CU-NEXT: s_endpgm
3931 i32* %out, i32 %in, i32 %old) {
3933 %gep = getelementptr i32, i32* %out, i32 4
3934 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in monotonic seq_cst
3938 define amdgpu_kernel void @flat_system_acquire_seq_cst_cmpxchg(
3939 ; GFX7-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3940 ; GFX7: ; %bb.0: ; %entry
3941 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3942 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3943 ; GFX7-NEXT: s_add_u32 s0, s0, 16
3944 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
3945 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
3946 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
3947 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
3948 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
3949 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3950 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3951 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3952 ; GFX7-NEXT: buffer_wbinvl1_vol
3953 ; GFX7-NEXT: s_endpgm
3955 ; GFX10-WGP-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3956 ; GFX10-WGP: ; %bb.0: ; %entry
3957 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3958 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3959 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
3960 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
3961 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
3962 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
3963 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
3964 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
3965 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3966 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3967 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3968 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3969 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
3970 ; GFX10-WGP-NEXT: buffer_gl0_inv
3971 ; GFX10-WGP-NEXT: buffer_gl1_inv
3972 ; GFX10-WGP-NEXT: s_endpgm
3974 ; GFX10-CU-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3975 ; GFX10-CU: ; %bb.0: ; %entry
3976 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
3977 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3978 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
3979 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
3980 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
3981 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
3982 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
3983 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
3984 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
3985 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3986 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
3987 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3988 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
3989 ; GFX10-CU-NEXT: buffer_gl0_inv
3990 ; GFX10-CU-NEXT: buffer_gl1_inv
3991 ; GFX10-CU-NEXT: s_endpgm
3993 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_seq_cst_cmpxchg:
3994 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3995 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
3996 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3997 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
3998 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
3999 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4000 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4001 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4002 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4003 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4004 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4005 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4006 ; SKIP-CACHE-INV-NEXT: s_endpgm
4008 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4009 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4010 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4011 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4012 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4013 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4014 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4015 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4016 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4017 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4018 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4019 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4020 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4022 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4023 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4024 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4025 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4026 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4027 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4028 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4029 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4030 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4031 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4032 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4033 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4034 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4036 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4037 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4038 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4039 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4040 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4041 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4042 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4043 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4044 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4045 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4046 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4047 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4049 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4050 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4051 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4052 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4053 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4054 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4055 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4056 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4057 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4058 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4059 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4060 ; GFX940-TGSPLIT-NEXT: s_endpgm
4062 ; GFX11-WGP-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4063 ; GFX11-WGP: ; %bb.0: ; %entry
4064 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4065 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4066 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4067 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4068 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4069 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4070 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4071 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4072 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4073 ; GFX11-WGP-NEXT: buffer_gl0_inv
4074 ; GFX11-WGP-NEXT: buffer_gl1_inv
4075 ; GFX11-WGP-NEXT: s_endpgm
4077 ; GFX11-CU-LABEL: flat_system_acquire_seq_cst_cmpxchg:
4078 ; GFX11-CU: ; %bb.0: ; %entry
4079 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4080 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4081 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4082 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4083 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4084 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4085 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4086 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4087 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4088 ; GFX11-CU-NEXT: buffer_gl0_inv
4089 ; GFX11-CU-NEXT: buffer_gl1_inv
4090 ; GFX11-CU-NEXT: s_endpgm
4091 i32* %out, i32 %in, i32 %old) {
4093 %gep = getelementptr i32, i32* %out, i32 4
4094 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acquire seq_cst
4098 define amdgpu_kernel void @flat_system_release_seq_cst_cmpxchg(
4099 ; GFX7-LABEL: flat_system_release_seq_cst_cmpxchg:
4100 ; GFX7: ; %bb.0: ; %entry
4101 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4102 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4103 ; GFX7-NEXT: s_add_u32 s0, s0, 16
4104 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
4105 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4106 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4107 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4108 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4109 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4110 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4111 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4112 ; GFX7-NEXT: buffer_wbinvl1_vol
4113 ; GFX7-NEXT: s_endpgm
4115 ; GFX10-WGP-LABEL: flat_system_release_seq_cst_cmpxchg:
4116 ; GFX10-WGP: ; %bb.0: ; %entry
4117 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4118 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4119 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
4120 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
4121 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4122 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4123 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4124 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4125 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4126 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4127 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4128 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4129 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4130 ; GFX10-WGP-NEXT: buffer_gl0_inv
4131 ; GFX10-WGP-NEXT: buffer_gl1_inv
4132 ; GFX10-WGP-NEXT: s_endpgm
4134 ; GFX10-CU-LABEL: flat_system_release_seq_cst_cmpxchg:
4135 ; GFX10-CU: ; %bb.0: ; %entry
4136 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4137 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4138 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
4139 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
4140 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4141 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4142 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4143 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4144 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4145 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4146 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4147 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4148 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4149 ; GFX10-CU-NEXT: buffer_gl0_inv
4150 ; GFX10-CU-NEXT: buffer_gl1_inv
4151 ; GFX10-CU-NEXT: s_endpgm
4153 ; SKIP-CACHE-INV-LABEL: flat_system_release_seq_cst_cmpxchg:
4154 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4155 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4156 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4157 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
4158 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
4159 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4160 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4161 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4162 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4163 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4164 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4165 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4166 ; SKIP-CACHE-INV-NEXT: s_endpgm
4168 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_seq_cst_cmpxchg:
4169 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4170 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4171 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4172 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4173 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4174 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4175 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4176 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4177 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4178 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4179 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4180 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4182 ; GFX90A-TGSPLIT-LABEL: flat_system_release_seq_cst_cmpxchg:
4183 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4184 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4185 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4186 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4187 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4188 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4189 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4190 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4191 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4192 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4193 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4194 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4196 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_seq_cst_cmpxchg:
4197 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4198 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4199 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4200 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4201 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4202 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4203 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4204 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4205 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4206 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4207 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4209 ; GFX940-TGSPLIT-LABEL: flat_system_release_seq_cst_cmpxchg:
4210 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4211 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4212 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4213 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4214 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4215 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4216 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4217 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4218 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4219 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4220 ; GFX940-TGSPLIT-NEXT: s_endpgm
4222 ; GFX11-WGP-LABEL: flat_system_release_seq_cst_cmpxchg:
4223 ; GFX11-WGP: ; %bb.0: ; %entry
4224 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4225 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4226 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4227 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4228 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4229 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4230 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4231 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4232 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4233 ; GFX11-WGP-NEXT: buffer_gl0_inv
4234 ; GFX11-WGP-NEXT: buffer_gl1_inv
4235 ; GFX11-WGP-NEXT: s_endpgm
4237 ; GFX11-CU-LABEL: flat_system_release_seq_cst_cmpxchg:
4238 ; GFX11-CU: ; %bb.0: ; %entry
4239 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4240 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4241 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4242 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4243 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4244 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4245 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4246 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4247 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4248 ; GFX11-CU-NEXT: buffer_gl0_inv
4249 ; GFX11-CU-NEXT: buffer_gl1_inv
4250 ; GFX11-CU-NEXT: s_endpgm
4251 i32* %out, i32 %in, i32 %old) {
4253 %gep = getelementptr i32, i32* %out, i32 4
4254 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in release seq_cst
4258 define amdgpu_kernel void @flat_system_acq_rel_seq_cst_cmpxchg(
4259 ; GFX7-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4260 ; GFX7: ; %bb.0: ; %entry
4261 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4262 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4263 ; GFX7-NEXT: s_add_u32 s0, s0, 16
4264 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
4265 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4266 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4267 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4268 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4269 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4270 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4271 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4272 ; GFX7-NEXT: buffer_wbinvl1_vol
4273 ; GFX7-NEXT: s_endpgm
4275 ; GFX10-WGP-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4276 ; GFX10-WGP: ; %bb.0: ; %entry
4277 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4278 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4279 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
4280 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
4281 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4282 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4283 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4284 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4285 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4286 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4287 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4288 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4289 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4290 ; GFX10-WGP-NEXT: buffer_gl0_inv
4291 ; GFX10-WGP-NEXT: buffer_gl1_inv
4292 ; GFX10-WGP-NEXT: s_endpgm
4294 ; GFX10-CU-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4295 ; GFX10-CU: ; %bb.0: ; %entry
4296 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4297 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4298 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
4299 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
4300 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4301 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4302 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4303 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4304 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4305 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4306 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4307 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4308 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4309 ; GFX10-CU-NEXT: buffer_gl0_inv
4310 ; GFX10-CU-NEXT: buffer_gl1_inv
4311 ; GFX10-CU-NEXT: s_endpgm
4313 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4314 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4315 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4316 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4317 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
4318 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
4319 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4320 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4321 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4322 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4323 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4324 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4325 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4326 ; SKIP-CACHE-INV-NEXT: s_endpgm
4328 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4329 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4330 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4331 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4332 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4333 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4334 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4335 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4336 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4337 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4338 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4339 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4340 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4342 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4343 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4344 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4345 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4346 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4347 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4348 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4349 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4350 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4351 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4352 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4353 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4354 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4356 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4357 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4358 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4359 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4360 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4361 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4362 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4363 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4364 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4365 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4366 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4367 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4369 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4370 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4371 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4372 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4373 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4374 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4375 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4376 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4377 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4378 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4379 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4380 ; GFX940-TGSPLIT-NEXT: s_endpgm
4382 ; GFX11-WGP-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4383 ; GFX11-WGP: ; %bb.0: ; %entry
4384 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4385 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4386 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4387 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4388 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4389 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4390 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4391 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4392 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4393 ; GFX11-WGP-NEXT: buffer_gl0_inv
4394 ; GFX11-WGP-NEXT: buffer_gl1_inv
4395 ; GFX11-WGP-NEXT: s_endpgm
4397 ; GFX11-CU-LABEL: flat_system_acq_rel_seq_cst_cmpxchg:
4398 ; GFX11-CU: ; %bb.0: ; %entry
4399 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4400 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4401 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4402 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4403 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4404 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4405 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4406 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4407 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4408 ; GFX11-CU-NEXT: buffer_gl0_inv
4409 ; GFX11-CU-NEXT: buffer_gl1_inv
4410 ; GFX11-CU-NEXT: s_endpgm
4411 i32* %out, i32 %in, i32 %old) {
4413 %gep = getelementptr i32, i32* %out, i32 4
4414 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acq_rel seq_cst
4418 define amdgpu_kernel void @flat_system_seq_cst_seq_cst_cmpxchg(
4419 ; GFX7-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4420 ; GFX7: ; %bb.0: ; %entry
4421 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4422 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4423 ; GFX7-NEXT: s_add_u32 s0, s0, 16
4424 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
4425 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4426 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4427 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4428 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4429 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4430 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4431 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4432 ; GFX7-NEXT: buffer_wbinvl1_vol
4433 ; GFX7-NEXT: s_endpgm
4435 ; GFX10-WGP-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4436 ; GFX10-WGP: ; %bb.0: ; %entry
4437 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4438 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4439 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
4440 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
4441 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4442 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4443 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4444 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4445 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4446 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4447 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4448 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4449 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4450 ; GFX10-WGP-NEXT: buffer_gl0_inv
4451 ; GFX10-WGP-NEXT: buffer_gl1_inv
4452 ; GFX10-WGP-NEXT: s_endpgm
4454 ; GFX10-CU-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4455 ; GFX10-CU: ; %bb.0: ; %entry
4456 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4457 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4458 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
4459 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
4460 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4461 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4462 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4463 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4464 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4465 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4466 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4467 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4468 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4469 ; GFX10-CU-NEXT: buffer_gl0_inv
4470 ; GFX10-CU-NEXT: buffer_gl1_inv
4471 ; GFX10-CU-NEXT: s_endpgm
4473 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4474 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4475 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4476 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4477 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
4478 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
4479 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4480 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4481 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4482 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4483 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4484 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
4485 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4486 ; SKIP-CACHE-INV-NEXT: s_endpgm
4488 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4489 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4490 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4491 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4492 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4493 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4494 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4495 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4496 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4497 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4498 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4499 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4500 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4502 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4503 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4504 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4505 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4506 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4507 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4508 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4509 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4510 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
4511 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4512 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4513 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4514 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4516 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4517 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4518 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4519 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4520 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4521 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4522 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4523 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4524 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4525 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4526 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4527 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4529 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4530 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4531 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4532 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4533 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4534 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4535 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4536 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4537 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
4538 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4539 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4540 ; GFX940-TGSPLIT-NEXT: s_endpgm
4542 ; GFX11-WGP-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4543 ; GFX11-WGP: ; %bb.0: ; %entry
4544 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4545 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4546 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4547 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4548 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4549 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4550 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4551 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4552 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4553 ; GFX11-WGP-NEXT: buffer_gl0_inv
4554 ; GFX11-WGP-NEXT: buffer_gl1_inv
4555 ; GFX11-WGP-NEXT: s_endpgm
4557 ; GFX11-CU-LABEL: flat_system_seq_cst_seq_cst_cmpxchg:
4558 ; GFX11-CU: ; %bb.0: ; %entry
4559 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4560 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4561 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4562 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4563 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4564 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4565 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
4566 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4567 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
4568 ; GFX11-CU-NEXT: buffer_gl0_inv
4569 ; GFX11-CU-NEXT: buffer_gl1_inv
4570 ; GFX11-CU-NEXT: s_endpgm
4571 i32* %out, i32 %in, i32 %old) {
4573 %gep = getelementptr i32, i32* %out, i32 4
4574 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in seq_cst seq_cst
4578 define amdgpu_kernel void @flat_system_monotonic_monotonic_ret_cmpxchg(
4579 ; GFX7-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4580 ; GFX7: ; %bb.0: ; %entry
4581 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4582 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4583 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4584 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4585 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4586 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4587 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4588 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4589 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4590 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4591 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4592 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4593 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4594 ; GFX7-NEXT: s_endpgm
4596 ; GFX10-WGP-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4597 ; GFX10-WGP: ; %bb.0: ; %entry
4598 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4599 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4600 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
4601 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
4602 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
4603 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4604 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4605 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4606 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4607 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4608 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4609 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4610 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
4611 ; GFX10-WGP-NEXT: s_endpgm
4613 ; GFX10-CU-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4614 ; GFX10-CU: ; %bb.0: ; %entry
4615 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4616 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4617 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
4618 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
4619 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
4620 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4621 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4622 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4623 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4624 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4625 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4626 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4627 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
4628 ; GFX10-CU-NEXT: s_endpgm
4630 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4631 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4632 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4633 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4634 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
4635 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
4636 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
4637 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4638 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
4639 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4640 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4641 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4642 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4643 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4644 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
4645 ; SKIP-CACHE-INV-NEXT: s_endpgm
4647 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4648 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4649 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4650 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4651 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4652 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4653 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4654 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4655 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
4656 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4658 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4659 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4660 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4661 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4662 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4663 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4664 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4665 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4666 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
4667 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4669 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4670 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4671 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4672 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4673 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4674 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4675 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4676 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4677 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
4678 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4680 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4681 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4682 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4683 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4684 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4685 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4686 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4687 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4688 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
4689 ; GFX940-TGSPLIT-NEXT: s_endpgm
4691 ; GFX11-WGP-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4692 ; GFX11-WGP: ; %bb.0: ; %entry
4693 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4694 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4695 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4696 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4697 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4698 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4699 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
4700 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4701 ; GFX11-WGP-NEXT: s_endpgm
4703 ; GFX11-CU-LABEL: flat_system_monotonic_monotonic_ret_cmpxchg:
4704 ; GFX11-CU: ; %bb.0: ; %entry
4705 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4706 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4707 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4708 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4709 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4710 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4711 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
4712 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4713 ; GFX11-CU-NEXT: s_endpgm
4714 i32* %out, i32 %in, i32 %old) {
4716 %gep = getelementptr i32, i32* %out, i32 4
4717 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in monotonic monotonic
4718 %val0 = extractvalue { i32, i1 } %val, 0
4719 store i32 %val0, i32* %out, align 4
4723 define amdgpu_kernel void @flat_system_acquire_monotonic_ret_cmpxchg(
4724 ; GFX7-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4725 ; GFX7: ; %bb.0: ; %entry
4726 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4727 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4728 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4729 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4730 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4731 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4732 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4733 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4734 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4735 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4736 ; GFX7-NEXT: buffer_wbinvl1_vol
4737 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4738 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4739 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4740 ; GFX7-NEXT: s_endpgm
4742 ; GFX10-WGP-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4743 ; GFX10-WGP: ; %bb.0: ; %entry
4744 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4745 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4746 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
4747 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
4748 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
4749 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4750 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4751 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4752 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4753 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4754 ; GFX10-WGP-NEXT: buffer_gl0_inv
4755 ; GFX10-WGP-NEXT: buffer_gl1_inv
4756 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4757 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4758 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
4759 ; GFX10-WGP-NEXT: s_endpgm
4761 ; GFX10-CU-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4762 ; GFX10-CU: ; %bb.0: ; %entry
4763 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4764 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4765 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
4766 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
4767 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
4768 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4769 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4770 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4771 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4772 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4773 ; GFX10-CU-NEXT: buffer_gl0_inv
4774 ; GFX10-CU-NEXT: buffer_gl1_inv
4775 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4776 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4777 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
4778 ; GFX10-CU-NEXT: s_endpgm
4780 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4781 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4782 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4783 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4784 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
4785 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
4786 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
4787 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4788 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
4789 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4790 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4791 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4792 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4793 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4794 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
4795 ; SKIP-CACHE-INV-NEXT: s_endpgm
4797 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4798 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4799 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4800 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4801 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4802 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4803 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4804 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4805 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
4806 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
4807 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
4808 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4810 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4811 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4812 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4813 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4814 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4815 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4816 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4817 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4818 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
4819 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
4820 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
4821 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4823 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4824 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4825 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4826 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4827 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4828 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4829 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4830 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4831 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
4832 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
4833 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4835 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4836 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4837 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4838 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4839 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4840 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4841 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4842 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4843 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
4844 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
4845 ; GFX940-TGSPLIT-NEXT: s_endpgm
4847 ; GFX11-WGP-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4848 ; GFX11-WGP: ; %bb.0: ; %entry
4849 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4850 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4851 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4852 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4853 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4854 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4855 ; GFX11-WGP-NEXT: buffer_gl0_inv
4856 ; GFX11-WGP-NEXT: buffer_gl1_inv
4857 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
4858 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4859 ; GFX11-WGP-NEXT: s_endpgm
4861 ; GFX11-CU-LABEL: flat_system_acquire_monotonic_ret_cmpxchg:
4862 ; GFX11-CU: ; %bb.0: ; %entry
4863 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
4864 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4865 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
4866 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
4867 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
4868 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4869 ; GFX11-CU-NEXT: buffer_gl0_inv
4870 ; GFX11-CU-NEXT: buffer_gl1_inv
4871 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
4872 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
4873 ; GFX11-CU-NEXT: s_endpgm
4874 i32* %out, i32 %in, i32 %old) {
4876 %gep = getelementptr i32, i32* %out, i32 4
4877 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acquire monotonic
4878 %val0 = extractvalue { i32, i1 } %val, 0
4879 store i32 %val0, i32* %out, align 4
4883 define amdgpu_kernel void @flat_system_release_monotonic_ret_cmpxchg(
4884 ; GFX7-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4885 ; GFX7: ; %bb.0: ; %entry
4886 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4887 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4888 ; GFX7-NEXT: s_add_u32 s4, s0, 16
4889 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
4890 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
4891 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
4892 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4893 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
4894 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4895 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4896 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
4897 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
4898 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4899 ; GFX7-NEXT: flat_store_dword v[0:1], v2
4900 ; GFX7-NEXT: s_endpgm
4902 ; GFX10-WGP-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4903 ; GFX10-WGP: ; %bb.0: ; %entry
4904 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4905 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4906 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
4907 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
4908 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
4909 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
4910 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4911 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
4912 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4913 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
4914 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4915 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
4916 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
4917 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4918 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
4919 ; GFX10-WGP-NEXT: s_endpgm
4921 ; GFX10-CU-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4922 ; GFX10-CU: ; %bb.0: ; %entry
4923 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4924 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4925 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
4926 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
4927 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
4928 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
4929 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4930 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
4931 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4932 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
4933 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4934 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
4935 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
4936 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4937 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
4938 ; GFX10-CU-NEXT: s_endpgm
4940 ; SKIP-CACHE-INV-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4941 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4942 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4943 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4944 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
4945 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
4946 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
4947 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
4948 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
4949 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
4950 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4951 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
4952 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
4953 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4954 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4955 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
4956 ; SKIP-CACHE-INV-NEXT: s_endpgm
4958 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4959 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4960 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4961 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4962 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4963 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4964 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
4965 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4966 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4967 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4968 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
4969 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4971 ; GFX90A-TGSPLIT-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4972 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4973 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
4974 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4975 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
4976 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
4977 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
4978 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4979 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
4980 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
4981 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
4982 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4984 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4985 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4986 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
4987 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4988 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
4989 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
4990 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
4991 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4992 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
4993 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
4994 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
4995 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4997 ; GFX940-TGSPLIT-LABEL: flat_system_release_monotonic_ret_cmpxchg:
4998 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4999 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5000 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5001 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5002 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5003 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5004 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5005 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5006 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5007 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5008 ; GFX940-TGSPLIT-NEXT: s_endpgm
5010 ; GFX11-WGP-LABEL: flat_system_release_monotonic_ret_cmpxchg:
5011 ; GFX11-WGP: ; %bb.0: ; %entry
5012 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5013 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5014 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5015 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5016 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5017 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5018 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5019 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5020 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5021 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5022 ; GFX11-WGP-NEXT: s_endpgm
5024 ; GFX11-CU-LABEL: flat_system_release_monotonic_ret_cmpxchg:
5025 ; GFX11-CU: ; %bb.0: ; %entry
5026 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5027 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5028 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5029 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5030 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5031 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5032 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5033 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5034 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5035 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5036 ; GFX11-CU-NEXT: s_endpgm
5037 i32* %out, i32 %in, i32 %old) {
5039 %gep = getelementptr i32, i32* %out, i32 4
5040 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in release monotonic
5041 %val0 = extractvalue { i32, i1 } %val, 0
5042 store i32 %val0, i32* %out, align 4
5046 define amdgpu_kernel void @flat_system_acq_rel_monotonic_ret_cmpxchg(
5047 ; GFX7-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5048 ; GFX7: ; %bb.0: ; %entry
5049 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5050 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5051 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5052 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5053 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5054 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5055 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5056 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5057 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5058 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5059 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5060 ; GFX7-NEXT: buffer_wbinvl1_vol
5061 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5062 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5063 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5064 ; GFX7-NEXT: s_endpgm
5066 ; GFX10-WGP-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5067 ; GFX10-WGP: ; %bb.0: ; %entry
5068 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5069 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5070 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5071 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5072 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5073 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5074 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5075 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5076 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5077 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5078 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5079 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5080 ; GFX10-WGP-NEXT: buffer_gl0_inv
5081 ; GFX10-WGP-NEXT: buffer_gl1_inv
5082 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5083 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5084 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5085 ; GFX10-WGP-NEXT: s_endpgm
5087 ; GFX10-CU-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5088 ; GFX10-CU: ; %bb.0: ; %entry
5089 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5090 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5091 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5092 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5093 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5094 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5095 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5096 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5097 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5098 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5099 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5100 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5101 ; GFX10-CU-NEXT: buffer_gl0_inv
5102 ; GFX10-CU-NEXT: buffer_gl1_inv
5103 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5104 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5105 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5106 ; GFX10-CU-NEXT: s_endpgm
5108 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5109 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5110 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5111 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5112 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5113 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5114 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5115 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5116 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5117 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5118 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5119 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5120 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5121 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5122 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5123 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5124 ; SKIP-CACHE-INV-NEXT: s_endpgm
5126 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5127 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5128 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5129 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5130 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5131 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5132 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5133 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5134 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5135 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5136 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5137 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5138 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5139 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5141 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5142 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5143 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5144 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5145 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5146 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5147 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5148 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5149 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5150 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5151 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5152 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5153 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5154 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5156 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5157 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5158 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5159 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5160 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5161 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5162 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5163 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5164 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5165 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5166 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5167 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5168 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5170 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5171 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5172 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5173 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5174 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5175 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5176 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5177 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5178 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5179 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5180 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5181 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5182 ; GFX940-TGSPLIT-NEXT: s_endpgm
5184 ; GFX11-WGP-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5185 ; GFX11-WGP: ; %bb.0: ; %entry
5186 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5187 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5188 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5189 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5190 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5191 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5192 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5193 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5194 ; GFX11-WGP-NEXT: buffer_gl0_inv
5195 ; GFX11-WGP-NEXT: buffer_gl1_inv
5196 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5197 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5198 ; GFX11-WGP-NEXT: s_endpgm
5200 ; GFX11-CU-LABEL: flat_system_acq_rel_monotonic_ret_cmpxchg:
5201 ; GFX11-CU: ; %bb.0: ; %entry
5202 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5203 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5204 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5205 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5206 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5207 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5208 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5209 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5210 ; GFX11-CU-NEXT: buffer_gl0_inv
5211 ; GFX11-CU-NEXT: buffer_gl1_inv
5212 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5213 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5214 ; GFX11-CU-NEXT: s_endpgm
5215 i32* %out, i32 %in, i32 %old) {
5217 %gep = getelementptr i32, i32* %out, i32 4
5218 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acq_rel monotonic
5219 %val0 = extractvalue { i32, i1 } %val, 0
5220 store i32 %val0, i32* %out, align 4
5224 define amdgpu_kernel void @flat_system_seq_cst_monotonic_ret_cmpxchg(
5225 ; GFX7-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5226 ; GFX7: ; %bb.0: ; %entry
5227 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5228 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5229 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5230 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5231 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5232 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5233 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5234 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5235 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5236 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5237 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5238 ; GFX7-NEXT: buffer_wbinvl1_vol
5239 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5240 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5241 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5242 ; GFX7-NEXT: s_endpgm
5244 ; GFX10-WGP-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5245 ; GFX10-WGP: ; %bb.0: ; %entry
5246 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5247 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5248 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5249 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5250 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5251 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5252 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5253 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5254 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5255 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5256 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5257 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5258 ; GFX10-WGP-NEXT: buffer_gl0_inv
5259 ; GFX10-WGP-NEXT: buffer_gl1_inv
5260 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5261 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5262 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5263 ; GFX10-WGP-NEXT: s_endpgm
5265 ; GFX10-CU-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5266 ; GFX10-CU: ; %bb.0: ; %entry
5267 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5268 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5269 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5270 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5271 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5272 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5273 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5274 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5275 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5276 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5277 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5278 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5279 ; GFX10-CU-NEXT: buffer_gl0_inv
5280 ; GFX10-CU-NEXT: buffer_gl1_inv
5281 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5282 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5283 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5284 ; GFX10-CU-NEXT: s_endpgm
5286 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5287 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5288 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5289 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5290 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5291 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5292 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5293 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5294 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5295 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5296 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5297 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5298 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5299 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5300 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5301 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5302 ; SKIP-CACHE-INV-NEXT: s_endpgm
5304 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5305 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5306 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5307 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5308 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5309 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5310 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5311 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5312 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5313 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5314 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5315 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5316 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5317 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5319 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5320 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5321 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5322 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5323 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5324 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5325 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5326 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5327 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5328 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5329 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5330 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5331 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5332 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5334 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5335 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5336 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5337 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5338 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5339 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5340 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5341 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5342 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5343 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5344 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5345 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5346 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5348 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5349 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5350 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5351 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5352 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5353 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5354 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5355 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5356 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5357 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5358 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5359 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5360 ; GFX940-TGSPLIT-NEXT: s_endpgm
5362 ; GFX11-WGP-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5363 ; GFX11-WGP: ; %bb.0: ; %entry
5364 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5365 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5366 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5367 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5368 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5369 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5370 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5371 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5372 ; GFX11-WGP-NEXT: buffer_gl0_inv
5373 ; GFX11-WGP-NEXT: buffer_gl1_inv
5374 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5375 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5376 ; GFX11-WGP-NEXT: s_endpgm
5378 ; GFX11-CU-LABEL: flat_system_seq_cst_monotonic_ret_cmpxchg:
5379 ; GFX11-CU: ; %bb.0: ; %entry
5380 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5381 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5382 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5383 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5384 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5385 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5386 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5387 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5388 ; GFX11-CU-NEXT: buffer_gl0_inv
5389 ; GFX11-CU-NEXT: buffer_gl1_inv
5390 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5391 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5392 ; GFX11-CU-NEXT: s_endpgm
5393 i32* %out, i32 %in, i32 %old) {
5395 %gep = getelementptr i32, i32* %out, i32 4
5396 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in seq_cst monotonic
5397 %val0 = extractvalue { i32, i1 } %val, 0
5398 store i32 %val0, i32* %out, align 4
5402 define amdgpu_kernel void @flat_system_monotonic_acquire_ret_cmpxchg(
5403 ; GFX7-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5404 ; GFX7: ; %bb.0: ; %entry
5405 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5406 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5407 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5408 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5409 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5410 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5411 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5412 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5413 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5414 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5415 ; GFX7-NEXT: buffer_wbinvl1_vol
5416 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5417 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5418 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5419 ; GFX7-NEXT: s_endpgm
5421 ; GFX10-WGP-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5422 ; GFX10-WGP: ; %bb.0: ; %entry
5423 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5424 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5425 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5426 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5427 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5428 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5429 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5430 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5431 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5432 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5433 ; GFX10-WGP-NEXT: buffer_gl0_inv
5434 ; GFX10-WGP-NEXT: buffer_gl1_inv
5435 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5436 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5437 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5438 ; GFX10-WGP-NEXT: s_endpgm
5440 ; GFX10-CU-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5441 ; GFX10-CU: ; %bb.0: ; %entry
5442 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5443 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5444 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5445 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5446 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5447 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5448 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5449 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5450 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5451 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5452 ; GFX10-CU-NEXT: buffer_gl0_inv
5453 ; GFX10-CU-NEXT: buffer_gl1_inv
5454 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5455 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5456 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5457 ; GFX10-CU-NEXT: s_endpgm
5459 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5460 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5461 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5462 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5463 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5464 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5465 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5466 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5467 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5468 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5469 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5470 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5471 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5472 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5473 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5474 ; SKIP-CACHE-INV-NEXT: s_endpgm
5476 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5477 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5478 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5479 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5480 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5481 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5482 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5483 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5484 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5485 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5486 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5487 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5489 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5490 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5491 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5492 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5493 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5494 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5495 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5496 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5497 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5498 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5499 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5500 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5502 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5503 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5504 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5505 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5506 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5507 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5508 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5509 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5510 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5511 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5512 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5514 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5515 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5516 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5517 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5518 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5519 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5520 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5521 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5522 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5523 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5524 ; GFX940-TGSPLIT-NEXT: s_endpgm
5526 ; GFX11-WGP-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5527 ; GFX11-WGP: ; %bb.0: ; %entry
5528 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5529 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5530 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5531 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5532 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5533 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5534 ; GFX11-WGP-NEXT: buffer_gl0_inv
5535 ; GFX11-WGP-NEXT: buffer_gl1_inv
5536 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5537 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5538 ; GFX11-WGP-NEXT: s_endpgm
5540 ; GFX11-CU-LABEL: flat_system_monotonic_acquire_ret_cmpxchg:
5541 ; GFX11-CU: ; %bb.0: ; %entry
5542 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5543 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5544 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5545 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5546 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5547 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5548 ; GFX11-CU-NEXT: buffer_gl0_inv
5549 ; GFX11-CU-NEXT: buffer_gl1_inv
5550 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5551 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5552 ; GFX11-CU-NEXT: s_endpgm
5553 i32* %out, i32 %in, i32 %old) {
5555 %gep = getelementptr i32, i32* %out, i32 4
5556 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in monotonic acquire
5557 %val0 = extractvalue { i32, i1 } %val, 0
5558 store i32 %val0, i32* %out, align 4
5562 define amdgpu_kernel void @flat_system_acquire_acquire_ret_cmpxchg(
5563 ; GFX7-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5564 ; GFX7: ; %bb.0: ; %entry
5565 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5566 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5567 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5568 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5569 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5570 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5571 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5572 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5573 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5574 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5575 ; GFX7-NEXT: buffer_wbinvl1_vol
5576 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5577 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5578 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5579 ; GFX7-NEXT: s_endpgm
5581 ; GFX10-WGP-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5582 ; GFX10-WGP: ; %bb.0: ; %entry
5583 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5584 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5585 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5586 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5587 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5588 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5589 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5590 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5591 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5592 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5593 ; GFX10-WGP-NEXT: buffer_gl0_inv
5594 ; GFX10-WGP-NEXT: buffer_gl1_inv
5595 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5596 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5597 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5598 ; GFX10-WGP-NEXT: s_endpgm
5600 ; GFX10-CU-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5601 ; GFX10-CU: ; %bb.0: ; %entry
5602 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5603 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5604 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5605 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5606 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5607 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5608 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5609 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5610 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5611 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5612 ; GFX10-CU-NEXT: buffer_gl0_inv
5613 ; GFX10-CU-NEXT: buffer_gl1_inv
5614 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5615 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5616 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5617 ; GFX10-CU-NEXT: s_endpgm
5619 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5620 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5621 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5622 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5623 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5624 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5625 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5626 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5627 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5628 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5629 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5630 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5631 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5632 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5633 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5634 ; SKIP-CACHE-INV-NEXT: s_endpgm
5636 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5637 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5638 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5639 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5640 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5641 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5642 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5643 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5644 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5645 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5646 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5647 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5649 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5650 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5651 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5652 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5653 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5654 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5655 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5656 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5657 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5658 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5659 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5660 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5662 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5663 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5664 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5665 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5666 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5667 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5668 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5669 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5670 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5671 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5672 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5674 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5675 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5676 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5677 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5678 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5679 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5680 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5681 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5682 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5683 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5684 ; GFX940-TGSPLIT-NEXT: s_endpgm
5686 ; GFX11-WGP-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5687 ; GFX11-WGP: ; %bb.0: ; %entry
5688 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5689 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5690 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5691 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5692 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5693 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5694 ; GFX11-WGP-NEXT: buffer_gl0_inv
5695 ; GFX11-WGP-NEXT: buffer_gl1_inv
5696 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5697 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5698 ; GFX11-WGP-NEXT: s_endpgm
5700 ; GFX11-CU-LABEL: flat_system_acquire_acquire_ret_cmpxchg:
5701 ; GFX11-CU: ; %bb.0: ; %entry
5702 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5703 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5704 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5705 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5706 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5707 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5708 ; GFX11-CU-NEXT: buffer_gl0_inv
5709 ; GFX11-CU-NEXT: buffer_gl1_inv
5710 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5711 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5712 ; GFX11-CU-NEXT: s_endpgm
5713 i32* %out, i32 %in, i32 %old) {
5715 %gep = getelementptr i32, i32* %out, i32 4
5716 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acquire acquire
5717 %val0 = extractvalue { i32, i1 } %val, 0
5718 store i32 %val0, i32* %out, align 4
5722 define amdgpu_kernel void @flat_system_release_acquire_ret_cmpxchg(
5723 ; GFX7-LABEL: flat_system_release_acquire_ret_cmpxchg:
5724 ; GFX7: ; %bb.0: ; %entry
5725 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5726 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5727 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5728 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5729 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5730 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5731 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5732 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5733 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5734 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5735 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5736 ; GFX7-NEXT: buffer_wbinvl1_vol
5737 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5738 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5739 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5740 ; GFX7-NEXT: s_endpgm
5742 ; GFX10-WGP-LABEL: flat_system_release_acquire_ret_cmpxchg:
5743 ; GFX10-WGP: ; %bb.0: ; %entry
5744 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5745 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5746 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5747 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5748 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5749 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5750 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5751 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5752 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5753 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5754 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5755 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5756 ; GFX10-WGP-NEXT: buffer_gl0_inv
5757 ; GFX10-WGP-NEXT: buffer_gl1_inv
5758 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5759 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5760 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5761 ; GFX10-WGP-NEXT: s_endpgm
5763 ; GFX10-CU-LABEL: flat_system_release_acquire_ret_cmpxchg:
5764 ; GFX10-CU: ; %bb.0: ; %entry
5765 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5766 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5767 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5768 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5769 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5770 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5771 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5772 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5773 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5774 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5775 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5776 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5777 ; GFX10-CU-NEXT: buffer_gl0_inv
5778 ; GFX10-CU-NEXT: buffer_gl1_inv
5779 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5780 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5781 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5782 ; GFX10-CU-NEXT: s_endpgm
5784 ; SKIP-CACHE-INV-LABEL: flat_system_release_acquire_ret_cmpxchg:
5785 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5786 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5787 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5788 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5789 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5790 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5791 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5792 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5793 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5794 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5795 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5796 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5797 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5798 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5799 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5800 ; SKIP-CACHE-INV-NEXT: s_endpgm
5802 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_acquire_ret_cmpxchg:
5803 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5804 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5805 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5806 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5807 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5808 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5809 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5810 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5811 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5812 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5813 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5814 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5815 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5817 ; GFX90A-TGSPLIT-LABEL: flat_system_release_acquire_ret_cmpxchg:
5818 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5819 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5820 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5821 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5822 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5823 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
5824 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5825 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5826 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5827 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
5828 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
5829 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5830 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5832 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_acquire_ret_cmpxchg:
5833 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5834 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5835 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5836 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5837 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5838 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5839 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5840 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5841 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5842 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
5843 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5844 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5846 ; GFX940-TGSPLIT-LABEL: flat_system_release_acquire_ret_cmpxchg:
5847 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5848 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5849 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5850 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
5851 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
5852 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
5853 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5854 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
5855 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
5856 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
5857 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
5858 ; GFX940-TGSPLIT-NEXT: s_endpgm
5860 ; GFX11-WGP-LABEL: flat_system_release_acquire_ret_cmpxchg:
5861 ; GFX11-WGP: ; %bb.0: ; %entry
5862 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5863 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5864 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5865 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5866 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5867 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5868 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5869 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5870 ; GFX11-WGP-NEXT: buffer_gl0_inv
5871 ; GFX11-WGP-NEXT: buffer_gl1_inv
5872 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
5873 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5874 ; GFX11-WGP-NEXT: s_endpgm
5876 ; GFX11-CU-LABEL: flat_system_release_acquire_ret_cmpxchg:
5877 ; GFX11-CU: ; %bb.0: ; %entry
5878 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
5879 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5880 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
5881 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
5882 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5883 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
5884 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
5885 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5886 ; GFX11-CU-NEXT: buffer_gl0_inv
5887 ; GFX11-CU-NEXT: buffer_gl1_inv
5888 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
5889 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
5890 ; GFX11-CU-NEXT: s_endpgm
5891 i32* %out, i32 %in, i32 %old) {
5893 %gep = getelementptr i32, i32* %out, i32 4
5894 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in release acquire
5895 %val0 = extractvalue { i32, i1 } %val, 0
5896 store i32 %val0, i32* %out, align 4
5900 define amdgpu_kernel void @flat_system_acq_rel_acquire_ret_cmpxchg(
5901 ; GFX7-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5902 ; GFX7: ; %bb.0: ; %entry
5903 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5904 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5905 ; GFX7-NEXT: s_add_u32 s4, s0, 16
5906 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
5907 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5908 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
5909 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5910 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
5911 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5912 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5913 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5914 ; GFX7-NEXT: buffer_wbinvl1_vol
5915 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
5916 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
5917 ; GFX7-NEXT: flat_store_dword v[0:1], v2
5918 ; GFX7-NEXT: s_endpgm
5920 ; GFX10-WGP-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5921 ; GFX10-WGP: ; %bb.0: ; %entry
5922 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5923 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5924 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
5925 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
5926 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5927 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
5928 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5929 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
5930 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5931 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
5932 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5933 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5934 ; GFX10-WGP-NEXT: buffer_gl0_inv
5935 ; GFX10-WGP-NEXT: buffer_gl1_inv
5936 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
5937 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
5938 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
5939 ; GFX10-WGP-NEXT: s_endpgm
5941 ; GFX10-CU-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5942 ; GFX10-CU: ; %bb.0: ; %entry
5943 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5944 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5945 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
5946 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
5947 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5948 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
5949 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5950 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
5951 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5952 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
5953 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5954 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5955 ; GFX10-CU-NEXT: buffer_gl0_inv
5956 ; GFX10-CU-NEXT: buffer_gl1_inv
5957 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
5958 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
5959 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
5960 ; GFX10-CU-NEXT: s_endpgm
5962 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5963 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5964 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
5965 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5966 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
5967 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
5968 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
5969 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
5970 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
5971 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
5972 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5973 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
5974 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5975 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5976 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5977 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
5978 ; SKIP-CACHE-INV-NEXT: s_endpgm
5980 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5981 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5982 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5983 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5984 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
5985 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
5986 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
5987 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5988 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
5989 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
5990 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
5991 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
5992 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
5993 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5995 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
5996 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5997 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
5998 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5999 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6000 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6001 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6002 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6003 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6004 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6005 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6006 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6007 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6008 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6010 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
6011 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6012 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6013 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6014 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6015 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6016 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6017 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6018 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6019 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6020 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6021 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6022 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6024 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
6025 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6026 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6027 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6028 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6029 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6030 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6031 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6032 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6033 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6034 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6035 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6036 ; GFX940-TGSPLIT-NEXT: s_endpgm
6038 ; GFX11-WGP-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
6039 ; GFX11-WGP: ; %bb.0: ; %entry
6040 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6041 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6042 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6043 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6044 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6045 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6046 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6047 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6048 ; GFX11-WGP-NEXT: buffer_gl0_inv
6049 ; GFX11-WGP-NEXT: buffer_gl1_inv
6050 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6051 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6052 ; GFX11-WGP-NEXT: s_endpgm
6054 ; GFX11-CU-LABEL: flat_system_acq_rel_acquire_ret_cmpxchg:
6055 ; GFX11-CU: ; %bb.0: ; %entry
6056 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6057 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6058 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6059 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6060 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6061 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6062 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6063 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6064 ; GFX11-CU-NEXT: buffer_gl0_inv
6065 ; GFX11-CU-NEXT: buffer_gl1_inv
6066 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6067 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6068 ; GFX11-CU-NEXT: s_endpgm
6069 i32* %out, i32 %in, i32 %old) {
6071 %gep = getelementptr i32, i32* %out, i32 4
6072 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acq_rel acquire
6073 %val0 = extractvalue { i32, i1 } %val, 0
6074 store i32 %val0, i32* %out, align 4
6078 define amdgpu_kernel void @flat_system_seq_cst_acquire_ret_cmpxchg(
6079 ; GFX7-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6080 ; GFX7: ; %bb.0: ; %entry
6081 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6082 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6083 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6084 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6085 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6086 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6087 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6088 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6089 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6090 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6091 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6092 ; GFX7-NEXT: buffer_wbinvl1_vol
6093 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6094 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6095 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6096 ; GFX7-NEXT: s_endpgm
6098 ; GFX10-WGP-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6099 ; GFX10-WGP: ; %bb.0: ; %entry
6100 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6101 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6102 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6103 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6104 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6105 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6106 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6107 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6108 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6109 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6110 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6111 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6112 ; GFX10-WGP-NEXT: buffer_gl0_inv
6113 ; GFX10-WGP-NEXT: buffer_gl1_inv
6114 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6115 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6116 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6117 ; GFX10-WGP-NEXT: s_endpgm
6119 ; GFX10-CU-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6120 ; GFX10-CU: ; %bb.0: ; %entry
6121 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6122 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6123 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6124 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6125 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6126 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6127 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6128 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6129 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6130 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6131 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6132 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6133 ; GFX10-CU-NEXT: buffer_gl0_inv
6134 ; GFX10-CU-NEXT: buffer_gl1_inv
6135 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6136 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6137 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6138 ; GFX10-CU-NEXT: s_endpgm
6140 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6141 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6142 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6143 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6144 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6145 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6146 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6147 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6148 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6149 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6150 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6151 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6152 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6153 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6154 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6155 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6156 ; SKIP-CACHE-INV-NEXT: s_endpgm
6158 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6159 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6160 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6161 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6162 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6163 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6164 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6165 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6166 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6167 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6168 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6169 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6170 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6171 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6173 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6174 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6175 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6176 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6177 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6178 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6179 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6180 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6181 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6182 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6183 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6184 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6185 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6186 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6188 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6189 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6190 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6191 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6192 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6193 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6194 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6195 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6196 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6197 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6198 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6199 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6200 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6202 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6203 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6204 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6205 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6206 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6207 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6208 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6209 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6210 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6211 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6212 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6213 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6214 ; GFX940-TGSPLIT-NEXT: s_endpgm
6216 ; GFX11-WGP-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6217 ; GFX11-WGP: ; %bb.0: ; %entry
6218 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6219 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6220 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6221 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6222 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6223 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6224 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6225 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6226 ; GFX11-WGP-NEXT: buffer_gl0_inv
6227 ; GFX11-WGP-NEXT: buffer_gl1_inv
6228 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6229 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6230 ; GFX11-WGP-NEXT: s_endpgm
6232 ; GFX11-CU-LABEL: flat_system_seq_cst_acquire_ret_cmpxchg:
6233 ; GFX11-CU: ; %bb.0: ; %entry
6234 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6235 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6236 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6237 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6238 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6239 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6240 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6241 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6242 ; GFX11-CU-NEXT: buffer_gl0_inv
6243 ; GFX11-CU-NEXT: buffer_gl1_inv
6244 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6245 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6246 ; GFX11-CU-NEXT: s_endpgm
6247 i32* %out, i32 %in, i32 %old) {
6249 %gep = getelementptr i32, i32* %out, i32 4
6250 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in seq_cst acquire
6251 %val0 = extractvalue { i32, i1 } %val, 0
6252 store i32 %val0, i32* %out, align 4
6256 define amdgpu_kernel void @flat_system_monotonic_seq_cst_ret_cmpxchg(
6257 ; GFX7-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6258 ; GFX7: ; %bb.0: ; %entry
6259 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6260 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6261 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6262 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6263 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6264 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6265 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6266 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6267 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6268 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6269 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6270 ; GFX7-NEXT: buffer_wbinvl1_vol
6271 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6272 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6273 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6274 ; GFX7-NEXT: s_endpgm
6276 ; GFX10-WGP-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6277 ; GFX10-WGP: ; %bb.0: ; %entry
6278 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6279 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6280 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6281 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6282 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6283 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6284 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6285 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6286 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6287 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6288 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6289 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6290 ; GFX10-WGP-NEXT: buffer_gl0_inv
6291 ; GFX10-WGP-NEXT: buffer_gl1_inv
6292 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6293 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6294 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6295 ; GFX10-WGP-NEXT: s_endpgm
6297 ; GFX10-CU-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6298 ; GFX10-CU: ; %bb.0: ; %entry
6299 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6300 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6301 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6302 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6303 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6304 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6305 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6306 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6307 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6308 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6309 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6310 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6311 ; GFX10-CU-NEXT: buffer_gl0_inv
6312 ; GFX10-CU-NEXT: buffer_gl1_inv
6313 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6314 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6315 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6316 ; GFX10-CU-NEXT: s_endpgm
6318 ; SKIP-CACHE-INV-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6319 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6320 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6321 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6322 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6323 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6324 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6325 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6326 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6327 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6328 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6329 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6330 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6331 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6332 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6333 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6334 ; SKIP-CACHE-INV-NEXT: s_endpgm
6336 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6337 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6338 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6339 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6340 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6341 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6342 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6343 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6344 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6345 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6346 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6347 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6348 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6349 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6351 ; GFX90A-TGSPLIT-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6352 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6353 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6354 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6355 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6356 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6357 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6358 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6359 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6360 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6361 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6362 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6363 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6364 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6366 ; GFX940-NOTTGSPLIT-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6367 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6368 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6369 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6370 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6371 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6372 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6373 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6374 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6375 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6376 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6377 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6378 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6380 ; GFX940-TGSPLIT-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6381 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6382 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6383 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6384 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6385 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6386 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6387 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6388 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6389 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6390 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6391 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6392 ; GFX940-TGSPLIT-NEXT: s_endpgm
6394 ; GFX11-WGP-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6395 ; GFX11-WGP: ; %bb.0: ; %entry
6396 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6397 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6398 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6399 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6400 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6401 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6402 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6403 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6404 ; GFX11-WGP-NEXT: buffer_gl0_inv
6405 ; GFX11-WGP-NEXT: buffer_gl1_inv
6406 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6407 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6408 ; GFX11-WGP-NEXT: s_endpgm
6410 ; GFX11-CU-LABEL: flat_system_monotonic_seq_cst_ret_cmpxchg:
6411 ; GFX11-CU: ; %bb.0: ; %entry
6412 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6413 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6414 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6415 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6416 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6417 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6418 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6419 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6420 ; GFX11-CU-NEXT: buffer_gl0_inv
6421 ; GFX11-CU-NEXT: buffer_gl1_inv
6422 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6423 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6424 ; GFX11-CU-NEXT: s_endpgm
6425 i32* %out, i32 %in, i32 %old) {
6427 %gep = getelementptr i32, i32* %out, i32 4
6428 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in monotonic seq_cst
6429 %val0 = extractvalue { i32, i1 } %val, 0
6430 store i32 %val0, i32* %out, align 4
6434 define amdgpu_kernel void @flat_system_acquire_seq_cst_ret_cmpxchg(
6435 ; GFX7-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6436 ; GFX7: ; %bb.0: ; %entry
6437 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6438 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6439 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6440 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6441 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6442 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6443 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6444 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6445 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6446 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6447 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6448 ; GFX7-NEXT: buffer_wbinvl1_vol
6449 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6450 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6451 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6452 ; GFX7-NEXT: s_endpgm
6454 ; GFX10-WGP-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6455 ; GFX10-WGP: ; %bb.0: ; %entry
6456 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6457 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6458 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6459 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6460 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6461 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6462 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6463 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6464 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6465 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6466 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6467 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6468 ; GFX10-WGP-NEXT: buffer_gl0_inv
6469 ; GFX10-WGP-NEXT: buffer_gl1_inv
6470 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6471 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6472 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6473 ; GFX10-WGP-NEXT: s_endpgm
6475 ; GFX10-CU-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6476 ; GFX10-CU: ; %bb.0: ; %entry
6477 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6478 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6479 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6480 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6481 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6482 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6483 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6484 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6485 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6486 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6487 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6488 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6489 ; GFX10-CU-NEXT: buffer_gl0_inv
6490 ; GFX10-CU-NEXT: buffer_gl1_inv
6491 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6492 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6493 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6494 ; GFX10-CU-NEXT: s_endpgm
6496 ; SKIP-CACHE-INV-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6497 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6498 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6499 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6500 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6501 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6502 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6503 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6504 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6505 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6506 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6507 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6508 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6509 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6510 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6511 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6512 ; SKIP-CACHE-INV-NEXT: s_endpgm
6514 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6515 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6516 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6517 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6518 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6519 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6520 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6521 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6522 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6523 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6524 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6525 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6526 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6527 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6529 ; GFX90A-TGSPLIT-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6530 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6531 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6532 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6533 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6534 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6535 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6536 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6537 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6538 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6539 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6540 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6541 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6542 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6544 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6545 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6546 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6547 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6548 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6549 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6550 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6551 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6552 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6553 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6554 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6555 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6556 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6558 ; GFX940-TGSPLIT-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6559 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6560 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6561 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6562 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6563 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6564 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6565 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6566 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6567 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6568 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6569 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6570 ; GFX940-TGSPLIT-NEXT: s_endpgm
6572 ; GFX11-WGP-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6573 ; GFX11-WGP: ; %bb.0: ; %entry
6574 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6575 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6576 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6577 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6578 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6579 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6580 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6581 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6582 ; GFX11-WGP-NEXT: buffer_gl0_inv
6583 ; GFX11-WGP-NEXT: buffer_gl1_inv
6584 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6585 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6586 ; GFX11-WGP-NEXT: s_endpgm
6588 ; GFX11-CU-LABEL: flat_system_acquire_seq_cst_ret_cmpxchg:
6589 ; GFX11-CU: ; %bb.0: ; %entry
6590 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6591 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6592 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6593 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6594 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6595 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6596 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6597 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6598 ; GFX11-CU-NEXT: buffer_gl0_inv
6599 ; GFX11-CU-NEXT: buffer_gl1_inv
6600 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6601 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6602 ; GFX11-CU-NEXT: s_endpgm
6603 i32* %out, i32 %in, i32 %old) {
6605 %gep = getelementptr i32, i32* %out, i32 4
6606 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acquire seq_cst
6607 %val0 = extractvalue { i32, i1 } %val, 0
6608 store i32 %val0, i32* %out, align 4
6612 define amdgpu_kernel void @flat_system_release_seq_cst_ret_cmpxchg(
6613 ; GFX7-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6614 ; GFX7: ; %bb.0: ; %entry
6615 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6616 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6617 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6618 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6619 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6620 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6621 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6622 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6623 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6624 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6625 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6626 ; GFX7-NEXT: buffer_wbinvl1_vol
6627 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6628 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6629 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6630 ; GFX7-NEXT: s_endpgm
6632 ; GFX10-WGP-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6633 ; GFX10-WGP: ; %bb.0: ; %entry
6634 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6635 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6636 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6637 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6638 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6639 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6640 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6641 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6642 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6643 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6644 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6645 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6646 ; GFX10-WGP-NEXT: buffer_gl0_inv
6647 ; GFX10-WGP-NEXT: buffer_gl1_inv
6648 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6649 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6650 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6651 ; GFX10-WGP-NEXT: s_endpgm
6653 ; GFX10-CU-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6654 ; GFX10-CU: ; %bb.0: ; %entry
6655 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6656 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6657 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6658 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6659 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6660 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6661 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6662 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6663 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6664 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6665 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6666 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6667 ; GFX10-CU-NEXT: buffer_gl0_inv
6668 ; GFX10-CU-NEXT: buffer_gl1_inv
6669 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6670 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6671 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6672 ; GFX10-CU-NEXT: s_endpgm
6674 ; SKIP-CACHE-INV-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6675 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6676 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6677 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6678 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6679 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6680 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6681 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6682 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6683 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6684 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6685 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6686 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6687 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6688 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6689 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6690 ; SKIP-CACHE-INV-NEXT: s_endpgm
6692 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6693 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6694 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6695 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6696 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6697 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6698 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6699 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6700 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6701 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6702 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6703 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6704 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6705 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6707 ; GFX90A-TGSPLIT-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6708 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6709 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6710 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6711 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6712 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6713 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6714 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6715 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6716 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6717 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6718 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6719 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6720 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6722 ; GFX940-NOTTGSPLIT-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6723 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6724 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6725 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6726 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6727 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6728 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6729 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6730 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6731 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6732 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6733 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6734 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6736 ; GFX940-TGSPLIT-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6737 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6738 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6739 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6740 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6741 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6742 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6743 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6744 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6745 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6746 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6747 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6748 ; GFX940-TGSPLIT-NEXT: s_endpgm
6750 ; GFX11-WGP-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6751 ; GFX11-WGP: ; %bb.0: ; %entry
6752 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6753 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6754 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6755 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6756 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6757 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6758 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6759 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6760 ; GFX11-WGP-NEXT: buffer_gl0_inv
6761 ; GFX11-WGP-NEXT: buffer_gl1_inv
6762 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6763 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6764 ; GFX11-WGP-NEXT: s_endpgm
6766 ; GFX11-CU-LABEL: flat_system_release_seq_cst_ret_cmpxchg:
6767 ; GFX11-CU: ; %bb.0: ; %entry
6768 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6769 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6770 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6771 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6772 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6773 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6774 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6775 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6776 ; GFX11-CU-NEXT: buffer_gl0_inv
6777 ; GFX11-CU-NEXT: buffer_gl1_inv
6778 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6779 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6780 ; GFX11-CU-NEXT: s_endpgm
6781 i32* %out, i32 %in, i32 %old) {
6783 %gep = getelementptr i32, i32* %out, i32 4
6784 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in release seq_cst
6785 %val0 = extractvalue { i32, i1 } %val, 0
6786 store i32 %val0, i32* %out, align 4
6790 define amdgpu_kernel void @flat_system_acq_rel_seq_cst_ret_cmpxchg(
6791 ; GFX7-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6792 ; GFX7: ; %bb.0: ; %entry
6793 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6794 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6795 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6796 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6797 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6798 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6799 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6800 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6801 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6802 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6803 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6804 ; GFX7-NEXT: buffer_wbinvl1_vol
6805 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6806 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6807 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6808 ; GFX7-NEXT: s_endpgm
6810 ; GFX10-WGP-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6811 ; GFX10-WGP: ; %bb.0: ; %entry
6812 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6813 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6814 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6815 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6816 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6817 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6818 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6819 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6820 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6821 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6822 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6823 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6824 ; GFX10-WGP-NEXT: buffer_gl0_inv
6825 ; GFX10-WGP-NEXT: buffer_gl1_inv
6826 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
6827 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
6828 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
6829 ; GFX10-WGP-NEXT: s_endpgm
6831 ; GFX10-CU-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6832 ; GFX10-CU: ; %bb.0: ; %entry
6833 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6834 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6835 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
6836 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
6837 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6838 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
6839 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
6840 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
6841 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6842 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
6843 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6844 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6845 ; GFX10-CU-NEXT: buffer_gl0_inv
6846 ; GFX10-CU-NEXT: buffer_gl1_inv
6847 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
6848 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
6849 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
6850 ; GFX10-CU-NEXT: s_endpgm
6852 ; SKIP-CACHE-INV-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6853 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6854 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6855 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6856 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
6857 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
6858 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
6859 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
6860 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
6861 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
6862 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6863 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6864 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6865 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6866 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
6867 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
6868 ; SKIP-CACHE-INV-NEXT: s_endpgm
6870 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6871 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6872 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6873 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6874 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6875 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6876 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
6877 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6878 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6879 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6880 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
6881 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
6882 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6883 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6885 ; GFX90A-TGSPLIT-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6886 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6887 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6888 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6889 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
6890 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
6891 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
6892 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6893 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
6894 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6895 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
6896 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
6897 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6898 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6900 ; GFX940-NOTTGSPLIT-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6901 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6902 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6903 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6904 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6905 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6906 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6907 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6908 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6909 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6910 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
6911 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
6912 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6914 ; GFX940-TGSPLIT-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6915 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6916 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
6917 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6918 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
6919 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
6920 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
6921 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6922 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
6923 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
6924 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
6925 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
6926 ; GFX940-TGSPLIT-NEXT: s_endpgm
6928 ; GFX11-WGP-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6929 ; GFX11-WGP: ; %bb.0: ; %entry
6930 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6931 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6932 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6933 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6934 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6935 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
6936 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6937 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6938 ; GFX11-WGP-NEXT: buffer_gl0_inv
6939 ; GFX11-WGP-NEXT: buffer_gl1_inv
6940 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
6941 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6942 ; GFX11-WGP-NEXT: s_endpgm
6944 ; GFX11-CU-LABEL: flat_system_acq_rel_seq_cst_ret_cmpxchg:
6945 ; GFX11-CU: ; %bb.0: ; %entry
6946 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
6947 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6948 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
6949 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
6950 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6951 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
6952 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
6953 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6954 ; GFX11-CU-NEXT: buffer_gl0_inv
6955 ; GFX11-CU-NEXT: buffer_gl1_inv
6956 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
6957 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
6958 ; GFX11-CU-NEXT: s_endpgm
6959 i32* %out, i32 %in, i32 %old) {
6961 %gep = getelementptr i32, i32* %out, i32 4
6962 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in acq_rel seq_cst
6963 %val0 = extractvalue { i32, i1 } %val, 0
6964 store i32 %val0, i32* %out, align 4
6968 define amdgpu_kernel void @flat_system_seq_cst_seq_cst_ret_cmpxchg(
6969 ; GFX7-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
6970 ; GFX7: ; %bb.0: ; %entry
6971 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6972 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6973 ; GFX7-NEXT: s_add_u32 s4, s0, 16
6974 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
6975 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6976 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
6977 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
6978 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
6979 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6980 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
6981 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6982 ; GFX7-NEXT: buffer_wbinvl1_vol
6983 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
6984 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
6985 ; GFX7-NEXT: flat_store_dword v[0:1], v2
6986 ; GFX7-NEXT: s_endpgm
6988 ; GFX10-WGP-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
6989 ; GFX10-WGP: ; %bb.0: ; %entry
6990 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
6991 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6992 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
6993 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
6994 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6995 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
6996 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
6997 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
6998 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
6999 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7000 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
7001 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7002 ; GFX10-WGP-NEXT: buffer_gl0_inv
7003 ; GFX10-WGP-NEXT: buffer_gl1_inv
7004 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7005 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7006 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7007 ; GFX10-WGP-NEXT: s_endpgm
7009 ; GFX10-CU-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7010 ; GFX10-CU: ; %bb.0: ; %entry
7011 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7012 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7013 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
7014 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
7015 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7016 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
7017 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
7018 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
7019 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7020 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7021 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
7022 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7023 ; GFX10-CU-NEXT: buffer_gl0_inv
7024 ; GFX10-CU-NEXT: buffer_gl1_inv
7025 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7026 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7027 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7028 ; GFX10-CU-NEXT: s_endpgm
7030 ; SKIP-CACHE-INV-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7031 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7032 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7033 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7034 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
7035 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
7036 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
7037 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
7038 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
7039 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
7040 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7041 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
7042 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7043 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7044 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7045 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7046 ; SKIP-CACHE-INV-NEXT: s_endpgm
7048 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7049 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7050 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7051 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7052 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7053 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
7054 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
7055 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7056 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
7057 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7058 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7059 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7060 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7061 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7063 ; GFX90A-TGSPLIT-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7064 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7065 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7066 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7067 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7068 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
7069 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
7070 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7071 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
7072 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7073 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7074 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7075 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7076 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7078 ; GFX940-NOTTGSPLIT-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7079 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7080 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7081 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7082 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
7083 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
7084 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7085 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7086 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
7087 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7088 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7089 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7090 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7092 ; GFX940-TGSPLIT-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7093 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7094 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7095 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7096 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
7097 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
7098 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
7099 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7100 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
7101 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7102 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7103 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7104 ; GFX940-TGSPLIT-NEXT: s_endpgm
7106 ; GFX11-WGP-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7107 ; GFX11-WGP: ; %bb.0: ; %entry
7108 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7109 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7110 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7111 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
7112 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7113 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7114 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
7115 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7116 ; GFX11-WGP-NEXT: buffer_gl0_inv
7117 ; GFX11-WGP-NEXT: buffer_gl1_inv
7118 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7119 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7120 ; GFX11-WGP-NEXT: s_endpgm
7122 ; GFX11-CU-LABEL: flat_system_seq_cst_seq_cst_ret_cmpxchg:
7123 ; GFX11-CU: ; %bb.0: ; %entry
7124 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7125 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7126 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7127 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
7128 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7129 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
7130 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
7131 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7132 ; GFX11-CU-NEXT: buffer_gl0_inv
7133 ; GFX11-CU-NEXT: buffer_gl1_inv
7134 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7135 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7136 ; GFX11-CU-NEXT: s_endpgm
7137 i32* %out, i32 %in, i32 %old) {
7139 %gep = getelementptr i32, i32* %out, i32 4
7140 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in seq_cst seq_cst
7141 %val0 = extractvalue { i32, i1 } %val, 0
7142 store i32 %val0, i32* %out, align 4
7146 define amdgpu_kernel void @flat_system_one_as_unordered_load(
7147 ; GFX7-LABEL: flat_system_one_as_unordered_load:
7148 ; GFX7: ; %bb.0: ; %entry
7149 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7150 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7151 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7152 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7153 ; GFX7-NEXT: flat_load_dword v2, v[0:1]
7154 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
7155 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
7156 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7157 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7158 ; GFX7-NEXT: s_endpgm
7160 ; GFX10-WGP-LABEL: flat_system_one_as_unordered_load:
7161 ; GFX10-WGP: ; %bb.0: ; %entry
7162 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7163 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7164 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7165 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7166 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1]
7167 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
7168 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
7169 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7170 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7171 ; GFX10-WGP-NEXT: s_endpgm
7173 ; GFX10-CU-LABEL: flat_system_one_as_unordered_load:
7174 ; GFX10-CU: ; %bb.0: ; %entry
7175 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7176 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7177 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7178 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7179 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1]
7180 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
7181 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
7182 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7183 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7184 ; GFX10-CU-NEXT: s_endpgm
7186 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_unordered_load:
7187 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7188 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7189 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7190 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7191 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7192 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1]
7193 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7194 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7195 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7196 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7197 ; SKIP-CACHE-INV-NEXT: s_endpgm
7199 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_unordered_load:
7200 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7201 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7202 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7203 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7204 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7205 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1]
7206 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7207 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7208 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7209 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7210 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7212 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_unordered_load:
7213 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7214 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7215 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7216 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7217 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7218 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1]
7219 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7220 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7221 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7222 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7223 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7225 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_unordered_load:
7226 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7227 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7228 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7229 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7230 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7231 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1]
7232 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7233 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7234 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7235 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7236 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7238 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_unordered_load:
7239 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7240 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7241 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7242 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7243 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7244 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1]
7245 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7246 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7247 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7248 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7249 ; GFX940-TGSPLIT-NEXT: s_endpgm
7251 ; GFX11-WGP-LABEL: flat_system_one_as_unordered_load:
7252 ; GFX11-WGP: ; %bb.0: ; %entry
7253 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7254 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7255 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7256 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1]
7257 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7258 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7259 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7260 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7261 ; GFX11-WGP-NEXT: s_endpgm
7263 ; GFX11-CU-LABEL: flat_system_one_as_unordered_load:
7264 ; GFX11-CU: ; %bb.0: ; %entry
7265 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7266 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7267 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7268 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1]
7269 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7270 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7271 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7272 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7273 ; GFX11-CU-NEXT: s_endpgm
7274 i32* %in, i32* %out) {
7276 %val = load atomic i32, i32* %in syncscope("one-as") unordered, align 4
7277 store i32 %val, i32* %out
7281 define amdgpu_kernel void @flat_system_one_as_monotonic_load(
7282 ; GFX7-LABEL: flat_system_one_as_monotonic_load:
7283 ; GFX7: ; %bb.0: ; %entry
7284 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7285 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7286 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7287 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7288 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
7289 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
7290 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
7291 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7292 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7293 ; GFX7-NEXT: s_endpgm
7295 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_load:
7296 ; GFX10-WGP: ; %bb.0: ; %entry
7297 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7298 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7299 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7300 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7301 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
7302 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
7303 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
7304 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7305 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7306 ; GFX10-WGP-NEXT: s_endpgm
7308 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_load:
7309 ; GFX10-CU: ; %bb.0: ; %entry
7310 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7311 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7312 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7313 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7314 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
7315 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
7316 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
7317 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7318 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7319 ; GFX10-CU-NEXT: s_endpgm
7321 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_load:
7322 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7323 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7324 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7325 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7326 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7327 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
7328 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7329 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7330 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7331 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7332 ; SKIP-CACHE-INV-NEXT: s_endpgm
7334 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_load:
7335 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7336 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7337 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7338 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7339 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7340 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7341 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7342 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7343 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7344 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7345 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7347 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_load:
7348 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7349 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7350 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7351 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7352 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7353 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7354 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7355 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7356 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7357 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7358 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7360 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_load:
7361 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7362 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7363 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7364 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7365 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7366 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7367 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7368 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7369 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7370 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7371 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7373 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_load:
7374 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7375 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7376 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7377 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7378 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7379 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7380 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7381 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7382 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7383 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7384 ; GFX940-TGSPLIT-NEXT: s_endpgm
7386 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_load:
7387 ; GFX11-WGP: ; %bb.0: ; %entry
7388 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7389 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7390 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7391 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
7392 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7393 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7394 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7395 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7396 ; GFX11-WGP-NEXT: s_endpgm
7398 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_load:
7399 ; GFX11-CU: ; %bb.0: ; %entry
7400 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7401 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7402 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7403 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
7404 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7405 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
7406 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7407 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7408 ; GFX11-CU-NEXT: s_endpgm
7409 i32* %in, i32* %out) {
7411 %val = load atomic i32, i32* %in syncscope("one-as") monotonic, align 4
7412 store i32 %val, i32* %out
7416 define amdgpu_kernel void @flat_system_one_as_acquire_load(
7417 ; GFX7-LABEL: flat_system_one_as_acquire_load:
7418 ; GFX7: ; %bb.0: ; %entry
7419 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7420 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7421 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7422 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7423 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
7424 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7425 ; GFX7-NEXT: buffer_wbinvl1_vol
7426 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
7427 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
7428 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7429 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7430 ; GFX7-NEXT: s_endpgm
7432 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_load:
7433 ; GFX10-WGP: ; %bb.0: ; %entry
7434 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7435 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7436 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7437 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7438 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
7439 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7440 ; GFX10-WGP-NEXT: buffer_gl0_inv
7441 ; GFX10-WGP-NEXT: buffer_gl1_inv
7442 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
7443 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
7444 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7445 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7446 ; GFX10-WGP-NEXT: s_endpgm
7448 ; GFX10-CU-LABEL: flat_system_one_as_acquire_load:
7449 ; GFX10-CU: ; %bb.0: ; %entry
7450 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7451 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7452 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7453 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7454 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
7455 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7456 ; GFX10-CU-NEXT: buffer_gl0_inv
7457 ; GFX10-CU-NEXT: buffer_gl1_inv
7458 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
7459 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
7460 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7461 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7462 ; GFX10-CU-NEXT: s_endpgm
7464 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_load:
7465 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7466 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7467 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7468 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7469 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7470 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
7471 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7472 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7473 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7474 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7475 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7476 ; SKIP-CACHE-INV-NEXT: s_endpgm
7478 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_load:
7479 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7480 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7481 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7482 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7483 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7484 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7485 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7486 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7487 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7488 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7489 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7490 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7491 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7492 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7494 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_load:
7495 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7496 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7497 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7498 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7499 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7500 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7501 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7502 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7503 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7504 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7505 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7506 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7507 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7509 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_load:
7510 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7511 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7512 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7513 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7514 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7515 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7516 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7517 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7518 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7519 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7520 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7521 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7522 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7524 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_load:
7525 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7526 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7527 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7528 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7529 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7530 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7531 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7532 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7533 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7534 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7535 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7536 ; GFX940-TGSPLIT-NEXT: s_endpgm
7538 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_load:
7539 ; GFX11-WGP: ; %bb.0: ; %entry
7540 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7541 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7542 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7543 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
7544 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7545 ; GFX11-WGP-NEXT: buffer_gl0_inv
7546 ; GFX11-WGP-NEXT: buffer_gl1_inv
7547 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7548 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7549 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7550 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7551 ; GFX11-WGP-NEXT: s_endpgm
7553 ; GFX11-CU-LABEL: flat_system_one_as_acquire_load:
7554 ; GFX11-CU: ; %bb.0: ; %entry
7555 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7556 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7557 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7558 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
7559 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7560 ; GFX11-CU-NEXT: buffer_gl0_inv
7561 ; GFX11-CU-NEXT: buffer_gl1_inv
7562 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7563 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7564 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7565 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7566 ; GFX11-CU-NEXT: s_endpgm
7567 i32* %in, i32* %out) {
7569 %val = load atomic i32, i32* %in syncscope("one-as") acquire, align 4
7570 store i32 %val, i32* %out
7574 define amdgpu_kernel void @flat_system_one_as_seq_cst_load(
7575 ; GFX7-LABEL: flat_system_one_as_seq_cst_load:
7576 ; GFX7: ; %bb.0: ; %entry
7577 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7578 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7579 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7580 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7581 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7582 ; GFX7-NEXT: flat_load_dword v2, v[0:1] glc
7583 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7584 ; GFX7-NEXT: buffer_wbinvl1_vol
7585 ; GFX7-NEXT: v_mov_b32_e32 v0, s2
7586 ; GFX7-NEXT: v_mov_b32_e32 v1, s3
7587 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7588 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7589 ; GFX7-NEXT: s_endpgm
7591 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_load:
7592 ; GFX10-WGP: ; %bb.0: ; %entry
7593 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7594 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7595 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7596 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7597 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7598 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7599 ; GFX10-WGP-NEXT: flat_load_dword v2, v[0:1] glc dlc
7600 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
7601 ; GFX10-WGP-NEXT: buffer_gl0_inv
7602 ; GFX10-WGP-NEXT: buffer_gl1_inv
7603 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s2
7604 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s3
7605 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7606 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7607 ; GFX10-WGP-NEXT: s_endpgm
7609 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_load:
7610 ; GFX10-CU: ; %bb.0: ; %entry
7611 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7612 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7613 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7614 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7615 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7616 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
7617 ; GFX10-CU-NEXT: flat_load_dword v2, v[0:1] glc dlc
7618 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
7619 ; GFX10-CU-NEXT: buffer_gl0_inv
7620 ; GFX10-CU-NEXT: buffer_gl1_inv
7621 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s2
7622 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s3
7623 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7624 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7625 ; GFX10-CU-NEXT: s_endpgm
7627 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_load:
7628 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7629 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7630 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7631 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7632 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
7633 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7634 ; SKIP-CACHE-INV-NEXT: flat_load_dword v2, v[0:1] glc
7635 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
7636 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7637 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7638 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7639 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7640 ; SKIP-CACHE-INV-NEXT: s_endpgm
7642 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_load:
7643 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7644 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7645 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7646 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7647 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7648 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7649 ; GFX90A-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7650 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7651 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
7652 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
7653 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7654 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7655 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7656 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7657 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7659 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_load:
7660 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7661 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
7662 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7663 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7664 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7665 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7666 ; GFX90A-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] glc
7667 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7668 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
7669 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
7670 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7671 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7672 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7673 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7675 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_load:
7676 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7677 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7678 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7679 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7680 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7681 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7682 ; GFX940-NOTTGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7683 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
7684 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
7685 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7686 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7687 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7688 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7689 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7691 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_load:
7692 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7693 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
7694 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7695 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7696 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
7697 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7698 ; GFX940-TGSPLIT-NEXT: flat_load_dword v2, v[0:1] sc0 sc1
7699 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
7700 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
7701 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
7702 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s3
7703 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7704 ; GFX940-TGSPLIT-NEXT: s_endpgm
7706 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_load:
7707 ; GFX11-WGP: ; %bb.0: ; %entry
7708 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7709 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7710 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7711 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7712 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
7713 ; GFX11-WGP-NEXT: flat_load_b32 v2, v[0:1] glc
7714 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
7715 ; GFX11-WGP-NEXT: buffer_gl0_inv
7716 ; GFX11-WGP-NEXT: buffer_gl1_inv
7717 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7718 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7719 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7720 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7721 ; GFX11-WGP-NEXT: s_endpgm
7723 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_load:
7724 ; GFX11-CU: ; %bb.0: ; %entry
7725 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
7726 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7727 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
7728 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7729 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
7730 ; GFX11-CU-NEXT: flat_load_b32 v2, v[0:1] glc
7731 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
7732 ; GFX11-CU-NEXT: buffer_gl0_inv
7733 ; GFX11-CU-NEXT: buffer_gl1_inv
7734 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7735 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7736 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7737 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7738 ; GFX11-CU-NEXT: s_endpgm
7739 i32* %in, i32* %out) {
7741 %val = load atomic i32, i32* %in syncscope("one-as") seq_cst, align 4
7742 store i32 %val, i32* %out
7746 define amdgpu_kernel void @flat_system_one_as_unordered_store(
7747 ; GFX7-LABEL: flat_system_one_as_unordered_store:
7748 ; GFX7: ; %bb.0: ; %entry
7749 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7750 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7751 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7752 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7753 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7754 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7755 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7756 ; GFX7-NEXT: s_endpgm
7758 ; GFX10-WGP-LABEL: flat_system_one_as_unordered_store:
7759 ; GFX10-WGP: ; %bb.0: ; %entry
7760 ; GFX10-WGP-NEXT: s_clause 0x1
7761 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7762 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7763 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7764 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7765 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7766 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
7767 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7768 ; GFX10-WGP-NEXT: s_endpgm
7770 ; GFX10-CU-LABEL: flat_system_one_as_unordered_store:
7771 ; GFX10-CU: ; %bb.0: ; %entry
7772 ; GFX10-CU-NEXT: s_clause 0x1
7773 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7774 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7775 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7776 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7777 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7778 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
7779 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7780 ; GFX10-CU-NEXT: s_endpgm
7782 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_unordered_store:
7783 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7784 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
7785 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
7786 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7787 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7788 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7789 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
7790 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7791 ; SKIP-CACHE-INV-NEXT: s_endpgm
7793 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_unordered_store:
7794 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7795 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7796 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7797 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7798 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7799 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7800 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7801 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7803 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_unordered_store:
7804 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7805 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7806 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7807 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7808 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7809 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7810 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7811 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7813 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_unordered_store:
7814 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7815 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7816 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7817 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7818 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
7819 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
7820 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7821 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7823 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_unordered_store:
7824 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7825 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7826 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7827 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7828 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
7829 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
7830 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7831 ; GFX940-TGSPLIT-NEXT: s_endpgm
7833 ; GFX11-WGP-LABEL: flat_system_one_as_unordered_store:
7834 ; GFX11-WGP: ; %bb.0: ; %entry
7835 ; GFX11-WGP-NEXT: s_clause 0x1
7836 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
7837 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
7838 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7839 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7840 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
7841 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7842 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7843 ; GFX11-WGP-NEXT: s_endpgm
7845 ; GFX11-CU-LABEL: flat_system_one_as_unordered_store:
7846 ; GFX11-CU: ; %bb.0: ; %entry
7847 ; GFX11-CU-NEXT: s_clause 0x1
7848 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
7849 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
7850 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7851 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7852 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
7853 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7854 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7855 ; GFX11-CU-NEXT: s_endpgm
7856 i32 %in, i32* %out) {
7858 store atomic i32 %in, i32* %out syncscope("one-as") unordered, align 4
7862 define amdgpu_kernel void @flat_system_one_as_monotonic_store(
7863 ; GFX7-LABEL: flat_system_one_as_monotonic_store:
7864 ; GFX7: ; %bb.0: ; %entry
7865 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7866 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7867 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7868 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7869 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7870 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7871 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7872 ; GFX7-NEXT: s_endpgm
7874 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_store:
7875 ; GFX10-WGP: ; %bb.0: ; %entry
7876 ; GFX10-WGP-NEXT: s_clause 0x1
7877 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7878 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7879 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7880 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7881 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7882 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
7883 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
7884 ; GFX10-WGP-NEXT: s_endpgm
7886 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_store:
7887 ; GFX10-CU: ; %bb.0: ; %entry
7888 ; GFX10-CU-NEXT: s_clause 0x1
7889 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7890 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
7891 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7892 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
7893 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
7894 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
7895 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
7896 ; GFX10-CU-NEXT: s_endpgm
7898 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_store:
7899 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7900 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
7901 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
7902 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7903 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
7904 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
7905 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
7906 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
7907 ; SKIP-CACHE-INV-NEXT: s_endpgm
7909 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_store:
7910 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7911 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7912 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7913 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7914 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7915 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7916 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
7917 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7919 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_store:
7920 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7921 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7922 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
7923 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7924 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
7925 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
7926 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
7927 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7929 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_store:
7930 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7931 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7932 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7933 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7934 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
7935 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
7936 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7937 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7939 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_store:
7940 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7941 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
7942 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
7943 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7944 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
7945 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
7946 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
7947 ; GFX940-TGSPLIT-NEXT: s_endpgm
7949 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_store:
7950 ; GFX11-WGP: ; %bb.0: ; %entry
7951 ; GFX11-WGP-NEXT: s_clause 0x1
7952 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
7953 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
7954 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7955 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7956 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
7957 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
7958 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7959 ; GFX11-WGP-NEXT: s_endpgm
7961 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_store:
7962 ; GFX11-CU: ; %bb.0: ; %entry
7963 ; GFX11-CU-NEXT: s_clause 0x1
7964 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
7965 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
7966 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7967 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
7968 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
7969 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
7970 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
7971 ; GFX11-CU-NEXT: s_endpgm
7972 i32 %in, i32* %out) {
7974 store atomic i32 %in, i32* %out syncscope("one-as") monotonic, align 4
7978 define amdgpu_kernel void @flat_system_one_as_release_store(
7979 ; GFX7-LABEL: flat_system_one_as_release_store:
7980 ; GFX7: ; %bb.0: ; %entry
7981 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
7982 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
7983 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7984 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
7985 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
7986 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
7987 ; GFX7-NEXT: s_waitcnt vmcnt(0)
7988 ; GFX7-NEXT: flat_store_dword v[0:1], v2
7989 ; GFX7-NEXT: s_endpgm
7991 ; GFX10-WGP-LABEL: flat_system_one_as_release_store:
7992 ; GFX10-WGP: ; %bb.0: ; %entry
7993 ; GFX10-WGP-NEXT: s_clause 0x1
7994 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
7995 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
7996 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7997 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
7998 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
7999 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8000 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8001 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8002 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
8003 ; GFX10-WGP-NEXT: s_endpgm
8005 ; GFX10-CU-LABEL: flat_system_one_as_release_store:
8006 ; GFX10-CU: ; %bb.0: ; %entry
8007 ; GFX10-CU-NEXT: s_clause 0x1
8008 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8009 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
8010 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8011 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8012 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8013 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8014 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8015 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8016 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
8017 ; GFX10-CU-NEXT: s_endpgm
8019 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_store:
8020 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8021 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
8022 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
8023 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8024 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8025 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8026 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8027 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8028 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
8029 ; SKIP-CACHE-INV-NEXT: s_endpgm
8031 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_store:
8032 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8033 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8034 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
8035 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8036 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8037 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8038 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8039 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8040 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
8041 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8043 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_store:
8044 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8045 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8046 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
8047 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8048 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8049 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8050 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8051 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8052 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
8053 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8055 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_store:
8056 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8057 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
8058 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
8059 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8060 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8061 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8062 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8063 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8064 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
8065 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8067 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_store:
8068 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8069 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
8070 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
8071 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8072 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8073 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8074 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8075 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8076 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
8077 ; GFX940-TGSPLIT-NEXT: s_endpgm
8079 ; GFX11-WGP-LABEL: flat_system_one_as_release_store:
8080 ; GFX11-WGP: ; %bb.0: ; %entry
8081 ; GFX11-WGP-NEXT: s_clause 0x1
8082 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
8083 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
8084 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8085 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8086 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8087 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8088 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8089 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
8090 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8091 ; GFX11-WGP-NEXT: s_endpgm
8093 ; GFX11-CU-LABEL: flat_system_one_as_release_store:
8094 ; GFX11-CU: ; %bb.0: ; %entry
8095 ; GFX11-CU-NEXT: s_clause 0x1
8096 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
8097 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
8098 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8099 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8100 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8101 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8102 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8103 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
8104 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8105 ; GFX11-CU-NEXT: s_endpgm
8106 i32 %in, i32* %out) {
8108 store atomic i32 %in, i32* %out syncscope("one-as") release, align 4
8112 define amdgpu_kernel void @flat_system_one_as_seq_cst_store(
8113 ; GFX7-LABEL: flat_system_one_as_seq_cst_store:
8114 ; GFX7: ; %bb.0: ; %entry
8115 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x2
8116 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x0
8117 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8118 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8119 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8120 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8121 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8122 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8123 ; GFX7-NEXT: s_endpgm
8125 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_store:
8126 ; GFX10-WGP: ; %bb.0: ; %entry
8127 ; GFX10-WGP-NEXT: s_clause 0x1
8128 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8129 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x0
8130 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8131 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8132 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8133 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8134 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8135 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8136 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
8137 ; GFX10-WGP-NEXT: s_endpgm
8139 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_store:
8140 ; GFX10-CU: ; %bb.0: ; %entry
8141 ; GFX10-CU-NEXT: s_clause 0x1
8142 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8143 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x0
8144 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8145 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8146 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8147 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8148 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8149 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8150 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
8151 ; GFX10-CU-NEXT: s_endpgm
8153 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_store:
8154 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8155 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x2
8156 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x0
8157 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8158 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8159 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8160 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8161 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8162 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
8163 ; SKIP-CACHE-INV-NEXT: s_endpgm
8165 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_store:
8166 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8167 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8168 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
8169 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8170 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8171 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8172 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8173 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8174 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
8175 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8177 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_store:
8178 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8179 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x8
8180 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
8181 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8182 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8183 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8184 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8185 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8186 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
8187 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8189 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_store:
8190 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8191 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
8192 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
8193 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8194 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8195 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8196 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8197 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8198 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
8199 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8201 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_store:
8202 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8203 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x8
8204 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x0
8205 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8206 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8207 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8208 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8209 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8210 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
8211 ; GFX940-TGSPLIT-NEXT: s_endpgm
8213 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_store:
8214 ; GFX11-WGP: ; %bb.0: ; %entry
8215 ; GFX11-WGP-NEXT: s_clause 0x1
8216 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
8217 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x0
8218 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8219 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8220 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8221 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8222 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8223 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
8224 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8225 ; GFX11-WGP-NEXT: s_endpgm
8227 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_store:
8228 ; GFX11-CU: ; %bb.0: ; %entry
8229 ; GFX11-CU-NEXT: s_clause 0x1
8230 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x8
8231 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x0
8232 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8233 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8234 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8235 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8236 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8237 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
8238 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8239 ; GFX11-CU-NEXT: s_endpgm
8240 i32 %in, i32* %out) {
8242 store atomic i32 %in, i32* %out syncscope("one-as") seq_cst, align 4
8246 define amdgpu_kernel void @flat_system_one_as_monotonic_atomicrmw(
8247 ; GFX7-LABEL: flat_system_one_as_monotonic_atomicrmw:
8248 ; GFX7: ; %bb.0: ; %entry
8249 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8250 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8251 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8252 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8253 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8254 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8255 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8256 ; GFX7-NEXT: s_endpgm
8258 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_atomicrmw:
8259 ; GFX10-WGP: ; %bb.0: ; %entry
8260 ; GFX10-WGP-NEXT: s_clause 0x1
8261 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8262 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8263 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8264 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8265 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8266 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8267 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8268 ; GFX10-WGP-NEXT: s_endpgm
8270 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_atomicrmw:
8271 ; GFX10-CU: ; %bb.0: ; %entry
8272 ; GFX10-CU-NEXT: s_clause 0x1
8273 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8274 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8275 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8276 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8277 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8278 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8279 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8280 ; GFX10-CU-NEXT: s_endpgm
8282 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_atomicrmw:
8283 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8284 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8285 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8286 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8287 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8288 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8289 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8290 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8291 ; SKIP-CACHE-INV-NEXT: s_endpgm
8293 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_atomicrmw:
8294 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8295 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8296 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8297 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8298 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8299 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8300 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8301 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8303 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_atomicrmw:
8304 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8305 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8306 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8307 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8308 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8309 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8310 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8311 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8313 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_atomicrmw:
8314 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8315 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8316 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8317 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8318 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8319 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8320 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8321 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8323 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_atomicrmw:
8324 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8325 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8326 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8327 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8328 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8329 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8330 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8331 ; GFX940-TGSPLIT-NEXT: s_endpgm
8333 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_atomicrmw:
8334 ; GFX11-WGP: ; %bb.0: ; %entry
8335 ; GFX11-WGP-NEXT: s_clause 0x1
8336 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8337 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8338 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8339 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8340 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8341 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8342 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8343 ; GFX11-WGP-NEXT: s_endpgm
8345 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_atomicrmw:
8346 ; GFX11-CU: ; %bb.0: ; %entry
8347 ; GFX11-CU-NEXT: s_clause 0x1
8348 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8349 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8350 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8351 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8352 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8353 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8354 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8355 ; GFX11-CU-NEXT: s_endpgm
8356 i32* %out, i32 %in) {
8358 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("one-as") monotonic
8362 define amdgpu_kernel void @flat_system_one_as_acquire_atomicrmw(
8363 ; GFX7-LABEL: flat_system_one_as_acquire_atomicrmw:
8364 ; GFX7: ; %bb.0: ; %entry
8365 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8366 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8367 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8368 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8369 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8370 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8371 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8372 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8373 ; GFX7-NEXT: buffer_wbinvl1_vol
8374 ; GFX7-NEXT: s_endpgm
8376 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_atomicrmw:
8377 ; GFX10-WGP: ; %bb.0: ; %entry
8378 ; GFX10-WGP-NEXT: s_clause 0x1
8379 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8380 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8381 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8382 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8383 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8384 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8385 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8386 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8387 ; GFX10-WGP-NEXT: buffer_gl0_inv
8388 ; GFX10-WGP-NEXT: buffer_gl1_inv
8389 ; GFX10-WGP-NEXT: s_endpgm
8391 ; GFX10-CU-LABEL: flat_system_one_as_acquire_atomicrmw:
8392 ; GFX10-CU: ; %bb.0: ; %entry
8393 ; GFX10-CU-NEXT: s_clause 0x1
8394 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8395 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8396 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8397 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8398 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8399 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8400 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8401 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8402 ; GFX10-CU-NEXT: buffer_gl0_inv
8403 ; GFX10-CU-NEXT: buffer_gl1_inv
8404 ; GFX10-CU-NEXT: s_endpgm
8406 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_atomicrmw:
8407 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8408 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8409 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8410 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8411 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8412 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8413 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8414 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8415 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8416 ; SKIP-CACHE-INV-NEXT: s_endpgm
8418 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_atomicrmw:
8419 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8420 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8421 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8422 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8423 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8424 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8425 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8426 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8427 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8428 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8429 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8431 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_atomicrmw:
8432 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8433 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8434 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8435 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8436 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8437 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8438 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8439 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8440 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8441 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8442 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8444 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_atomicrmw:
8445 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8446 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8447 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8448 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8449 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8450 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8451 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8452 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8453 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8454 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8456 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_atomicrmw:
8457 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8458 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8459 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8460 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8461 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8462 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8463 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8464 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8465 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8466 ; GFX940-TGSPLIT-NEXT: s_endpgm
8468 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_atomicrmw:
8469 ; GFX11-WGP: ; %bb.0: ; %entry
8470 ; GFX11-WGP-NEXT: s_clause 0x1
8471 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8472 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8473 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8474 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8475 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8476 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8477 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8478 ; GFX11-WGP-NEXT: buffer_gl0_inv
8479 ; GFX11-WGP-NEXT: buffer_gl1_inv
8480 ; GFX11-WGP-NEXT: s_endpgm
8482 ; GFX11-CU-LABEL: flat_system_one_as_acquire_atomicrmw:
8483 ; GFX11-CU: ; %bb.0: ; %entry
8484 ; GFX11-CU-NEXT: s_clause 0x1
8485 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8486 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8487 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8488 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8489 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8490 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8491 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8492 ; GFX11-CU-NEXT: buffer_gl0_inv
8493 ; GFX11-CU-NEXT: buffer_gl1_inv
8494 ; GFX11-CU-NEXT: s_endpgm
8495 i32* %out, i32 %in) {
8497 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("one-as") acquire
8501 define amdgpu_kernel void @flat_system_one_as_release_atomicrmw(
8502 ; GFX7-LABEL: flat_system_one_as_release_atomicrmw:
8503 ; GFX7: ; %bb.0: ; %entry
8504 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8505 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8506 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8507 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8508 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8509 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8510 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8511 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8512 ; GFX7-NEXT: s_endpgm
8514 ; GFX10-WGP-LABEL: flat_system_one_as_release_atomicrmw:
8515 ; GFX10-WGP: ; %bb.0: ; %entry
8516 ; GFX10-WGP-NEXT: s_clause 0x1
8517 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8518 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8519 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8520 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8521 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8522 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8523 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8524 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8525 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8526 ; GFX10-WGP-NEXT: s_endpgm
8528 ; GFX10-CU-LABEL: flat_system_one_as_release_atomicrmw:
8529 ; GFX10-CU: ; %bb.0: ; %entry
8530 ; GFX10-CU-NEXT: s_clause 0x1
8531 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8532 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8533 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8534 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8535 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8536 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8537 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8538 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8539 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8540 ; GFX10-CU-NEXT: s_endpgm
8542 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_atomicrmw:
8543 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8544 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8545 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8546 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8547 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8548 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8549 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8550 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8551 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8552 ; SKIP-CACHE-INV-NEXT: s_endpgm
8554 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_atomicrmw:
8555 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8556 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8557 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8558 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8559 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8560 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8561 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8562 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8563 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8564 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8566 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_atomicrmw:
8567 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8568 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8569 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8570 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8571 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8572 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8573 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8574 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8575 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8576 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8578 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_atomicrmw:
8579 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8580 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8581 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8582 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8583 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8584 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8585 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8586 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8587 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8588 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8590 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_atomicrmw:
8591 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8592 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8593 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8594 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8595 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8596 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8597 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8598 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8599 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8600 ; GFX940-TGSPLIT-NEXT: s_endpgm
8602 ; GFX11-WGP-LABEL: flat_system_one_as_release_atomicrmw:
8603 ; GFX11-WGP: ; %bb.0: ; %entry
8604 ; GFX11-WGP-NEXT: s_clause 0x1
8605 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8606 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8607 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8608 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8609 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8610 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8611 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8612 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8613 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8614 ; GFX11-WGP-NEXT: s_endpgm
8616 ; GFX11-CU-LABEL: flat_system_one_as_release_atomicrmw:
8617 ; GFX11-CU: ; %bb.0: ; %entry
8618 ; GFX11-CU-NEXT: s_clause 0x1
8619 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8620 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8621 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8622 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8623 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8624 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8625 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8626 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8627 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
8628 ; GFX11-CU-NEXT: s_endpgm
8629 i32* %out, i32 %in) {
8631 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("one-as") release
8635 define amdgpu_kernel void @flat_system_one_as_acq_rel_atomicrmw(
8636 ; GFX7-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8637 ; GFX7: ; %bb.0: ; %entry
8638 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8639 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8640 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8641 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8642 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8643 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8644 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8645 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8646 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8647 ; GFX7-NEXT: buffer_wbinvl1_vol
8648 ; GFX7-NEXT: s_endpgm
8650 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8651 ; GFX10-WGP: ; %bb.0: ; %entry
8652 ; GFX10-WGP-NEXT: s_clause 0x1
8653 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8654 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8655 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8656 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8657 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8658 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8659 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8660 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8661 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8662 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8663 ; GFX10-WGP-NEXT: buffer_gl0_inv
8664 ; GFX10-WGP-NEXT: buffer_gl1_inv
8665 ; GFX10-WGP-NEXT: s_endpgm
8667 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8668 ; GFX10-CU: ; %bb.0: ; %entry
8669 ; GFX10-CU-NEXT: s_clause 0x1
8670 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8671 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8672 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8673 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8674 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8675 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8676 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8677 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8678 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8679 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8680 ; GFX10-CU-NEXT: buffer_gl0_inv
8681 ; GFX10-CU-NEXT: buffer_gl1_inv
8682 ; GFX10-CU-NEXT: s_endpgm
8684 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8685 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8686 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8687 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8688 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8689 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8690 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8691 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8692 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8693 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8694 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8695 ; SKIP-CACHE-INV-NEXT: s_endpgm
8697 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8698 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8699 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8700 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8701 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8702 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8703 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8704 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8705 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8706 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8707 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8708 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8709 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8710 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8712 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8713 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8714 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8715 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8716 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8717 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8718 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8719 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8720 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8721 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8722 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8723 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8724 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8725 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8727 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8728 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8729 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8730 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8731 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8732 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8733 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8734 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8735 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8736 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8737 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8738 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8739 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8741 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8742 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8743 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8744 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8745 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8746 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8747 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8748 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8749 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8750 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8751 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8752 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8753 ; GFX940-TGSPLIT-NEXT: s_endpgm
8755 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8756 ; GFX11-WGP: ; %bb.0: ; %entry
8757 ; GFX11-WGP-NEXT: s_clause 0x1
8758 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8759 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8760 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8761 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8762 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8763 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8764 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8765 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8766 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8767 ; GFX11-WGP-NEXT: buffer_gl0_inv
8768 ; GFX11-WGP-NEXT: buffer_gl1_inv
8769 ; GFX11-WGP-NEXT: s_endpgm
8771 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_atomicrmw:
8772 ; GFX11-CU: ; %bb.0: ; %entry
8773 ; GFX11-CU-NEXT: s_clause 0x1
8774 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8775 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8776 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8777 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8778 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8779 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8780 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8781 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8782 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8783 ; GFX11-CU-NEXT: buffer_gl0_inv
8784 ; GFX11-CU-NEXT: buffer_gl1_inv
8785 ; GFX11-CU-NEXT: s_endpgm
8786 i32* %out, i32 %in) {
8788 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("one-as") acq_rel
8792 define amdgpu_kernel void @flat_system_one_as_seq_cst_atomicrmw(
8793 ; GFX7-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8794 ; GFX7: ; %bb.0: ; %entry
8795 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8796 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8797 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8798 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8799 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8800 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8801 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8802 ; GFX7-NEXT: flat_atomic_swap v[0:1], v2
8803 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8804 ; GFX7-NEXT: buffer_wbinvl1_vol
8805 ; GFX7-NEXT: s_endpgm
8807 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8808 ; GFX10-WGP: ; %bb.0: ; %entry
8809 ; GFX10-WGP-NEXT: s_clause 0x1
8810 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8811 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8812 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8813 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8814 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8815 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8816 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8817 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8818 ; GFX10-WGP-NEXT: flat_atomic_swap v[0:1], v2
8819 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8820 ; GFX10-WGP-NEXT: buffer_gl0_inv
8821 ; GFX10-WGP-NEXT: buffer_gl1_inv
8822 ; GFX10-WGP-NEXT: s_endpgm
8824 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8825 ; GFX10-CU: ; %bb.0: ; %entry
8826 ; GFX10-CU-NEXT: s_clause 0x1
8827 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8828 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8829 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8830 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8831 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8832 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8833 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8834 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8835 ; GFX10-CU-NEXT: flat_atomic_swap v[0:1], v2
8836 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
8837 ; GFX10-CU-NEXT: buffer_gl0_inv
8838 ; GFX10-CU-NEXT: buffer_gl1_inv
8839 ; GFX10-CU-NEXT: s_endpgm
8841 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8842 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8843 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8844 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
8845 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8846 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
8847 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
8848 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
8849 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8850 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v[0:1], v2
8851 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
8852 ; SKIP-CACHE-INV-NEXT: s_endpgm
8854 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8855 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8856 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8857 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8858 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8859 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8860 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8861 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
8862 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8863 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8864 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8865 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
8866 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
8867 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8869 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8870 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8871 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8872 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
8873 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8874 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
8875 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
8876 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
8877 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8878 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2
8879 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8880 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
8881 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
8882 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8884 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8885 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8886 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8887 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8888 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8889 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8890 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8891 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8892 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8893 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8894 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
8895 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
8896 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8898 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8899 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8900 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
8901 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
8902 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8903 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
8904 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
8905 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
8906 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8907 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v[0:1], v2 sc1
8908 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
8909 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
8910 ; GFX940-TGSPLIT-NEXT: s_endpgm
8912 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8913 ; GFX11-WGP: ; %bb.0: ; %entry
8914 ; GFX11-WGP-NEXT: s_clause 0x1
8915 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8916 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
8917 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8918 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8919 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
8920 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
8921 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8922 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v[0:1], v2
8923 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
8924 ; GFX11-WGP-NEXT: buffer_gl0_inv
8925 ; GFX11-WGP-NEXT: buffer_gl1_inv
8926 ; GFX11-WGP-NEXT: s_endpgm
8928 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_atomicrmw:
8929 ; GFX11-CU: ; %bb.0: ; %entry
8930 ; GFX11-CU-NEXT: s_clause 0x1
8931 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
8932 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
8933 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8934 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
8935 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
8936 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
8937 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8938 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v[0:1], v2
8939 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
8940 ; GFX11-CU-NEXT: buffer_gl0_inv
8941 ; GFX11-CU-NEXT: buffer_gl1_inv
8942 ; GFX11-CU-NEXT: s_endpgm
8943 i32* %out, i32 %in) {
8945 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("one-as") seq_cst
8949 define amdgpu_kernel void @flat_system_one_as_acquire_ret_atomicrmw(
8950 ; GFX7-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8951 ; GFX7: ; %bb.0: ; %entry
8952 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8953 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
8954 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8955 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
8956 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
8957 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
8958 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8959 ; GFX7-NEXT: s_waitcnt vmcnt(0)
8960 ; GFX7-NEXT: buffer_wbinvl1_vol
8961 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8962 ; GFX7-NEXT: flat_store_dword v[0:1], v2
8963 ; GFX7-NEXT: s_endpgm
8965 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8966 ; GFX10-WGP: ; %bb.0: ; %entry
8967 ; GFX10-WGP-NEXT: s_clause 0x1
8968 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8969 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
8970 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8971 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
8972 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
8973 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
8974 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8975 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
8976 ; GFX10-WGP-NEXT: buffer_gl0_inv
8977 ; GFX10-WGP-NEXT: buffer_gl1_inv
8978 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8979 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
8980 ; GFX10-WGP-NEXT: s_endpgm
8982 ; GFX10-CU-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
8983 ; GFX10-CU: ; %bb.0: ; %entry
8984 ; GFX10-CU-NEXT: s_clause 0x1
8985 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
8986 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
8987 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8988 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
8989 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
8990 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
8991 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
8992 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
8993 ; GFX10-CU-NEXT: buffer_gl0_inv
8994 ; GFX10-CU-NEXT: buffer_gl1_inv
8995 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8996 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
8997 ; GFX10-CU-NEXT: s_endpgm
8999 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
9000 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9001 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9002 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
9003 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9004 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9005 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9006 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
9007 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9008 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9009 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
9010 ; SKIP-CACHE-INV-NEXT: s_endpgm
9012 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
9013 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9014 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9015 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9016 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9017 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9018 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9019 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9020 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9021 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9022 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9023 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9024 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
9025 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9027 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
9028 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9029 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9030 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9031 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9032 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9033 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9034 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9035 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9036 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9037 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9038 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
9039 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9041 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
9042 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9043 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9044 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9045 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9046 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9047 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9048 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9049 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9050 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9051 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9052 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
9053 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9055 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
9056 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9057 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9058 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9059 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9060 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9061 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9062 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9063 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9064 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9065 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
9066 ; GFX940-TGSPLIT-NEXT: s_endpgm
9068 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
9069 ; GFX11-WGP: ; %bb.0: ; %entry
9070 ; GFX11-WGP-NEXT: s_clause 0x1
9071 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9072 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
9073 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9074 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9075 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
9076 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9077 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9078 ; GFX11-WGP-NEXT: buffer_gl0_inv
9079 ; GFX11-WGP-NEXT: buffer_gl1_inv
9080 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9081 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
9082 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9083 ; GFX11-WGP-NEXT: s_endpgm
9085 ; GFX11-CU-LABEL: flat_system_one_as_acquire_ret_atomicrmw:
9086 ; GFX11-CU: ; %bb.0: ; %entry
9087 ; GFX11-CU-NEXT: s_clause 0x1
9088 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9089 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
9090 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9091 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9092 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
9093 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9094 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9095 ; GFX11-CU-NEXT: buffer_gl0_inv
9096 ; GFX11-CU-NEXT: buffer_gl1_inv
9097 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9098 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
9099 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9100 ; GFX11-CU-NEXT: s_endpgm
9101 i32* %out, i32 %in) {
9103 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("one-as") acquire
9104 store i32 %val, i32* %out, align 4
9108 define amdgpu_kernel void @flat_system_one_as_acq_rel_ret_atomicrmw(
9109 ; GFX7-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9110 ; GFX7: ; %bb.0: ; %entry
9111 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9112 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
9113 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9114 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9115 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9116 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9117 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9118 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9119 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9120 ; GFX7-NEXT: buffer_wbinvl1_vol
9121 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9122 ; GFX7-NEXT: flat_store_dword v[0:1], v2
9123 ; GFX7-NEXT: s_endpgm
9125 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9126 ; GFX10-WGP: ; %bb.0: ; %entry
9127 ; GFX10-WGP-NEXT: s_clause 0x1
9128 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9129 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
9130 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9131 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9132 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9133 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9134 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9135 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9136 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9137 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9138 ; GFX10-WGP-NEXT: buffer_gl0_inv
9139 ; GFX10-WGP-NEXT: buffer_gl1_inv
9140 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9141 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
9142 ; GFX10-WGP-NEXT: s_endpgm
9144 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9145 ; GFX10-CU: ; %bb.0: ; %entry
9146 ; GFX10-CU-NEXT: s_clause 0x1
9147 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9148 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
9149 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9150 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9151 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9152 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9153 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9154 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9155 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9156 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9157 ; GFX10-CU-NEXT: buffer_gl0_inv
9158 ; GFX10-CU-NEXT: buffer_gl1_inv
9159 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9160 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
9161 ; GFX10-CU-NEXT: s_endpgm
9163 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9164 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9165 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9166 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
9167 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9168 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9169 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9170 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
9171 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9172 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9173 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9174 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
9175 ; SKIP-CACHE-INV-NEXT: s_endpgm
9177 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9178 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9179 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9180 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9181 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9182 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9183 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9184 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9185 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9186 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9187 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9188 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9189 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9190 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9191 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
9192 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9194 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9195 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9196 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9197 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9198 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9199 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9200 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9201 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9202 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9203 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9204 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9205 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9206 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9207 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
9208 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9210 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9211 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9212 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9213 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9214 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9215 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9216 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9217 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9218 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9219 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9220 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9221 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9222 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9223 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
9224 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9226 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9227 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9228 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9229 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9230 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9231 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9232 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9233 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9234 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9235 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9236 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9237 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9238 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
9239 ; GFX940-TGSPLIT-NEXT: s_endpgm
9241 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9242 ; GFX11-WGP: ; %bb.0: ; %entry
9243 ; GFX11-WGP-NEXT: s_clause 0x1
9244 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9245 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
9246 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9247 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9248 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
9249 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9250 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9251 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9252 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9253 ; GFX11-WGP-NEXT: buffer_gl0_inv
9254 ; GFX11-WGP-NEXT: buffer_gl1_inv
9255 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9256 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
9257 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9258 ; GFX11-WGP-NEXT: s_endpgm
9260 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_ret_atomicrmw:
9261 ; GFX11-CU: ; %bb.0: ; %entry
9262 ; GFX11-CU-NEXT: s_clause 0x1
9263 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9264 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
9265 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9266 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9267 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
9268 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9269 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9270 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9271 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9272 ; GFX11-CU-NEXT: buffer_gl0_inv
9273 ; GFX11-CU-NEXT: buffer_gl1_inv
9274 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9275 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
9276 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9277 ; GFX11-CU-NEXT: s_endpgm
9278 i32* %out, i32 %in) {
9280 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("one-as") acq_rel
9281 store i32 %val, i32* %out, align 4
9285 define amdgpu_kernel void @flat_system_one_as_seq_cst_ret_atomicrmw(
9286 ; GFX7-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9287 ; GFX7: ; %bb.0: ; %entry
9288 ; GFX7-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9289 ; GFX7-NEXT: s_load_dword s2, s[4:5], 0x2
9290 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9291 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9292 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9293 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9294 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9295 ; GFX7-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9296 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9297 ; GFX7-NEXT: buffer_wbinvl1_vol
9298 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9299 ; GFX7-NEXT: flat_store_dword v[0:1], v2
9300 ; GFX7-NEXT: s_endpgm
9302 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9303 ; GFX10-WGP: ; %bb.0: ; %entry
9304 ; GFX10-WGP-NEXT: s_clause 0x1
9305 ; GFX10-WGP-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9306 ; GFX10-WGP-NEXT: s_load_dword s2, s[4:5], 0x8
9307 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9308 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9309 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9310 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9311 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9312 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9313 ; GFX10-WGP-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9314 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9315 ; GFX10-WGP-NEXT: buffer_gl0_inv
9316 ; GFX10-WGP-NEXT: buffer_gl1_inv
9317 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9318 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
9319 ; GFX10-WGP-NEXT: s_endpgm
9321 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9322 ; GFX10-CU: ; %bb.0: ; %entry
9323 ; GFX10-CU-NEXT: s_clause 0x1
9324 ; GFX10-CU-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9325 ; GFX10-CU-NEXT: s_load_dword s2, s[4:5], 0x8
9326 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9327 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9328 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9329 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9330 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9331 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9332 ; GFX10-CU-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9333 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9334 ; GFX10-CU-NEXT: buffer_gl0_inv
9335 ; GFX10-CU-NEXT: buffer_gl1_inv
9336 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9337 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
9338 ; GFX10-CU-NEXT: s_endpgm
9340 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9341 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9342 ; SKIP-CACHE-INV-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9343 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[0:1], 0x2
9344 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9345 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
9346 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s3
9347 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
9348 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9349 ; SKIP-CACHE-INV-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9350 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
9351 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
9352 ; SKIP-CACHE-INV-NEXT: s_endpgm
9354 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9355 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9356 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9357 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9358 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9359 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9360 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9361 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9362 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9363 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9364 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9365 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9366 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9367 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9368 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
9369 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9371 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9372 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9373 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9374 ; GFX90A-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x8
9375 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9376 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9377 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s2
9378 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9379 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9380 ; GFX90A-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 glc
9381 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9382 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9383 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9384 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
9385 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9387 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9388 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9389 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9390 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9391 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9392 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9393 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9394 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9395 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9396 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9397 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9398 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9399 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9400 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
9401 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9403 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9404 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9405 ; GFX940-TGSPLIT-NEXT: s_load_dwordx2 s[2:3], s[0:1], 0x0
9406 ; GFX940-TGSPLIT-NEXT: s_load_dword s4, s[0:1], 0x8
9407 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9408 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[2:3]
9409 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
9410 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9411 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9412 ; GFX940-TGSPLIT-NEXT: flat_atomic_swap v2, v[0:1], v2 sc0 sc1
9413 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9414 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9415 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
9416 ; GFX940-TGSPLIT-NEXT: s_endpgm
9418 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9419 ; GFX11-WGP: ; %bb.0: ; %entry
9420 ; GFX11-WGP-NEXT: s_clause 0x1
9421 ; GFX11-WGP-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9422 ; GFX11-WGP-NEXT: s_load_b32 s0, s[0:1], 0x8
9423 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9424 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9425 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
9426 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9427 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9428 ; GFX11-WGP-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9429 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9430 ; GFX11-WGP-NEXT: buffer_gl0_inv
9431 ; GFX11-WGP-NEXT: buffer_gl1_inv
9432 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9433 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
9434 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9435 ; GFX11-WGP-NEXT: s_endpgm
9437 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_ret_atomicrmw:
9438 ; GFX11-CU: ; %bb.0: ; %entry
9439 ; GFX11-CU-NEXT: s_clause 0x1
9440 ; GFX11-CU-NEXT: s_load_b64 s[2:3], s[0:1], 0x0
9441 ; GFX11-CU-NEXT: s_load_b32 s0, s[0:1], 0x8
9442 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9443 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s2 :: v_dual_mov_b32 v1, s3
9444 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
9445 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9446 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9447 ; GFX11-CU-NEXT: flat_atomic_swap_b32 v2, v[0:1], v2 glc
9448 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9449 ; GFX11-CU-NEXT: buffer_gl0_inv
9450 ; GFX11-CU-NEXT: buffer_gl1_inv
9451 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9452 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
9453 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9454 ; GFX11-CU-NEXT: s_endpgm
9455 i32* %out, i32 %in) {
9457 %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("one-as") seq_cst
9458 store i32 %val, i32* %out, align 4
9462 define amdgpu_kernel void @flat_system_one_as_monotonic_monotonic_cmpxchg(
9463 ; GFX7-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9464 ; GFX7: ; %bb.0: ; %entry
9465 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9466 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9467 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9468 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9469 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9470 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9471 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9472 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9473 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9474 ; GFX7-NEXT: s_endpgm
9476 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9477 ; GFX10-WGP: ; %bb.0: ; %entry
9478 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9479 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9480 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
9481 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
9482 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9483 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9484 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9485 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
9486 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9487 ; GFX10-WGP-NEXT: s_endpgm
9489 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9490 ; GFX10-CU: ; %bb.0: ; %entry
9491 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9492 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9493 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
9494 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
9495 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9496 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9497 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9498 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
9499 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9500 ; GFX10-CU-NEXT: s_endpgm
9502 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9503 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9504 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9505 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9506 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
9507 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
9508 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9509 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
9510 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
9511 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
9512 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9513 ; SKIP-CACHE-INV-NEXT: s_endpgm
9515 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9516 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9517 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9518 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9519 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9520 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9521 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9522 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9524 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9525 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9526 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9527 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9528 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9529 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9530 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9531 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9533 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9534 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9535 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9536 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9537 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9538 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9539 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9540 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9542 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9543 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9544 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9545 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9546 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9547 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9548 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9549 ; GFX940-TGSPLIT-NEXT: s_endpgm
9551 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9552 ; GFX11-WGP: ; %bb.0: ; %entry
9553 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9554 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9555 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9556 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9557 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9558 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9559 ; GFX11-WGP-NEXT: s_endpgm
9561 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_monotonic_cmpxchg:
9562 ; GFX11-CU: ; %bb.0: ; %entry
9563 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9564 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9565 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9566 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9567 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9568 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9569 ; GFX11-CU-NEXT: s_endpgm
9570 i32* %out, i32 %in, i32 %old) {
9572 %gep = getelementptr i32, i32* %out, i32 4
9573 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") monotonic monotonic
9577 define amdgpu_kernel void @flat_system_one_as_acquire_monotonic_cmpxchg(
9578 ; GFX7-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9579 ; GFX7: ; %bb.0: ; %entry
9580 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9581 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9582 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9583 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9584 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9585 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9586 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9587 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9588 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9589 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9590 ; GFX7-NEXT: buffer_wbinvl1_vol
9591 ; GFX7-NEXT: s_endpgm
9593 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9594 ; GFX10-WGP: ; %bb.0: ; %entry
9595 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9596 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9597 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
9598 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
9599 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9600 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9601 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9602 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
9603 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9604 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9605 ; GFX10-WGP-NEXT: buffer_gl0_inv
9606 ; GFX10-WGP-NEXT: buffer_gl1_inv
9607 ; GFX10-WGP-NEXT: s_endpgm
9609 ; GFX10-CU-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9610 ; GFX10-CU: ; %bb.0: ; %entry
9611 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9612 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9613 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
9614 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
9615 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9616 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9617 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9618 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
9619 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9620 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9621 ; GFX10-CU-NEXT: buffer_gl0_inv
9622 ; GFX10-CU-NEXT: buffer_gl1_inv
9623 ; GFX10-CU-NEXT: s_endpgm
9625 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9626 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9627 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9628 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9629 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
9630 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
9631 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9632 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
9633 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
9634 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
9635 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9636 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9637 ; SKIP-CACHE-INV-NEXT: s_endpgm
9639 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9640 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9641 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9642 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9643 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9644 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9645 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9646 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9647 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9648 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9649 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9651 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9652 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9653 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9654 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9655 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9656 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9657 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9658 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9659 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9660 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9661 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9663 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9664 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9665 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9666 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9667 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9668 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9669 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9670 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9671 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9672 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9674 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9675 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9676 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9677 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9678 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9679 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9680 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9681 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9682 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9683 ; GFX940-TGSPLIT-NEXT: s_endpgm
9685 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9686 ; GFX11-WGP: ; %bb.0: ; %entry
9687 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9688 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9689 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9690 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9691 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9692 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9693 ; GFX11-WGP-NEXT: buffer_gl0_inv
9694 ; GFX11-WGP-NEXT: buffer_gl1_inv
9695 ; GFX11-WGP-NEXT: s_endpgm
9697 ; GFX11-CU-LABEL: flat_system_one_as_acquire_monotonic_cmpxchg:
9698 ; GFX11-CU: ; %bb.0: ; %entry
9699 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9700 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9701 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9702 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9703 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9704 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9705 ; GFX11-CU-NEXT: buffer_gl0_inv
9706 ; GFX11-CU-NEXT: buffer_gl1_inv
9707 ; GFX11-CU-NEXT: s_endpgm
9708 i32* %out, i32 %in, i32 %old) {
9710 %gep = getelementptr i32, i32* %out, i32 4
9711 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acquire monotonic
9715 define amdgpu_kernel void @flat_system_one_as_release_monotonic_cmpxchg(
9716 ; GFX7-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9717 ; GFX7: ; %bb.0: ; %entry
9718 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9719 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9720 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9721 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9722 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9723 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9724 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9725 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9726 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9727 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9728 ; GFX7-NEXT: s_endpgm
9730 ; GFX10-WGP-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9731 ; GFX10-WGP: ; %bb.0: ; %entry
9732 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9733 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9734 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
9735 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
9736 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9737 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9738 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9739 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
9740 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9741 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9742 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9743 ; GFX10-WGP-NEXT: s_endpgm
9745 ; GFX10-CU-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9746 ; GFX10-CU: ; %bb.0: ; %entry
9747 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9748 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9749 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
9750 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
9751 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9752 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9753 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9754 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
9755 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9756 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9757 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9758 ; GFX10-CU-NEXT: s_endpgm
9760 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9761 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9762 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9763 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9764 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
9765 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
9766 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9767 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
9768 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
9769 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
9770 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9771 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9772 ; SKIP-CACHE-INV-NEXT: s_endpgm
9774 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9775 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9776 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9777 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9778 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9779 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9780 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9781 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9782 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9783 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9785 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9786 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9787 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9788 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9789 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9790 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9791 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9792 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9793 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9794 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9796 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9797 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9798 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9799 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9800 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9801 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9802 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9803 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9804 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9805 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9807 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9808 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9809 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9810 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9811 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9812 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9813 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9814 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9815 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9816 ; GFX940-TGSPLIT-NEXT: s_endpgm
9818 ; GFX11-WGP-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9819 ; GFX11-WGP: ; %bb.0: ; %entry
9820 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9821 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9822 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9823 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9824 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9825 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9826 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9827 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9828 ; GFX11-WGP-NEXT: s_endpgm
9830 ; GFX11-CU-LABEL: flat_system_one_as_release_monotonic_cmpxchg:
9831 ; GFX11-CU: ; %bb.0: ; %entry
9832 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9833 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9834 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9835 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9836 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9837 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9838 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9839 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
9840 ; GFX11-CU-NEXT: s_endpgm
9841 i32* %out, i32 %in, i32 %old) {
9843 %gep = getelementptr i32, i32* %out, i32 4
9844 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") release monotonic
9848 define amdgpu_kernel void @flat_system_one_as_acq_rel_monotonic_cmpxchg(
9849 ; GFX7-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9850 ; GFX7: ; %bb.0: ; %entry
9851 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9852 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9853 ; GFX7-NEXT: s_add_u32 s0, s0, 16
9854 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
9855 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
9856 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
9857 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
9858 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
9859 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9860 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9861 ; GFX7-NEXT: s_waitcnt vmcnt(0)
9862 ; GFX7-NEXT: buffer_wbinvl1_vol
9863 ; GFX7-NEXT: s_endpgm
9865 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9866 ; GFX10-WGP: ; %bb.0: ; %entry
9867 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9868 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9869 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
9870 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
9871 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
9872 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
9873 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
9874 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
9875 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
9876 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9877 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9878 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9879 ; GFX10-WGP-NEXT: buffer_gl0_inv
9880 ; GFX10-WGP-NEXT: buffer_gl1_inv
9881 ; GFX10-WGP-NEXT: s_endpgm
9883 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9884 ; GFX10-CU: ; %bb.0: ; %entry
9885 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9886 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9887 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
9888 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
9889 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
9890 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
9891 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
9892 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
9893 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
9894 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9895 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9896 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
9897 ; GFX10-CU-NEXT: buffer_gl0_inv
9898 ; GFX10-CU-NEXT: buffer_gl1_inv
9899 ; GFX10-CU-NEXT: s_endpgm
9901 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9902 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9903 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9904 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9905 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
9906 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
9907 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9908 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
9909 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
9910 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
9911 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9912 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
9913 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
9914 ; SKIP-CACHE-INV-NEXT: s_endpgm
9916 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9917 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9918 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9919 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9920 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9921 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9922 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
9923 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9924 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9925 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9926 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
9927 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
9928 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9930 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9931 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9932 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
9933 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9934 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
9935 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
9936 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
9937 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9938 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
9939 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9940 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
9941 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
9942 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9944 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9945 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9946 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9947 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9948 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9949 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9950 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9951 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9952 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9953 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
9954 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
9955 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9957 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9958 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9959 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
9960 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9961 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
9962 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
9963 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
9964 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9965 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
9966 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
9967 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
9968 ; GFX940-TGSPLIT-NEXT: s_endpgm
9970 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9971 ; GFX11-WGP: ; %bb.0: ; %entry
9972 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9973 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9974 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9975 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9976 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
9977 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9978 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9979 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
9980 ; GFX11-WGP-NEXT: buffer_gl0_inv
9981 ; GFX11-WGP-NEXT: buffer_gl1_inv
9982 ; GFX11-WGP-NEXT: s_endpgm
9984 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_monotonic_cmpxchg:
9985 ; GFX11-CU: ; %bb.0: ; %entry
9986 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
9987 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9988 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
9989 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
9990 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
9991 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9992 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
9993 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
9994 ; GFX11-CU-NEXT: buffer_gl0_inv
9995 ; GFX11-CU-NEXT: buffer_gl1_inv
9996 ; GFX11-CU-NEXT: s_endpgm
9997 i32* %out, i32 %in, i32 %old) {
9999 %gep = getelementptr i32, i32* %out, i32 4
10000 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel monotonic
10004 define amdgpu_kernel void @flat_system_one_as_seq_cst_monotonic_cmpxchg(
10005 ; GFX7-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10006 ; GFX7: ; %bb.0: ; %entry
10007 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10008 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10009 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10010 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10011 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10012 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10013 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10014 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10015 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10016 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10017 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10018 ; GFX7-NEXT: buffer_wbinvl1_vol
10019 ; GFX7-NEXT: s_endpgm
10021 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10022 ; GFX10-WGP: ; %bb.0: ; %entry
10023 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10024 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10025 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10026 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10027 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10028 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10029 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10030 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10031 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10032 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10033 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10034 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10035 ; GFX10-WGP-NEXT: buffer_gl0_inv
10036 ; GFX10-WGP-NEXT: buffer_gl1_inv
10037 ; GFX10-WGP-NEXT: s_endpgm
10039 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10040 ; GFX10-CU: ; %bb.0: ; %entry
10041 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10042 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10043 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10044 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10045 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10046 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10047 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10048 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10049 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10050 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10051 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10052 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10053 ; GFX10-CU-NEXT: buffer_gl0_inv
10054 ; GFX10-CU-NEXT: buffer_gl1_inv
10055 ; GFX10-CU-NEXT: s_endpgm
10057 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10058 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10059 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10060 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10061 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10062 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10063 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10064 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10065 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10066 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10067 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10068 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10069 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10070 ; SKIP-CACHE-INV-NEXT: s_endpgm
10072 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10073 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10074 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10075 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10076 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10077 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10078 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10079 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10080 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10081 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10082 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10083 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10084 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10086 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10087 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10088 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10089 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10090 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10091 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10092 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10093 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10094 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10095 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10096 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10097 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10098 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10100 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10101 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10102 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10103 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10104 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10105 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10106 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10107 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10108 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10109 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10110 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10111 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10113 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10114 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10115 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10116 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10117 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10118 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10119 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10120 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10121 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10122 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10123 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10124 ; GFX940-TGSPLIT-NEXT: s_endpgm
10126 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10127 ; GFX11-WGP: ; %bb.0: ; %entry
10128 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10129 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10130 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10131 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10132 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10133 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10134 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10135 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10136 ; GFX11-WGP-NEXT: buffer_gl0_inv
10137 ; GFX11-WGP-NEXT: buffer_gl1_inv
10138 ; GFX11-WGP-NEXT: s_endpgm
10140 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_monotonic_cmpxchg:
10141 ; GFX11-CU: ; %bb.0: ; %entry
10142 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10143 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10144 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10145 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10146 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10147 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10148 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10149 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10150 ; GFX11-CU-NEXT: buffer_gl0_inv
10151 ; GFX11-CU-NEXT: buffer_gl1_inv
10152 ; GFX11-CU-NEXT: s_endpgm
10153 i32* %out, i32 %in, i32 %old) {
10155 %gep = getelementptr i32, i32* %out, i32 4
10156 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst monotonic
10160 define amdgpu_kernel void @flat_system_one_as_monotonic_acquire_cmpxchg(
10161 ; GFX7-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10162 ; GFX7: ; %bb.0: ; %entry
10163 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10164 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10165 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10166 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10167 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10168 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10169 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10170 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10171 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10172 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10173 ; GFX7-NEXT: buffer_wbinvl1_vol
10174 ; GFX7-NEXT: s_endpgm
10176 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10177 ; GFX10-WGP: ; %bb.0: ; %entry
10178 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10179 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10180 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10181 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10182 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10183 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10184 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10185 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10186 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10187 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10188 ; GFX10-WGP-NEXT: buffer_gl0_inv
10189 ; GFX10-WGP-NEXT: buffer_gl1_inv
10190 ; GFX10-WGP-NEXT: s_endpgm
10192 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10193 ; GFX10-CU: ; %bb.0: ; %entry
10194 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10195 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10196 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10197 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10198 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10199 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10200 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10201 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10202 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10203 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10204 ; GFX10-CU-NEXT: buffer_gl0_inv
10205 ; GFX10-CU-NEXT: buffer_gl1_inv
10206 ; GFX10-CU-NEXT: s_endpgm
10208 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10209 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10210 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10211 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10212 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10213 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10214 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10215 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10216 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10217 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10218 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10219 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10220 ; SKIP-CACHE-INV-NEXT: s_endpgm
10222 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10223 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10224 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10225 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10226 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10227 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10228 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10229 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10230 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10231 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10232 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10234 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10235 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10236 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10237 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10238 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10239 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10240 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10241 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10242 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10243 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10244 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10246 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10247 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10248 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10249 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10250 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10251 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10252 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10253 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10254 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10255 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10257 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10258 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10259 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10260 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10261 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10262 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10263 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10264 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10265 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10266 ; GFX940-TGSPLIT-NEXT: s_endpgm
10268 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10269 ; GFX11-WGP: ; %bb.0: ; %entry
10270 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10271 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10272 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10273 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10274 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10275 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10276 ; GFX11-WGP-NEXT: buffer_gl0_inv
10277 ; GFX11-WGP-NEXT: buffer_gl1_inv
10278 ; GFX11-WGP-NEXT: s_endpgm
10280 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_acquire_cmpxchg:
10281 ; GFX11-CU: ; %bb.0: ; %entry
10282 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10283 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10284 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10285 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10286 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10287 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10288 ; GFX11-CU-NEXT: buffer_gl0_inv
10289 ; GFX11-CU-NEXT: buffer_gl1_inv
10290 ; GFX11-CU-NEXT: s_endpgm
10291 i32* %out, i32 %in, i32 %old) {
10293 %gep = getelementptr i32, i32* %out, i32 4
10294 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") monotonic acquire
10298 define amdgpu_kernel void @flat_system_one_as_acquire_acquire_cmpxchg(
10299 ; GFX7-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10300 ; GFX7: ; %bb.0: ; %entry
10301 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10302 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10303 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10304 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10305 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10306 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10307 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10308 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10309 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10310 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10311 ; GFX7-NEXT: buffer_wbinvl1_vol
10312 ; GFX7-NEXT: s_endpgm
10314 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10315 ; GFX10-WGP: ; %bb.0: ; %entry
10316 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10317 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10318 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10319 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10320 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10321 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10322 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10323 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10324 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10325 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10326 ; GFX10-WGP-NEXT: buffer_gl0_inv
10327 ; GFX10-WGP-NEXT: buffer_gl1_inv
10328 ; GFX10-WGP-NEXT: s_endpgm
10330 ; GFX10-CU-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10331 ; GFX10-CU: ; %bb.0: ; %entry
10332 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10333 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10334 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10335 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10336 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10337 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10338 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10339 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10340 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10341 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10342 ; GFX10-CU-NEXT: buffer_gl0_inv
10343 ; GFX10-CU-NEXT: buffer_gl1_inv
10344 ; GFX10-CU-NEXT: s_endpgm
10346 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10347 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10348 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10349 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10350 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10351 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10352 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10353 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10354 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10355 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10356 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10357 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10358 ; SKIP-CACHE-INV-NEXT: s_endpgm
10360 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10361 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10362 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10363 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10364 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10365 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10366 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10367 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10368 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10369 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10370 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10372 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10373 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10374 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10375 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10376 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10377 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10378 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10379 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10380 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10381 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10382 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10384 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10385 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10386 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10387 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10388 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10389 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10390 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10391 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10392 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10393 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10395 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10396 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10397 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10398 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10399 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10400 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10401 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10402 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10403 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10404 ; GFX940-TGSPLIT-NEXT: s_endpgm
10406 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10407 ; GFX11-WGP: ; %bb.0: ; %entry
10408 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10409 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10410 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10411 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10412 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10413 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10414 ; GFX11-WGP-NEXT: buffer_gl0_inv
10415 ; GFX11-WGP-NEXT: buffer_gl1_inv
10416 ; GFX11-WGP-NEXT: s_endpgm
10418 ; GFX11-CU-LABEL: flat_system_one_as_acquire_acquire_cmpxchg:
10419 ; GFX11-CU: ; %bb.0: ; %entry
10420 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10421 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10422 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10423 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10424 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10425 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10426 ; GFX11-CU-NEXT: buffer_gl0_inv
10427 ; GFX11-CU-NEXT: buffer_gl1_inv
10428 ; GFX11-CU-NEXT: s_endpgm
10429 i32* %out, i32 %in, i32 %old) {
10431 %gep = getelementptr i32, i32* %out, i32 4
10432 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acquire acquire
10436 define amdgpu_kernel void @flat_system_one_as_release_acquire_cmpxchg(
10437 ; GFX7-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10438 ; GFX7: ; %bb.0: ; %entry
10439 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10440 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10441 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10442 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10443 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10444 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10445 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10446 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10447 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10448 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10449 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10450 ; GFX7-NEXT: buffer_wbinvl1_vol
10451 ; GFX7-NEXT: s_endpgm
10453 ; GFX10-WGP-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10454 ; GFX10-WGP: ; %bb.0: ; %entry
10455 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10456 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10457 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10458 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10459 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10460 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10461 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10462 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10463 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10464 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10465 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10466 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10467 ; GFX10-WGP-NEXT: buffer_gl0_inv
10468 ; GFX10-WGP-NEXT: buffer_gl1_inv
10469 ; GFX10-WGP-NEXT: s_endpgm
10471 ; GFX10-CU-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10472 ; GFX10-CU: ; %bb.0: ; %entry
10473 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10474 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10475 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10476 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10477 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10478 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10479 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10480 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10481 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10482 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10483 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10484 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10485 ; GFX10-CU-NEXT: buffer_gl0_inv
10486 ; GFX10-CU-NEXT: buffer_gl1_inv
10487 ; GFX10-CU-NEXT: s_endpgm
10489 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10490 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10491 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10492 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10493 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10494 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10495 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10496 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10497 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10498 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10499 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10500 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10501 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10502 ; SKIP-CACHE-INV-NEXT: s_endpgm
10504 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10505 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10506 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10507 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10508 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10509 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10510 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10511 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10512 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10513 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10514 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10515 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10516 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10518 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10519 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10520 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10521 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10522 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10523 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10524 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10525 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10526 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10527 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10528 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10529 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10530 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10532 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10533 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10534 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10535 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10536 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10537 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10538 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10539 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10540 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10541 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10542 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10543 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10545 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10546 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10547 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10548 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10549 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10550 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10551 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10552 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10553 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10554 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10555 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10556 ; GFX940-TGSPLIT-NEXT: s_endpgm
10558 ; GFX11-WGP-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10559 ; GFX11-WGP: ; %bb.0: ; %entry
10560 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10561 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10562 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10563 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10564 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10565 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10566 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10567 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10568 ; GFX11-WGP-NEXT: buffer_gl0_inv
10569 ; GFX11-WGP-NEXT: buffer_gl1_inv
10570 ; GFX11-WGP-NEXT: s_endpgm
10572 ; GFX11-CU-LABEL: flat_system_one_as_release_acquire_cmpxchg:
10573 ; GFX11-CU: ; %bb.0: ; %entry
10574 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10575 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10576 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10577 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10578 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10579 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10580 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10581 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10582 ; GFX11-CU-NEXT: buffer_gl0_inv
10583 ; GFX11-CU-NEXT: buffer_gl1_inv
10584 ; GFX11-CU-NEXT: s_endpgm
10585 i32* %out, i32 %in, i32 %old) {
10587 %gep = getelementptr i32, i32* %out, i32 4
10588 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") release acquire
10592 define amdgpu_kernel void @flat_system_one_as_acq_rel_acquire_cmpxchg(
10593 ; GFX7-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10594 ; GFX7: ; %bb.0: ; %entry
10595 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10596 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10597 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10598 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10599 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10600 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10601 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10602 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10603 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10604 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10605 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10606 ; GFX7-NEXT: buffer_wbinvl1_vol
10607 ; GFX7-NEXT: s_endpgm
10609 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10610 ; GFX10-WGP: ; %bb.0: ; %entry
10611 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10612 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10613 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10614 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10615 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10616 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10617 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10618 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10619 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10620 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10621 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10622 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10623 ; GFX10-WGP-NEXT: buffer_gl0_inv
10624 ; GFX10-WGP-NEXT: buffer_gl1_inv
10625 ; GFX10-WGP-NEXT: s_endpgm
10627 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10628 ; GFX10-CU: ; %bb.0: ; %entry
10629 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10630 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10631 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10632 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10633 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10634 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10635 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10636 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10637 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10638 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10639 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10640 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10641 ; GFX10-CU-NEXT: buffer_gl0_inv
10642 ; GFX10-CU-NEXT: buffer_gl1_inv
10643 ; GFX10-CU-NEXT: s_endpgm
10645 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10646 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10647 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10648 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10649 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10650 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10651 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10652 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10653 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10654 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10655 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10656 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10657 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10658 ; SKIP-CACHE-INV-NEXT: s_endpgm
10660 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10661 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10662 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10663 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10664 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10665 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10666 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10667 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10668 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10669 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10670 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10671 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10672 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10674 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10675 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10676 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10677 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10678 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10679 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10680 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10681 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10682 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10683 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10684 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10685 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10686 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10688 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10689 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10690 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10691 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10692 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10693 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10694 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10695 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10696 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10697 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10698 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10699 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10701 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10702 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10703 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10704 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10705 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10706 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10707 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10708 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10709 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10710 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10711 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10712 ; GFX940-TGSPLIT-NEXT: s_endpgm
10714 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10715 ; GFX11-WGP: ; %bb.0: ; %entry
10716 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10717 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10718 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10719 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10720 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10721 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10722 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10723 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10724 ; GFX11-WGP-NEXT: buffer_gl0_inv
10725 ; GFX11-WGP-NEXT: buffer_gl1_inv
10726 ; GFX11-WGP-NEXT: s_endpgm
10728 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_acquire_cmpxchg:
10729 ; GFX11-CU: ; %bb.0: ; %entry
10730 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10731 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10732 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10733 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10734 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10735 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10736 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10737 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10738 ; GFX11-CU-NEXT: buffer_gl0_inv
10739 ; GFX11-CU-NEXT: buffer_gl1_inv
10740 ; GFX11-CU-NEXT: s_endpgm
10741 i32* %out, i32 %in, i32 %old) {
10743 %gep = getelementptr i32, i32* %out, i32 4
10744 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel acquire
10748 define amdgpu_kernel void @flat_system_one_as_seq_cst_acquire_cmpxchg(
10749 ; GFX7-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10750 ; GFX7: ; %bb.0: ; %entry
10751 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10752 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10753 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10754 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10755 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10756 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10757 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10758 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10759 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10760 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10761 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10762 ; GFX7-NEXT: buffer_wbinvl1_vol
10763 ; GFX7-NEXT: s_endpgm
10765 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10766 ; GFX10-WGP: ; %bb.0: ; %entry
10767 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10768 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10769 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10770 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10771 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10772 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10773 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10774 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10775 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10776 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10777 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10778 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10779 ; GFX10-WGP-NEXT: buffer_gl0_inv
10780 ; GFX10-WGP-NEXT: buffer_gl1_inv
10781 ; GFX10-WGP-NEXT: s_endpgm
10783 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10784 ; GFX10-CU: ; %bb.0: ; %entry
10785 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10786 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10787 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10788 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10789 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10790 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10791 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10792 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10793 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10794 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10795 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10796 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10797 ; GFX10-CU-NEXT: buffer_gl0_inv
10798 ; GFX10-CU-NEXT: buffer_gl1_inv
10799 ; GFX10-CU-NEXT: s_endpgm
10801 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10802 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10803 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10804 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10805 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10806 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10807 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10808 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10809 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10810 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10811 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10812 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10813 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10814 ; SKIP-CACHE-INV-NEXT: s_endpgm
10816 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10817 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10818 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10819 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10820 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10821 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10822 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10823 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10824 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10825 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10826 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10827 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10828 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10830 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10831 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10832 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10833 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10834 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10835 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10836 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10837 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10838 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10839 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10840 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10841 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10842 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10844 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10845 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10846 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10847 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10848 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10849 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10850 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10851 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10852 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10853 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10854 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
10855 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10857 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10858 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10859 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10860 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10861 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
10862 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
10863 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
10864 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10865 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
10866 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10867 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
10868 ; GFX940-TGSPLIT-NEXT: s_endpgm
10870 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10871 ; GFX11-WGP: ; %bb.0: ; %entry
10872 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10873 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10874 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10875 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10876 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
10877 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10878 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10879 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10880 ; GFX11-WGP-NEXT: buffer_gl0_inv
10881 ; GFX11-WGP-NEXT: buffer_gl1_inv
10882 ; GFX11-WGP-NEXT: s_endpgm
10884 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_acquire_cmpxchg:
10885 ; GFX11-CU: ; %bb.0: ; %entry
10886 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
10887 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10888 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
10889 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
10890 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
10891 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10892 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
10893 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
10894 ; GFX11-CU-NEXT: buffer_gl0_inv
10895 ; GFX11-CU-NEXT: buffer_gl1_inv
10896 ; GFX11-CU-NEXT: s_endpgm
10897 i32* %out, i32 %in, i32 %old) {
10899 %gep = getelementptr i32, i32* %out, i32 4
10900 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst acquire
10904 define amdgpu_kernel void @flat_system_one_as_monotonic_seq_cst_cmpxchg(
10905 ; GFX7-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10906 ; GFX7: ; %bb.0: ; %entry
10907 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10908 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10909 ; GFX7-NEXT: s_add_u32 s0, s0, 16
10910 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
10911 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
10912 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
10913 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
10914 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
10915 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10916 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10917 ; GFX7-NEXT: s_waitcnt vmcnt(0)
10918 ; GFX7-NEXT: buffer_wbinvl1_vol
10919 ; GFX7-NEXT: s_endpgm
10921 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10922 ; GFX10-WGP: ; %bb.0: ; %entry
10923 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10924 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10925 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
10926 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
10927 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
10928 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
10929 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
10930 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
10931 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
10932 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10933 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10934 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
10935 ; GFX10-WGP-NEXT: buffer_gl0_inv
10936 ; GFX10-WGP-NEXT: buffer_gl1_inv
10937 ; GFX10-WGP-NEXT: s_endpgm
10939 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10940 ; GFX10-CU: ; %bb.0: ; %entry
10941 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10942 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10943 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
10944 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
10945 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
10946 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
10947 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
10948 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
10949 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
10950 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10951 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10952 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
10953 ; GFX10-CU-NEXT: buffer_gl0_inv
10954 ; GFX10-CU-NEXT: buffer_gl1_inv
10955 ; GFX10-CU-NEXT: s_endpgm
10957 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10958 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10959 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
10960 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10961 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
10962 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
10963 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10964 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
10965 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10966 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
10967 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10968 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
10969 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
10970 ; SKIP-CACHE-INV-NEXT: s_endpgm
10972 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10973 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10974 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10975 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10976 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10977 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10978 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
10979 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10980 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10981 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
10982 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
10983 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
10984 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10986 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
10987 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10988 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
10989 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10990 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
10991 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
10992 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
10993 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10994 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
10995 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
10996 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
10997 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
10998 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11000 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
11001 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11002 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11003 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11004 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11005 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11006 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11007 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11008 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11009 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11010 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11011 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11013 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
11014 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11015 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11016 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11017 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11018 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11019 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11020 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11021 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11022 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11023 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11024 ; GFX940-TGSPLIT-NEXT: s_endpgm
11026 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
11027 ; GFX11-WGP: ; %bb.0: ; %entry
11028 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11029 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11030 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11031 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11032 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11033 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11034 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11035 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11036 ; GFX11-WGP-NEXT: buffer_gl0_inv
11037 ; GFX11-WGP-NEXT: buffer_gl1_inv
11038 ; GFX11-WGP-NEXT: s_endpgm
11040 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_seq_cst_cmpxchg:
11041 ; GFX11-CU: ; %bb.0: ; %entry
11042 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11043 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11044 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11045 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11046 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11047 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11048 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11049 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11050 ; GFX11-CU-NEXT: buffer_gl0_inv
11051 ; GFX11-CU-NEXT: buffer_gl1_inv
11052 ; GFX11-CU-NEXT: s_endpgm
11053 i32* %out, i32 %in, i32 %old) {
11055 %gep = getelementptr i32, i32* %out, i32 4
11056 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") monotonic seq_cst
11060 define amdgpu_kernel void @flat_system_one_as_acquire_seq_cst_cmpxchg(
11061 ; GFX7-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11062 ; GFX7: ; %bb.0: ; %entry
11063 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11064 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11065 ; GFX7-NEXT: s_add_u32 s0, s0, 16
11066 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
11067 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11068 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11069 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11070 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11071 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11072 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11073 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11074 ; GFX7-NEXT: buffer_wbinvl1_vol
11075 ; GFX7-NEXT: s_endpgm
11077 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11078 ; GFX10-WGP: ; %bb.0: ; %entry
11079 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11080 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11081 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
11082 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
11083 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11084 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11085 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11086 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11087 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11088 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11089 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11090 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11091 ; GFX10-WGP-NEXT: buffer_gl0_inv
11092 ; GFX10-WGP-NEXT: buffer_gl1_inv
11093 ; GFX10-WGP-NEXT: s_endpgm
11095 ; GFX10-CU-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11096 ; GFX10-CU: ; %bb.0: ; %entry
11097 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11098 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11099 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
11100 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
11101 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11102 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11103 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11104 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11105 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11106 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11107 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11108 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11109 ; GFX10-CU-NEXT: buffer_gl0_inv
11110 ; GFX10-CU-NEXT: buffer_gl1_inv
11111 ; GFX10-CU-NEXT: s_endpgm
11113 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11114 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11115 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11116 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11117 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
11118 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
11119 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11120 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11121 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11122 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11123 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11124 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11125 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11126 ; SKIP-CACHE-INV-NEXT: s_endpgm
11128 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11129 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11130 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11131 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11132 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11133 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11134 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11135 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11136 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11137 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11138 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11139 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11140 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11142 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11143 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11144 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11145 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11146 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11147 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11148 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11149 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11150 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11151 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11152 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11153 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11154 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11156 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11157 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11158 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11159 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11160 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11161 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11162 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11163 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11164 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11165 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11166 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11167 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11169 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11170 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11171 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11172 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11173 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11174 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11175 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11176 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11177 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11178 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11179 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11180 ; GFX940-TGSPLIT-NEXT: s_endpgm
11182 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11183 ; GFX11-WGP: ; %bb.0: ; %entry
11184 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11185 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11186 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11187 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11188 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11189 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11190 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11191 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11192 ; GFX11-WGP-NEXT: buffer_gl0_inv
11193 ; GFX11-WGP-NEXT: buffer_gl1_inv
11194 ; GFX11-WGP-NEXT: s_endpgm
11196 ; GFX11-CU-LABEL: flat_system_one_as_acquire_seq_cst_cmpxchg:
11197 ; GFX11-CU: ; %bb.0: ; %entry
11198 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11199 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11200 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11201 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11202 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11203 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11204 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11205 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11206 ; GFX11-CU-NEXT: buffer_gl0_inv
11207 ; GFX11-CU-NEXT: buffer_gl1_inv
11208 ; GFX11-CU-NEXT: s_endpgm
11209 i32* %out, i32 %in, i32 %old) {
11211 %gep = getelementptr i32, i32* %out, i32 4
11212 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acquire seq_cst
11216 define amdgpu_kernel void @flat_system_one_as_release_seq_cst_cmpxchg(
11217 ; GFX7-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11218 ; GFX7: ; %bb.0: ; %entry
11219 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11220 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11221 ; GFX7-NEXT: s_add_u32 s0, s0, 16
11222 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
11223 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11224 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11225 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11226 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11227 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11228 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11229 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11230 ; GFX7-NEXT: buffer_wbinvl1_vol
11231 ; GFX7-NEXT: s_endpgm
11233 ; GFX10-WGP-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11234 ; GFX10-WGP: ; %bb.0: ; %entry
11235 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11236 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11237 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
11238 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
11239 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11240 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11241 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11242 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11243 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11244 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11245 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11246 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11247 ; GFX10-WGP-NEXT: buffer_gl0_inv
11248 ; GFX10-WGP-NEXT: buffer_gl1_inv
11249 ; GFX10-WGP-NEXT: s_endpgm
11251 ; GFX10-CU-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11252 ; GFX10-CU: ; %bb.0: ; %entry
11253 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11254 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11255 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
11256 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
11257 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11258 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11259 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11260 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11261 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11262 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11263 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11264 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11265 ; GFX10-CU-NEXT: buffer_gl0_inv
11266 ; GFX10-CU-NEXT: buffer_gl1_inv
11267 ; GFX10-CU-NEXT: s_endpgm
11269 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11270 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11271 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11272 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11273 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
11274 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
11275 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11276 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11277 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11278 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11279 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11280 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11281 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11282 ; SKIP-CACHE-INV-NEXT: s_endpgm
11284 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11285 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11286 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11287 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11288 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11289 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11290 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11291 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11292 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11293 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11294 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11295 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11296 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11298 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11299 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11300 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11301 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11302 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11303 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11304 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11305 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11306 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11307 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11308 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11309 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11310 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11312 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11313 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11314 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11315 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11316 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11317 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11318 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11319 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11320 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11321 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11322 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11323 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11325 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11326 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11327 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11328 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11329 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11330 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11331 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11332 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11333 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11334 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11335 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11336 ; GFX940-TGSPLIT-NEXT: s_endpgm
11338 ; GFX11-WGP-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11339 ; GFX11-WGP: ; %bb.0: ; %entry
11340 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11341 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11342 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11343 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11344 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11345 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11346 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11347 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11348 ; GFX11-WGP-NEXT: buffer_gl0_inv
11349 ; GFX11-WGP-NEXT: buffer_gl1_inv
11350 ; GFX11-WGP-NEXT: s_endpgm
11352 ; GFX11-CU-LABEL: flat_system_one_as_release_seq_cst_cmpxchg:
11353 ; GFX11-CU: ; %bb.0: ; %entry
11354 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11355 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11356 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11357 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11358 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11359 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11360 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11361 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11362 ; GFX11-CU-NEXT: buffer_gl0_inv
11363 ; GFX11-CU-NEXT: buffer_gl1_inv
11364 ; GFX11-CU-NEXT: s_endpgm
11365 i32* %out, i32 %in, i32 %old) {
11367 %gep = getelementptr i32, i32* %out, i32 4
11368 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") release seq_cst
11372 define amdgpu_kernel void @flat_system_one_as_acq_rel_seq_cst_cmpxchg(
11373 ; GFX7-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11374 ; GFX7: ; %bb.0: ; %entry
11375 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11376 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11377 ; GFX7-NEXT: s_add_u32 s0, s0, 16
11378 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
11379 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11380 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11381 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11382 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11383 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11384 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11385 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11386 ; GFX7-NEXT: buffer_wbinvl1_vol
11387 ; GFX7-NEXT: s_endpgm
11389 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11390 ; GFX10-WGP: ; %bb.0: ; %entry
11391 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11392 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11393 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
11394 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
11395 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11396 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11397 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11398 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11399 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11400 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11401 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11402 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11403 ; GFX10-WGP-NEXT: buffer_gl0_inv
11404 ; GFX10-WGP-NEXT: buffer_gl1_inv
11405 ; GFX10-WGP-NEXT: s_endpgm
11407 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11408 ; GFX10-CU: ; %bb.0: ; %entry
11409 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11410 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11411 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
11412 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
11413 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11414 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11415 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11416 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11417 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11418 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11419 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11420 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11421 ; GFX10-CU-NEXT: buffer_gl0_inv
11422 ; GFX10-CU-NEXT: buffer_gl1_inv
11423 ; GFX10-CU-NEXT: s_endpgm
11425 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11426 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11427 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11428 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11429 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
11430 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
11431 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11432 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11433 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11434 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11435 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11436 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11437 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11438 ; SKIP-CACHE-INV-NEXT: s_endpgm
11440 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11441 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11442 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11443 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11444 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11445 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11446 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11447 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11448 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11449 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11450 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11451 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11452 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11454 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11455 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11456 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11457 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11458 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11459 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11460 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11461 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11462 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11463 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11464 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11465 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11466 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11468 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11469 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11470 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11471 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11472 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11473 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11474 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11475 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11476 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11477 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11478 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11479 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11481 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11482 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11483 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11484 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11485 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11486 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11487 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11488 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11489 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11490 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11491 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11492 ; GFX940-TGSPLIT-NEXT: s_endpgm
11494 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11495 ; GFX11-WGP: ; %bb.0: ; %entry
11496 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11497 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11498 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11499 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11500 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11501 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11502 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11503 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11504 ; GFX11-WGP-NEXT: buffer_gl0_inv
11505 ; GFX11-WGP-NEXT: buffer_gl1_inv
11506 ; GFX11-WGP-NEXT: s_endpgm
11508 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_seq_cst_cmpxchg:
11509 ; GFX11-CU: ; %bb.0: ; %entry
11510 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11511 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11512 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11513 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11514 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11515 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11516 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11517 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11518 ; GFX11-CU-NEXT: buffer_gl0_inv
11519 ; GFX11-CU-NEXT: buffer_gl1_inv
11520 ; GFX11-CU-NEXT: s_endpgm
11521 i32* %out, i32 %in, i32 %old) {
11523 %gep = getelementptr i32, i32* %out, i32 4
11524 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel seq_cst
11528 define amdgpu_kernel void @flat_system_one_as_seq_cst_seq_cst_cmpxchg(
11529 ; GFX7-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11530 ; GFX7: ; %bb.0: ; %entry
11531 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11532 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11533 ; GFX7-NEXT: s_add_u32 s0, s0, 16
11534 ; GFX7-NEXT: s_addc_u32 s1, s1, 0
11535 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11536 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11537 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11538 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11539 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11540 ; GFX7-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11541 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11542 ; GFX7-NEXT: buffer_wbinvl1_vol
11543 ; GFX7-NEXT: s_endpgm
11545 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11546 ; GFX10-WGP: ; %bb.0: ; %entry
11547 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11548 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11549 ; GFX10-WGP-NEXT: s_add_u32 s0, s0, 16
11550 ; GFX10-WGP-NEXT: s_addc_u32 s1, s1, 0
11551 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11552 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11553 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11554 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11555 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11556 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11557 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11558 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11559 ; GFX10-WGP-NEXT: buffer_gl0_inv
11560 ; GFX10-WGP-NEXT: buffer_gl1_inv
11561 ; GFX10-WGP-NEXT: s_endpgm
11563 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11564 ; GFX10-CU: ; %bb.0: ; %entry
11565 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11566 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11567 ; GFX10-CU-NEXT: s_add_u32 s0, s0, 16
11568 ; GFX10-CU-NEXT: s_addc_u32 s1, s1, 0
11569 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11570 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11571 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11572 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11573 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11574 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11575 ; GFX10-CU-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11576 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
11577 ; GFX10-CU-NEXT: buffer_gl0_inv
11578 ; GFX10-CU-NEXT: buffer_gl1_inv
11579 ; GFX10-CU-NEXT: s_endpgm
11581 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11582 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11583 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11584 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11585 ; SKIP-CACHE-INV-NEXT: s_add_u32 s0, s0, 16
11586 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s1, s1, 0
11587 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11588 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11589 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11590 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11591 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11592 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v[0:1], v[2:3]
11593 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11594 ; SKIP-CACHE-INV-NEXT: s_endpgm
11596 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11597 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11598 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11599 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11600 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11601 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11602 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
11603 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11604 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11605 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11606 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11607 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11608 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11610 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11611 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11612 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11613 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11614 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11615 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11616 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
11617 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11618 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16
11619 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11620 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11621 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11622 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11624 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11625 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11626 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11627 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11628 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11629 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11630 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11631 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11632 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11633 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11634 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11635 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11637 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11638 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11639 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11640 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11641 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11642 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11643 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
11644 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11645 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v[0:1], v[2:3] offset:16 sc1
11646 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11647 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11648 ; GFX940-TGSPLIT-NEXT: s_endpgm
11650 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11651 ; GFX11-WGP: ; %bb.0: ; %entry
11652 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11653 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11654 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11655 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11656 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11657 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11658 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11659 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
11660 ; GFX11-WGP-NEXT: buffer_gl0_inv
11661 ; GFX11-WGP-NEXT: buffer_gl1_inv
11662 ; GFX11-WGP-NEXT: s_endpgm
11664 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_seq_cst_cmpxchg:
11665 ; GFX11-CU: ; %bb.0: ; %entry
11666 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11667 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11668 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11669 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11670 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11671 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11672 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v[0:1], v[2:3] offset:16
11673 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
11674 ; GFX11-CU-NEXT: buffer_gl0_inv
11675 ; GFX11-CU-NEXT: buffer_gl1_inv
11676 ; GFX11-CU-NEXT: s_endpgm
11677 i32* %out, i32 %in, i32 %old) {
11679 %gep = getelementptr i32, i32* %out, i32 4
11680 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst seq_cst
11684 define amdgpu_kernel void @flat_system_one_as_monotonic_monotonic_ret_cmpxchg(
11685 ; GFX7-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11686 ; GFX7: ; %bb.0: ; %entry
11687 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11688 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11689 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11690 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11691 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11692 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11693 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11694 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11695 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11696 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11697 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11698 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11699 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11700 ; GFX7-NEXT: s_endpgm
11702 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11703 ; GFX10-WGP: ; %bb.0: ; %entry
11704 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11705 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11706 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
11707 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
11708 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
11709 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11710 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11711 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11712 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11713 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11714 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11715 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11716 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
11717 ; GFX10-WGP-NEXT: s_endpgm
11719 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11720 ; GFX10-CU: ; %bb.0: ; %entry
11721 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11722 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11723 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
11724 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
11725 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
11726 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11727 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11728 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11729 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11730 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11731 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11732 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11733 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
11734 ; GFX10-CU-NEXT: s_endpgm
11736 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11737 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11738 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11739 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11740 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
11741 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
11742 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11743 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11744 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
11745 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11746 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11747 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11748 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11749 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11750 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
11751 ; SKIP-CACHE-INV-NEXT: s_endpgm
11753 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11754 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11755 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11756 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11757 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11758 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11759 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
11760 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11761 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
11762 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11764 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11765 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11766 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11767 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11768 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11769 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11770 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
11771 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11772 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
11773 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11775 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11776 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11777 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11778 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11779 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11780 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11781 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
11782 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11783 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
11784 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11786 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11787 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11788 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11789 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11790 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11791 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11792 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
11793 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11794 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
11795 ; GFX940-TGSPLIT-NEXT: s_endpgm
11797 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11798 ; GFX11-WGP: ; %bb.0: ; %entry
11799 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11800 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11801 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11802 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11803 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
11804 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11805 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
11806 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11807 ; GFX11-WGP-NEXT: s_endpgm
11809 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_monotonic_ret_cmpxchg:
11810 ; GFX11-CU: ; %bb.0: ; %entry
11811 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11812 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11813 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11814 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11815 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
11816 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
11817 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
11818 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11819 ; GFX11-CU-NEXT: s_endpgm
11820 i32* %out, i32 %in, i32 %old) {
11822 %gep = getelementptr i32, i32* %out, i32 4
11823 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") monotonic monotonic
11824 %val0 = extractvalue { i32, i1 } %val, 0
11825 store i32 %val0, i32* %out, align 4
11829 define amdgpu_kernel void @flat_system_one_as_acquire_monotonic_ret_cmpxchg(
11830 ; GFX7-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11831 ; GFX7: ; %bb.0: ; %entry
11832 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11833 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11834 ; GFX7-NEXT: s_add_u32 s4, s0, 16
11835 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
11836 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
11837 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
11838 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11839 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
11840 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11841 ; GFX7-NEXT: s_waitcnt vmcnt(0)
11842 ; GFX7-NEXT: buffer_wbinvl1_vol
11843 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
11844 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
11845 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11846 ; GFX7-NEXT: flat_store_dword v[0:1], v2
11847 ; GFX7-NEXT: s_endpgm
11849 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11850 ; GFX10-WGP: ; %bb.0: ; %entry
11851 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11852 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11853 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
11854 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
11855 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
11856 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
11857 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11858 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
11859 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11860 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
11861 ; GFX10-WGP-NEXT: buffer_gl0_inv
11862 ; GFX10-WGP-NEXT: buffer_gl1_inv
11863 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
11864 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
11865 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11866 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
11867 ; GFX10-WGP-NEXT: s_endpgm
11869 ; GFX10-CU-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11870 ; GFX10-CU: ; %bb.0: ; %entry
11871 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11872 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11873 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
11874 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
11875 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
11876 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
11877 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11878 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
11879 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11880 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
11881 ; GFX10-CU-NEXT: buffer_gl0_inv
11882 ; GFX10-CU-NEXT: buffer_gl1_inv
11883 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
11884 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
11885 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11886 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
11887 ; GFX10-CU-NEXT: s_endpgm
11889 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11890 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11891 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11892 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11893 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
11894 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
11895 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
11896 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
11897 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
11898 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
11899 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
11900 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
11901 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
11902 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11903 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11904 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
11905 ; SKIP-CACHE-INV-NEXT: s_endpgm
11907 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11908 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11909 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11910 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11911 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11912 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11913 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
11914 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11915 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
11916 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
11917 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11918 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
11919 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11921 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11922 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11923 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
11924 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11925 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
11926 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
11927 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
11928 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11929 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
11930 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
11931 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
11932 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11934 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11935 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11936 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11937 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11938 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11939 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11940 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
11941 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
11942 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
11943 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11944 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
11945 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11947 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11948 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11949 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
11950 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11951 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
11952 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
11953 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
11954 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
11955 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
11956 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
11957 ; GFX940-TGSPLIT-NEXT: s_endpgm
11959 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11960 ; GFX11-WGP: ; %bb.0: ; %entry
11961 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11962 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11963 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11964 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11965 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
11966 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
11967 ; GFX11-WGP-NEXT: buffer_gl0_inv
11968 ; GFX11-WGP-NEXT: buffer_gl1_inv
11969 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11970 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
11971 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11972 ; GFX11-WGP-NEXT: s_endpgm
11974 ; GFX11-CU-LABEL: flat_system_one_as_acquire_monotonic_ret_cmpxchg:
11975 ; GFX11-CU: ; %bb.0: ; %entry
11976 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
11977 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11978 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
11979 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
11980 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
11981 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
11982 ; GFX11-CU-NEXT: buffer_gl0_inv
11983 ; GFX11-CU-NEXT: buffer_gl1_inv
11984 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11985 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
11986 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
11987 ; GFX11-CU-NEXT: s_endpgm
11988 i32* %out, i32 %in, i32 %old) {
11990 %gep = getelementptr i32, i32* %out, i32 4
11991 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acquire monotonic
11992 %val0 = extractvalue { i32, i1 } %val, 0
11993 store i32 %val0, i32* %out, align 4
11997 define amdgpu_kernel void @flat_system_one_as_release_monotonic_ret_cmpxchg(
11998 ; GFX7-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
11999 ; GFX7: ; %bb.0: ; %entry
12000 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12001 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12002 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12003 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12004 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12005 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12006 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12007 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12008 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12009 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12010 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12011 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12012 ; GFX7-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12013 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12014 ; GFX7-NEXT: s_endpgm
12016 ; GFX10-WGP-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12017 ; GFX10-WGP: ; %bb.0: ; %entry
12018 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12019 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12020 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12021 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12022 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12023 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12024 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12025 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12026 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12027 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12028 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12029 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12030 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12031 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12032 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12033 ; GFX10-WGP-NEXT: s_endpgm
12035 ; GFX10-CU-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12036 ; GFX10-CU: ; %bb.0: ; %entry
12037 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12038 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12039 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12040 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12041 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12042 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12043 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12044 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12045 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12046 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12047 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12048 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12049 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12050 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12051 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12052 ; GFX10-CU-NEXT: s_endpgm
12054 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12055 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12056 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12057 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12058 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12059 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12060 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12061 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12062 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12063 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12064 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12065 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12066 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12067 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12068 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12069 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12070 ; SKIP-CACHE-INV-NEXT: s_endpgm
12072 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12073 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12074 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12075 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12076 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12077 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12078 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12079 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12080 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12081 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12082 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12083 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12085 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12086 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12087 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12088 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12089 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12090 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12091 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12092 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12093 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12094 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12095 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12096 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12098 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12099 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12100 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12101 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12102 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12103 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12104 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12105 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12106 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12107 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12108 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12109 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12111 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12112 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12113 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12114 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12115 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12116 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12117 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12118 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12119 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12120 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12121 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12122 ; GFX940-TGSPLIT-NEXT: s_endpgm
12124 ; GFX11-WGP-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12125 ; GFX11-WGP: ; %bb.0: ; %entry
12126 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12127 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12128 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12129 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12130 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12131 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12132 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12133 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12134 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12135 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12136 ; GFX11-WGP-NEXT: s_endpgm
12138 ; GFX11-CU-LABEL: flat_system_one_as_release_monotonic_ret_cmpxchg:
12139 ; GFX11-CU: ; %bb.0: ; %entry
12140 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12141 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12142 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12143 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12144 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12145 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12146 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12147 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
12148 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12149 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12150 ; GFX11-CU-NEXT: s_endpgm
12151 i32* %out, i32 %in, i32 %old) {
12153 %gep = getelementptr i32, i32* %out, i32 4
12154 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") release monotonic
12155 %val0 = extractvalue { i32, i1 } %val, 0
12156 store i32 %val0, i32* %out, align 4
12160 define amdgpu_kernel void @flat_system_one_as_acq_rel_monotonic_ret_cmpxchg(
12161 ; GFX7-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12162 ; GFX7: ; %bb.0: ; %entry
12163 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12164 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12165 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12166 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12167 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12168 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12169 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12170 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12171 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12172 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12173 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12174 ; GFX7-NEXT: buffer_wbinvl1_vol
12175 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12176 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12177 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12178 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12179 ; GFX7-NEXT: s_endpgm
12181 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12182 ; GFX10-WGP: ; %bb.0: ; %entry
12183 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12184 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12185 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12186 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12187 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12188 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12189 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12190 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12191 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12192 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12193 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12194 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12195 ; GFX10-WGP-NEXT: buffer_gl0_inv
12196 ; GFX10-WGP-NEXT: buffer_gl1_inv
12197 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12198 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12199 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12200 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12201 ; GFX10-WGP-NEXT: s_endpgm
12203 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12204 ; GFX10-CU: ; %bb.0: ; %entry
12205 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12206 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12207 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12208 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12209 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12210 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12211 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12212 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12213 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12214 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12215 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12216 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12217 ; GFX10-CU-NEXT: buffer_gl0_inv
12218 ; GFX10-CU-NEXT: buffer_gl1_inv
12219 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12220 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12221 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12222 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12223 ; GFX10-CU-NEXT: s_endpgm
12225 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12226 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12227 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12228 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12229 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12230 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12231 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12232 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12233 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12234 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12235 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12236 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12237 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12238 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12239 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12240 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12241 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12242 ; SKIP-CACHE-INV-NEXT: s_endpgm
12244 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12245 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12246 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12247 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12248 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12249 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12250 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12251 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12252 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12253 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12254 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12255 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12256 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12257 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12258 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12260 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12261 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12262 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12263 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12264 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12265 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12266 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12267 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12268 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12269 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12270 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12271 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12272 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12273 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12275 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12276 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12277 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12278 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12279 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12280 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12281 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12282 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12283 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12284 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12285 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12286 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12287 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12288 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12290 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12291 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12292 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12293 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12294 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12295 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12296 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12297 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12298 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12299 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12300 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12301 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12302 ; GFX940-TGSPLIT-NEXT: s_endpgm
12304 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12305 ; GFX11-WGP: ; %bb.0: ; %entry
12306 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12307 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12308 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12309 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12310 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12311 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12312 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12313 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12314 ; GFX11-WGP-NEXT: buffer_gl0_inv
12315 ; GFX11-WGP-NEXT: buffer_gl1_inv
12316 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12317 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12318 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12319 ; GFX11-WGP-NEXT: s_endpgm
12321 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_monotonic_ret_cmpxchg:
12322 ; GFX11-CU: ; %bb.0: ; %entry
12323 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12324 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12325 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12326 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12327 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12328 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12329 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12330 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12331 ; GFX11-CU-NEXT: buffer_gl0_inv
12332 ; GFX11-CU-NEXT: buffer_gl1_inv
12333 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12334 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12335 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12336 ; GFX11-CU-NEXT: s_endpgm
12337 i32* %out, i32 %in, i32 %old) {
12339 %gep = getelementptr i32, i32* %out, i32 4
12340 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel monotonic
12341 %val0 = extractvalue { i32, i1 } %val, 0
12342 store i32 %val0, i32* %out, align 4
12346 define amdgpu_kernel void @flat_system_one_as_seq_cst_monotonic_ret_cmpxchg(
12347 ; GFX7-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12348 ; GFX7: ; %bb.0: ; %entry
12349 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12350 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12351 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12352 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12353 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12354 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12355 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12356 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12357 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12358 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12359 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12360 ; GFX7-NEXT: buffer_wbinvl1_vol
12361 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12362 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12363 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12364 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12365 ; GFX7-NEXT: s_endpgm
12367 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12368 ; GFX10-WGP: ; %bb.0: ; %entry
12369 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12370 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12371 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12372 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12373 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12374 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12375 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12376 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12377 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12378 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12379 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12380 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12381 ; GFX10-WGP-NEXT: buffer_gl0_inv
12382 ; GFX10-WGP-NEXT: buffer_gl1_inv
12383 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12384 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12385 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12386 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12387 ; GFX10-WGP-NEXT: s_endpgm
12389 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12390 ; GFX10-CU: ; %bb.0: ; %entry
12391 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12392 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12393 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12394 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12395 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12396 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12397 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12398 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12399 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12400 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12401 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12402 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12403 ; GFX10-CU-NEXT: buffer_gl0_inv
12404 ; GFX10-CU-NEXT: buffer_gl1_inv
12405 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12406 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12407 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12408 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12409 ; GFX10-CU-NEXT: s_endpgm
12411 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12412 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12413 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12414 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12415 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12416 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12417 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12418 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12419 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12420 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12421 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12422 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12423 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12424 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12425 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12426 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12427 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12428 ; SKIP-CACHE-INV-NEXT: s_endpgm
12430 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12431 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12432 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12433 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12434 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12435 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12436 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12437 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12438 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12439 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12440 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12441 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12442 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12443 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12444 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12446 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12447 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12448 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12449 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12450 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12451 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12452 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12453 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12454 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12455 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12456 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12457 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12458 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12459 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12461 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12462 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12463 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12464 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12465 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12466 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12467 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12468 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12469 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12470 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12471 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12472 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12473 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12474 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12476 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12477 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12478 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12479 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12480 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12481 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12482 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12483 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12484 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12485 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12486 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12487 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12488 ; GFX940-TGSPLIT-NEXT: s_endpgm
12490 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12491 ; GFX11-WGP: ; %bb.0: ; %entry
12492 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12493 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12494 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12495 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12496 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12497 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12498 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12499 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12500 ; GFX11-WGP-NEXT: buffer_gl0_inv
12501 ; GFX11-WGP-NEXT: buffer_gl1_inv
12502 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12503 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12504 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12505 ; GFX11-WGP-NEXT: s_endpgm
12507 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_monotonic_ret_cmpxchg:
12508 ; GFX11-CU: ; %bb.0: ; %entry
12509 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12510 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12511 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12512 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12513 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12514 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
12515 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12516 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12517 ; GFX11-CU-NEXT: buffer_gl0_inv
12518 ; GFX11-CU-NEXT: buffer_gl1_inv
12519 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12520 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12521 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12522 ; GFX11-CU-NEXT: s_endpgm
12523 i32* %out, i32 %in, i32 %old) {
12525 %gep = getelementptr i32, i32* %out, i32 4
12526 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst monotonic
12527 %val0 = extractvalue { i32, i1 } %val, 0
12528 store i32 %val0, i32* %out, align 4
12532 define amdgpu_kernel void @flat_system_one_as_monotonic_acquire_ret_cmpxchg(
12533 ; GFX7-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12534 ; GFX7: ; %bb.0: ; %entry
12535 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12536 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12537 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12538 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12539 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12540 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12541 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12542 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12543 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12544 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12545 ; GFX7-NEXT: buffer_wbinvl1_vol
12546 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12547 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12548 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12549 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12550 ; GFX7-NEXT: s_endpgm
12552 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12553 ; GFX10-WGP: ; %bb.0: ; %entry
12554 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12555 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12556 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12557 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12558 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12559 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12560 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12561 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12562 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12563 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12564 ; GFX10-WGP-NEXT: buffer_gl0_inv
12565 ; GFX10-WGP-NEXT: buffer_gl1_inv
12566 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12567 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12568 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12569 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12570 ; GFX10-WGP-NEXT: s_endpgm
12572 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12573 ; GFX10-CU: ; %bb.0: ; %entry
12574 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12575 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12576 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12577 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12578 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12579 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12580 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12581 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12582 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12583 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12584 ; GFX10-CU-NEXT: buffer_gl0_inv
12585 ; GFX10-CU-NEXT: buffer_gl1_inv
12586 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12587 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12588 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12589 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12590 ; GFX10-CU-NEXT: s_endpgm
12592 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12593 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12594 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12595 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12596 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12597 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12598 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12599 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12600 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12601 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12602 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12603 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12604 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12605 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12606 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12607 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12608 ; SKIP-CACHE-INV-NEXT: s_endpgm
12610 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12611 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12612 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12613 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12614 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12615 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12616 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12617 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12618 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12619 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12620 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12621 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12622 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12624 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12625 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12626 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12627 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12628 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12629 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12630 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12631 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12632 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12633 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12634 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12635 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12637 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12638 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12639 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12640 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12641 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12642 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12643 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12644 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12645 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12646 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12647 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12648 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12650 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12651 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12652 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12653 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12654 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12655 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12656 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12657 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12658 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12659 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12660 ; GFX940-TGSPLIT-NEXT: s_endpgm
12662 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12663 ; GFX11-WGP: ; %bb.0: ; %entry
12664 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12665 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12666 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12667 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12668 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12669 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12670 ; GFX11-WGP-NEXT: buffer_gl0_inv
12671 ; GFX11-WGP-NEXT: buffer_gl1_inv
12672 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12673 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12674 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12675 ; GFX11-WGP-NEXT: s_endpgm
12677 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_acquire_ret_cmpxchg:
12678 ; GFX11-CU: ; %bb.0: ; %entry
12679 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12680 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12681 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12682 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12683 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12684 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12685 ; GFX11-CU-NEXT: buffer_gl0_inv
12686 ; GFX11-CU-NEXT: buffer_gl1_inv
12687 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12688 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12689 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12690 ; GFX11-CU-NEXT: s_endpgm
12691 i32* %out, i32 %in, i32 %old) {
12693 %gep = getelementptr i32, i32* %out, i32 4
12694 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") monotonic acquire
12695 %val0 = extractvalue { i32, i1 } %val, 0
12696 store i32 %val0, i32* %out, align 4
12700 define amdgpu_kernel void @flat_system_one_as_acquire_acquire_ret_cmpxchg(
12701 ; GFX7-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12702 ; GFX7: ; %bb.0: ; %entry
12703 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12704 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12705 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12706 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12707 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12708 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12709 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12710 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12711 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12712 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12713 ; GFX7-NEXT: buffer_wbinvl1_vol
12714 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12715 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12716 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12717 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12718 ; GFX7-NEXT: s_endpgm
12720 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12721 ; GFX10-WGP: ; %bb.0: ; %entry
12722 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12723 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12724 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12725 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12726 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12727 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12728 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12729 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12730 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12731 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12732 ; GFX10-WGP-NEXT: buffer_gl0_inv
12733 ; GFX10-WGP-NEXT: buffer_gl1_inv
12734 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12735 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12736 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12737 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12738 ; GFX10-WGP-NEXT: s_endpgm
12740 ; GFX10-CU-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12741 ; GFX10-CU: ; %bb.0: ; %entry
12742 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12743 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12744 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12745 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12746 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12747 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12748 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12749 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12750 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12751 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12752 ; GFX10-CU-NEXT: buffer_gl0_inv
12753 ; GFX10-CU-NEXT: buffer_gl1_inv
12754 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12755 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12756 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12757 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12758 ; GFX10-CU-NEXT: s_endpgm
12760 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12761 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12762 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12763 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12764 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12765 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12766 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12767 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12768 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12769 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12770 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12771 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12772 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12773 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12774 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12775 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12776 ; SKIP-CACHE-INV-NEXT: s_endpgm
12778 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12779 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12780 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12781 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12782 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12783 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12784 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12785 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12786 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12787 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12788 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12789 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12790 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12792 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12793 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12794 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12795 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12796 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12797 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12798 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12799 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12800 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12801 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12802 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12803 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12805 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12806 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12807 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12808 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12809 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12810 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12811 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12812 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12813 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12814 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12815 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12816 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12818 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12819 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12820 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12821 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12822 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12823 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12824 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12825 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12826 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
12827 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12828 ; GFX940-TGSPLIT-NEXT: s_endpgm
12830 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12831 ; GFX11-WGP: ; %bb.0: ; %entry
12832 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12833 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12834 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12835 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12836 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12837 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
12838 ; GFX11-WGP-NEXT: buffer_gl0_inv
12839 ; GFX11-WGP-NEXT: buffer_gl1_inv
12840 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12841 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
12842 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12843 ; GFX11-WGP-NEXT: s_endpgm
12845 ; GFX11-CU-LABEL: flat_system_one_as_acquire_acquire_ret_cmpxchg:
12846 ; GFX11-CU: ; %bb.0: ; %entry
12847 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
12848 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12849 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
12850 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
12851 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
12852 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
12853 ; GFX11-CU-NEXT: buffer_gl0_inv
12854 ; GFX11-CU-NEXT: buffer_gl1_inv
12855 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12856 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
12857 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
12858 ; GFX11-CU-NEXT: s_endpgm
12859 i32* %out, i32 %in, i32 %old) {
12861 %gep = getelementptr i32, i32* %out, i32 4
12862 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acquire acquire
12863 %val0 = extractvalue { i32, i1 } %val, 0
12864 store i32 %val0, i32* %out, align 4
12868 define amdgpu_kernel void @flat_system_one_as_release_acquire_ret_cmpxchg(
12869 ; GFX7-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12870 ; GFX7: ; %bb.0: ; %entry
12871 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12872 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12873 ; GFX7-NEXT: s_add_u32 s4, s0, 16
12874 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
12875 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
12876 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
12877 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12878 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
12879 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12880 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12881 ; GFX7-NEXT: s_waitcnt vmcnt(0)
12882 ; GFX7-NEXT: buffer_wbinvl1_vol
12883 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
12884 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
12885 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12886 ; GFX7-NEXT: flat_store_dword v[0:1], v2
12887 ; GFX7-NEXT: s_endpgm
12889 ; GFX10-WGP-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12890 ; GFX10-WGP: ; %bb.0: ; %entry
12891 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12892 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12893 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
12894 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
12895 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
12896 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
12897 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12898 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
12899 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12900 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
12901 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12902 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
12903 ; GFX10-WGP-NEXT: buffer_gl0_inv
12904 ; GFX10-WGP-NEXT: buffer_gl1_inv
12905 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
12906 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
12907 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12908 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
12909 ; GFX10-WGP-NEXT: s_endpgm
12911 ; GFX10-CU-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12912 ; GFX10-CU: ; %bb.0: ; %entry
12913 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12914 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12915 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
12916 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
12917 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
12918 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
12919 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12920 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
12921 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12922 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
12923 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12924 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
12925 ; GFX10-CU-NEXT: buffer_gl0_inv
12926 ; GFX10-CU-NEXT: buffer_gl1_inv
12927 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
12928 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
12929 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12930 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
12931 ; GFX10-CU-NEXT: s_endpgm
12933 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12934 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12935 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12936 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12937 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
12938 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
12939 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
12940 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
12941 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
12942 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
12943 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12944 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
12945 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
12946 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
12947 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12948 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12949 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
12950 ; SKIP-CACHE-INV-NEXT: s_endpgm
12952 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12953 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12954 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12955 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12956 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12957 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12958 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
12959 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12960 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12961 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12962 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
12963 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
12964 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12965 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12966 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12968 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12969 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12970 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
12971 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12972 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
12973 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
12974 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
12975 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12976 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
12977 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
12978 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
12979 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
12980 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
12981 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12983 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12984 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12985 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
12986 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12987 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
12988 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
12989 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
12990 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12991 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
12992 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
12993 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
12994 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12995 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
12996 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12998 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
12999 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13000 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13001 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13002 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13003 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13004 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13005 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13006 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13007 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13008 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13009 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13010 ; GFX940-TGSPLIT-NEXT: s_endpgm
13012 ; GFX11-WGP-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
13013 ; GFX11-WGP: ; %bb.0: ; %entry
13014 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13015 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13016 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13017 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13018 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13019 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13020 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13021 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13022 ; GFX11-WGP-NEXT: buffer_gl0_inv
13023 ; GFX11-WGP-NEXT: buffer_gl1_inv
13024 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13025 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13026 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13027 ; GFX11-WGP-NEXT: s_endpgm
13029 ; GFX11-CU-LABEL: flat_system_one_as_release_acquire_ret_cmpxchg:
13030 ; GFX11-CU: ; %bb.0: ; %entry
13031 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13032 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13033 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13034 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13035 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13036 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13037 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13038 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13039 ; GFX11-CU-NEXT: buffer_gl0_inv
13040 ; GFX11-CU-NEXT: buffer_gl1_inv
13041 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13042 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13043 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13044 ; GFX11-CU-NEXT: s_endpgm
13045 i32* %out, i32 %in, i32 %old) {
13047 %gep = getelementptr i32, i32* %out, i32 4
13048 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") release acquire
13049 %val0 = extractvalue { i32, i1 } %val, 0
13050 store i32 %val0, i32* %out, align 4
13054 define amdgpu_kernel void @flat_system_one_as_acq_rel_acquire_ret_cmpxchg(
13055 ; GFX7-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13056 ; GFX7: ; %bb.0: ; %entry
13057 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13058 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13059 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13060 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13061 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13062 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13063 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13064 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13065 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13066 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13067 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13068 ; GFX7-NEXT: buffer_wbinvl1_vol
13069 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13070 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13071 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13072 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13073 ; GFX7-NEXT: s_endpgm
13075 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13076 ; GFX10-WGP: ; %bb.0: ; %entry
13077 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13078 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13079 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13080 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13081 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13082 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13083 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13084 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13085 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13086 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13087 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13088 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13089 ; GFX10-WGP-NEXT: buffer_gl0_inv
13090 ; GFX10-WGP-NEXT: buffer_gl1_inv
13091 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13092 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13093 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13094 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13095 ; GFX10-WGP-NEXT: s_endpgm
13097 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13098 ; GFX10-CU: ; %bb.0: ; %entry
13099 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13100 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13101 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13102 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13103 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13104 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13105 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13106 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13107 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13108 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13109 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13110 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13111 ; GFX10-CU-NEXT: buffer_gl0_inv
13112 ; GFX10-CU-NEXT: buffer_gl1_inv
13113 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13114 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13115 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13116 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13117 ; GFX10-CU-NEXT: s_endpgm
13119 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13120 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13121 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13122 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13123 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13124 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13125 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13126 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13127 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13128 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13129 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13130 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13131 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13132 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13133 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13134 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13135 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13136 ; SKIP-CACHE-INV-NEXT: s_endpgm
13138 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13139 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13140 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13141 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13142 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13143 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13144 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13145 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13146 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13147 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13148 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13149 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13150 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13151 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13152 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13154 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13155 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13156 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13157 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13158 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13159 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13160 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13161 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13162 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13163 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13164 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13165 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13166 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13167 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13169 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13170 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13171 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13172 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13173 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13174 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13175 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13176 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13177 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13178 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13179 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13180 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13181 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13182 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13184 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13185 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13186 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13187 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13188 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13189 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13190 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13191 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13192 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13193 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13194 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13195 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13196 ; GFX940-TGSPLIT-NEXT: s_endpgm
13198 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13199 ; GFX11-WGP: ; %bb.0: ; %entry
13200 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13201 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13202 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13203 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13204 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13205 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13206 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13207 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13208 ; GFX11-WGP-NEXT: buffer_gl0_inv
13209 ; GFX11-WGP-NEXT: buffer_gl1_inv
13210 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13211 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13212 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13213 ; GFX11-WGP-NEXT: s_endpgm
13215 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_acquire_ret_cmpxchg:
13216 ; GFX11-CU: ; %bb.0: ; %entry
13217 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13218 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13219 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13220 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13221 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13222 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13223 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13224 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13225 ; GFX11-CU-NEXT: buffer_gl0_inv
13226 ; GFX11-CU-NEXT: buffer_gl1_inv
13227 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13228 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13229 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13230 ; GFX11-CU-NEXT: s_endpgm
13231 i32* %out, i32 %in, i32 %old) {
13233 %gep = getelementptr i32, i32* %out, i32 4
13234 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel acquire
13235 %val0 = extractvalue { i32, i1 } %val, 0
13236 store i32 %val0, i32* %out, align 4
13240 define amdgpu_kernel void @flat_system_one_as_seq_cst_acquire_ret_cmpxchg(
13241 ; GFX7-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13242 ; GFX7: ; %bb.0: ; %entry
13243 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13244 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13245 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13246 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13247 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13248 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13249 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13250 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13251 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13252 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13253 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13254 ; GFX7-NEXT: buffer_wbinvl1_vol
13255 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13256 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13257 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13258 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13259 ; GFX7-NEXT: s_endpgm
13261 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13262 ; GFX10-WGP: ; %bb.0: ; %entry
13263 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13264 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13265 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13266 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13267 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13268 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13269 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13270 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13271 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13272 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13273 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13274 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13275 ; GFX10-WGP-NEXT: buffer_gl0_inv
13276 ; GFX10-WGP-NEXT: buffer_gl1_inv
13277 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13278 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13279 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13280 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13281 ; GFX10-WGP-NEXT: s_endpgm
13283 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13284 ; GFX10-CU: ; %bb.0: ; %entry
13285 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13286 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13287 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13288 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13289 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13290 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13291 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13292 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13293 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13294 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13295 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13296 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13297 ; GFX10-CU-NEXT: buffer_gl0_inv
13298 ; GFX10-CU-NEXT: buffer_gl1_inv
13299 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13300 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13301 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13302 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13303 ; GFX10-CU-NEXT: s_endpgm
13305 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13306 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13307 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13308 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13309 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13310 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13311 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13312 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13313 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13314 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13315 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13316 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13317 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13318 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13319 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13320 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13321 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13322 ; SKIP-CACHE-INV-NEXT: s_endpgm
13324 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13325 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13326 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13327 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13328 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13329 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13330 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13331 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13332 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13333 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13334 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13335 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13336 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13337 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13338 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13340 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13341 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13342 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13343 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13344 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13345 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13346 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13347 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13348 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13349 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13350 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13351 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13352 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13353 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13355 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13356 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13357 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13358 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13359 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13360 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13361 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13362 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13363 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13364 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13365 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13366 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13367 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13368 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13370 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13371 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13372 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13373 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13374 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13375 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13376 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13377 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13378 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13379 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13380 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13381 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13382 ; GFX940-TGSPLIT-NEXT: s_endpgm
13384 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13385 ; GFX11-WGP: ; %bb.0: ; %entry
13386 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13387 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13388 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13389 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13390 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13391 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13392 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13393 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13394 ; GFX11-WGP-NEXT: buffer_gl0_inv
13395 ; GFX11-WGP-NEXT: buffer_gl1_inv
13396 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13397 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13398 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13399 ; GFX11-WGP-NEXT: s_endpgm
13401 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_acquire_ret_cmpxchg:
13402 ; GFX11-CU: ; %bb.0: ; %entry
13403 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13404 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13405 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13406 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13407 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13408 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13409 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13410 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13411 ; GFX11-CU-NEXT: buffer_gl0_inv
13412 ; GFX11-CU-NEXT: buffer_gl1_inv
13413 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13414 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13415 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13416 ; GFX11-CU-NEXT: s_endpgm
13417 i32* %out, i32 %in, i32 %old) {
13419 %gep = getelementptr i32, i32* %out, i32 4
13420 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst acquire
13421 %val0 = extractvalue { i32, i1 } %val, 0
13422 store i32 %val0, i32* %out, align 4
13426 define amdgpu_kernel void @flat_system_one_as_monotonic_seq_cst_ret_cmpxchg(
13427 ; GFX7-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13428 ; GFX7: ; %bb.0: ; %entry
13429 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13430 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13431 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13432 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13433 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13434 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13435 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13436 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13437 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13438 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13439 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13440 ; GFX7-NEXT: buffer_wbinvl1_vol
13441 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13442 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13443 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13444 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13445 ; GFX7-NEXT: s_endpgm
13447 ; GFX10-WGP-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13448 ; GFX10-WGP: ; %bb.0: ; %entry
13449 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13450 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13451 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13452 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13453 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13454 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13455 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13456 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13457 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13458 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13459 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13460 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13461 ; GFX10-WGP-NEXT: buffer_gl0_inv
13462 ; GFX10-WGP-NEXT: buffer_gl1_inv
13463 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13464 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13465 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13466 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13467 ; GFX10-WGP-NEXT: s_endpgm
13469 ; GFX10-CU-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13470 ; GFX10-CU: ; %bb.0: ; %entry
13471 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13472 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13473 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13474 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13475 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13476 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13477 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13478 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13479 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13480 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13481 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13482 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13483 ; GFX10-CU-NEXT: buffer_gl0_inv
13484 ; GFX10-CU-NEXT: buffer_gl1_inv
13485 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13486 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13487 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13488 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13489 ; GFX10-CU-NEXT: s_endpgm
13491 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13492 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13493 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13494 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13495 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13496 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13497 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13498 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13499 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13500 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13501 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13502 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13503 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13504 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13505 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13506 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13507 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13508 ; SKIP-CACHE-INV-NEXT: s_endpgm
13510 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13511 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13512 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13513 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13514 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13515 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13516 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13517 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13518 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13519 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13520 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13521 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13522 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13523 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13524 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13526 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13527 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13528 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13529 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13530 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13531 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13532 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13533 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13534 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13535 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13536 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13537 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13538 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13539 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13541 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13542 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13543 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13544 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13545 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13546 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13547 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13548 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13549 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13550 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13551 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13552 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13553 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13554 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13556 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13557 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13558 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13559 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13560 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13561 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13562 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13563 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13564 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13565 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13566 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13567 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13568 ; GFX940-TGSPLIT-NEXT: s_endpgm
13570 ; GFX11-WGP-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13571 ; GFX11-WGP: ; %bb.0: ; %entry
13572 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13573 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13574 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13575 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13576 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13577 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13578 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13579 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13580 ; GFX11-WGP-NEXT: buffer_gl0_inv
13581 ; GFX11-WGP-NEXT: buffer_gl1_inv
13582 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13583 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13584 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13585 ; GFX11-WGP-NEXT: s_endpgm
13587 ; GFX11-CU-LABEL: flat_system_one_as_monotonic_seq_cst_ret_cmpxchg:
13588 ; GFX11-CU: ; %bb.0: ; %entry
13589 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13590 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13591 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13592 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13593 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13594 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13595 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13596 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13597 ; GFX11-CU-NEXT: buffer_gl0_inv
13598 ; GFX11-CU-NEXT: buffer_gl1_inv
13599 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13600 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13601 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13602 ; GFX11-CU-NEXT: s_endpgm
13603 i32* %out, i32 %in, i32 %old) {
13605 %gep = getelementptr i32, i32* %out, i32 4
13606 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") monotonic seq_cst
13607 %val0 = extractvalue { i32, i1 } %val, 0
13608 store i32 %val0, i32* %out, align 4
13612 define amdgpu_kernel void @flat_system_one_as_acquire_seq_cst_ret_cmpxchg(
13613 ; GFX7-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13614 ; GFX7: ; %bb.0: ; %entry
13615 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13616 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13617 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13618 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13619 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13620 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13621 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13622 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13623 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13624 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13625 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13626 ; GFX7-NEXT: buffer_wbinvl1_vol
13627 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13628 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13629 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13630 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13631 ; GFX7-NEXT: s_endpgm
13633 ; GFX10-WGP-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13634 ; GFX10-WGP: ; %bb.0: ; %entry
13635 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13636 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13637 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13638 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13639 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13640 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13641 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13642 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13643 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13644 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13645 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13646 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13647 ; GFX10-WGP-NEXT: buffer_gl0_inv
13648 ; GFX10-WGP-NEXT: buffer_gl1_inv
13649 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13650 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13651 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13652 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13653 ; GFX10-WGP-NEXT: s_endpgm
13655 ; GFX10-CU-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13656 ; GFX10-CU: ; %bb.0: ; %entry
13657 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13658 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13659 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13660 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13661 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13662 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13663 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13664 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13665 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13666 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13667 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13668 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13669 ; GFX10-CU-NEXT: buffer_gl0_inv
13670 ; GFX10-CU-NEXT: buffer_gl1_inv
13671 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13672 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13673 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13674 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13675 ; GFX10-CU-NEXT: s_endpgm
13677 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13678 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13679 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13680 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13681 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13682 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13683 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13684 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13685 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13686 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13687 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13688 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13689 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13690 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13691 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13692 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13693 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13694 ; SKIP-CACHE-INV-NEXT: s_endpgm
13696 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13697 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13698 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13699 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13700 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13701 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13702 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13703 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13704 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13705 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13706 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13707 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13708 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13709 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13710 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13712 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13713 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13714 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13715 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13716 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13717 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13718 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13719 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13720 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13721 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13722 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13723 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13724 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13725 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13727 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13728 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13729 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13730 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13731 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13732 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13733 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13734 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13735 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13736 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13737 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13738 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13739 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13740 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13742 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13743 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13744 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13745 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13746 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13747 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13748 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13749 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13750 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13751 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13752 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13753 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13754 ; GFX940-TGSPLIT-NEXT: s_endpgm
13756 ; GFX11-WGP-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13757 ; GFX11-WGP: ; %bb.0: ; %entry
13758 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13759 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13760 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13761 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13762 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13763 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13764 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13765 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13766 ; GFX11-WGP-NEXT: buffer_gl0_inv
13767 ; GFX11-WGP-NEXT: buffer_gl1_inv
13768 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13769 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13770 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13771 ; GFX11-WGP-NEXT: s_endpgm
13773 ; GFX11-CU-LABEL: flat_system_one_as_acquire_seq_cst_ret_cmpxchg:
13774 ; GFX11-CU: ; %bb.0: ; %entry
13775 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13776 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13777 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13778 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13779 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13780 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13781 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13782 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13783 ; GFX11-CU-NEXT: buffer_gl0_inv
13784 ; GFX11-CU-NEXT: buffer_gl1_inv
13785 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13786 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13787 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13788 ; GFX11-CU-NEXT: s_endpgm
13789 i32* %out, i32 %in, i32 %old) {
13791 %gep = getelementptr i32, i32* %out, i32 4
13792 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acquire seq_cst
13793 %val0 = extractvalue { i32, i1 } %val, 0
13794 store i32 %val0, i32* %out, align 4
13798 define amdgpu_kernel void @flat_system_one_as_release_seq_cst_ret_cmpxchg(
13799 ; GFX7-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13800 ; GFX7: ; %bb.0: ; %entry
13801 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13802 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13803 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13804 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13805 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13806 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13807 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13808 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13809 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13810 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13811 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13812 ; GFX7-NEXT: buffer_wbinvl1_vol
13813 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
13814 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
13815 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13816 ; GFX7-NEXT: flat_store_dword v[0:1], v2
13817 ; GFX7-NEXT: s_endpgm
13819 ; GFX10-WGP-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13820 ; GFX10-WGP: ; %bb.0: ; %entry
13821 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13822 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13823 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
13824 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
13825 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13826 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
13827 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13828 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
13829 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13830 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13831 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13832 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
13833 ; GFX10-WGP-NEXT: buffer_gl0_inv
13834 ; GFX10-WGP-NEXT: buffer_gl1_inv
13835 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
13836 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
13837 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13838 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
13839 ; GFX10-WGP-NEXT: s_endpgm
13841 ; GFX10-CU-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13842 ; GFX10-CU: ; %bb.0: ; %entry
13843 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13844 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13845 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
13846 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
13847 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13848 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
13849 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13850 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
13851 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13852 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
13853 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13854 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
13855 ; GFX10-CU-NEXT: buffer_gl0_inv
13856 ; GFX10-CU-NEXT: buffer_gl1_inv
13857 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
13858 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
13859 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13860 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
13861 ; GFX10-CU-NEXT: s_endpgm
13863 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13864 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13865 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13866 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13867 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
13868 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
13869 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
13870 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
13871 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
13872 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
13873 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13874 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13875 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
13876 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13877 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13878 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13879 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
13880 ; SKIP-CACHE-INV-NEXT: s_endpgm
13882 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13883 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13884 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13885 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13886 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13887 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13888 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
13889 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13890 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13891 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13892 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
13893 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
13894 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13895 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13896 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13898 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13899 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13900 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13901 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13902 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
13903 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
13904 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
13905 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13906 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
13907 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13908 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
13909 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
13910 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13911 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13913 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13914 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13915 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13916 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13917 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13918 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13919 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13920 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13921 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13922 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
13923 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
13924 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13925 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
13926 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13928 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13929 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13930 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
13931 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13932 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
13933 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
13934 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
13935 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13936 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
13937 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
13938 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
13939 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
13940 ; GFX940-TGSPLIT-NEXT: s_endpgm
13942 ; GFX11-WGP-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13943 ; GFX11-WGP: ; %bb.0: ; %entry
13944 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13945 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13946 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13947 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13948 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13949 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
13950 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13951 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
13952 ; GFX11-WGP-NEXT: buffer_gl0_inv
13953 ; GFX11-WGP-NEXT: buffer_gl1_inv
13954 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13955 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
13956 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13957 ; GFX11-WGP-NEXT: s_endpgm
13959 ; GFX11-CU-LABEL: flat_system_one_as_release_seq_cst_ret_cmpxchg:
13960 ; GFX11-CU: ; %bb.0: ; %entry
13961 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
13962 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13963 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
13964 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
13965 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13966 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
13967 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
13968 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
13969 ; GFX11-CU-NEXT: buffer_gl0_inv
13970 ; GFX11-CU-NEXT: buffer_gl1_inv
13971 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13972 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
13973 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
13974 ; GFX11-CU-NEXT: s_endpgm
13975 i32* %out, i32 %in, i32 %old) {
13977 %gep = getelementptr i32, i32* %out, i32 4
13978 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") release seq_cst
13979 %val0 = extractvalue { i32, i1 } %val, 0
13980 store i32 %val0, i32* %out, align 4
13984 define amdgpu_kernel void @flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg(
13985 ; GFX7-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
13986 ; GFX7: ; %bb.0: ; %entry
13987 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
13988 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13989 ; GFX7-NEXT: s_add_u32 s4, s0, 16
13990 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
13991 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13992 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
13993 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13994 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
13995 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13996 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
13997 ; GFX7-NEXT: s_waitcnt vmcnt(0)
13998 ; GFX7-NEXT: buffer_wbinvl1_vol
13999 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
14000 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
14001 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14002 ; GFX7-NEXT: flat_store_dword v[0:1], v2
14003 ; GFX7-NEXT: s_endpgm
14005 ; GFX10-WGP-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14006 ; GFX10-WGP: ; %bb.0: ; %entry
14007 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14008 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14009 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
14010 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
14011 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14012 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
14013 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
14014 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
14015 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
14016 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14017 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14018 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
14019 ; GFX10-WGP-NEXT: buffer_gl0_inv
14020 ; GFX10-WGP-NEXT: buffer_gl1_inv
14021 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
14022 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
14023 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14024 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
14025 ; GFX10-WGP-NEXT: s_endpgm
14027 ; GFX10-CU-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14028 ; GFX10-CU: ; %bb.0: ; %entry
14029 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14030 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14031 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
14032 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
14033 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14034 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
14035 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
14036 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
14037 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
14038 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
14039 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14040 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
14041 ; GFX10-CU-NEXT: buffer_gl0_inv
14042 ; GFX10-CU-NEXT: buffer_gl1_inv
14043 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
14044 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
14045 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14046 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
14047 ; GFX10-CU-NEXT: s_endpgm
14049 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14050 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14051 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14052 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14053 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
14054 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
14055 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
14056 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
14057 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
14058 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
14059 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14060 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14061 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14062 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14063 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
14064 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14065 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
14066 ; SKIP-CACHE-INV-NEXT: s_endpgm
14068 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14069 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14070 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14071 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14072 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
14073 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
14074 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
14075 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14076 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
14077 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14078 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
14079 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
14080 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14081 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
14082 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14084 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14085 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14086 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14087 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14088 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
14089 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
14090 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
14091 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14092 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
14093 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14094 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
14095 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
14096 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
14097 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14099 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14100 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14101 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14102 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14103 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
14104 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
14105 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14106 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14107 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
14108 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14109 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
14110 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14111 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
14112 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14114 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14115 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14116 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14117 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14118 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
14119 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
14120 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14121 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14122 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
14123 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14124 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
14125 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
14126 ; GFX940-TGSPLIT-NEXT: s_endpgm
14128 ; GFX11-WGP-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14129 ; GFX11-WGP: ; %bb.0: ; %entry
14130 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
14131 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14132 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
14133 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
14134 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14135 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14136 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
14137 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14138 ; GFX11-WGP-NEXT: buffer_gl0_inv
14139 ; GFX11-WGP-NEXT: buffer_gl1_inv
14140 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14141 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
14142 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
14143 ; GFX11-WGP-NEXT: s_endpgm
14145 ; GFX11-CU-LABEL: flat_system_one_as_acq_rel_seq_cst_ret_cmpxchg:
14146 ; GFX11-CU: ; %bb.0: ; %entry
14147 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
14148 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14149 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
14150 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
14151 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14152 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
14153 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
14154 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14155 ; GFX11-CU-NEXT: buffer_gl0_inv
14156 ; GFX11-CU-NEXT: buffer_gl1_inv
14157 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14158 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
14159 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
14160 ; GFX11-CU-NEXT: s_endpgm
14161 i32* %out, i32 %in, i32 %old) {
14163 %gep = getelementptr i32, i32* %out, i32 4
14164 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") acq_rel seq_cst
14165 %val0 = extractvalue { i32, i1 } %val, 0
14166 store i32 %val0, i32* %out, align 4
14170 define amdgpu_kernel void @flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg(
14171 ; GFX7-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14172 ; GFX7: ; %bb.0: ; %entry
14173 ; GFX7-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14174 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14175 ; GFX7-NEXT: s_add_u32 s4, s0, 16
14176 ; GFX7-NEXT: s_addc_u32 s5, s1, 0
14177 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14178 ; GFX7-NEXT: v_mov_b32_e32 v2, s2
14179 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
14180 ; GFX7-NEXT: v_mov_b32_e32 v3, s3
14181 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14182 ; GFX7-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14183 ; GFX7-NEXT: s_waitcnt vmcnt(0)
14184 ; GFX7-NEXT: buffer_wbinvl1_vol
14185 ; GFX7-NEXT: v_mov_b32_e32 v0, s0
14186 ; GFX7-NEXT: v_mov_b32_e32 v1, s1
14187 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14188 ; GFX7-NEXT: flat_store_dword v[0:1], v2
14189 ; GFX7-NEXT: s_endpgm
14191 ; GFX10-WGP-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14192 ; GFX10-WGP: ; %bb.0: ; %entry
14193 ; GFX10-WGP-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14194 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14195 ; GFX10-WGP-NEXT: s_add_u32 s4, s0, 16
14196 ; GFX10-WGP-NEXT: s_addc_u32 s5, s1, 0
14197 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14198 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s2
14199 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
14200 ; GFX10-WGP-NEXT: v_mov_b32_e32 v3, s3
14201 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
14202 ; GFX10-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14203 ; GFX10-WGP-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14204 ; GFX10-WGP-NEXT: s_waitcnt vmcnt(0)
14205 ; GFX10-WGP-NEXT: buffer_gl0_inv
14206 ; GFX10-WGP-NEXT: buffer_gl1_inv
14207 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s0
14208 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s1
14209 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14210 ; GFX10-WGP-NEXT: flat_store_dword v[0:1], v2
14211 ; GFX10-WGP-NEXT: s_endpgm
14213 ; GFX10-CU-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14214 ; GFX10-CU: ; %bb.0: ; %entry
14215 ; GFX10-CU-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14216 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14217 ; GFX10-CU-NEXT: s_add_u32 s4, s0, 16
14218 ; GFX10-CU-NEXT: s_addc_u32 s5, s1, 0
14219 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14220 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s2
14221 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
14222 ; GFX10-CU-NEXT: v_mov_b32_e32 v3, s3
14223 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
14224 ; GFX10-CU-NEXT: s_waitcnt_vscnt null, 0x0
14225 ; GFX10-CU-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14226 ; GFX10-CU-NEXT: s_waitcnt vmcnt(0)
14227 ; GFX10-CU-NEXT: buffer_gl0_inv
14228 ; GFX10-CU-NEXT: buffer_gl1_inv
14229 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s0
14230 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s1
14231 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14232 ; GFX10-CU-NEXT: flat_store_dword v[0:1], v2
14233 ; GFX10-CU-NEXT: s_endpgm
14235 ; SKIP-CACHE-INV-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14236 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14237 ; SKIP-CACHE-INV-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14238 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14239 ; SKIP-CACHE-INV-NEXT: s_add_u32 s4, s0, 16
14240 ; SKIP-CACHE-INV-NEXT: s_addc_u32 s5, s1, 0
14241 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s4
14242 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s2
14243 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s5
14244 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v3, s3
14245 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14246 ; SKIP-CACHE-INV-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] glc
14247 ; SKIP-CACHE-INV-NEXT: s_waitcnt vmcnt(0)
14248 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14249 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
14250 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14251 ; SKIP-CACHE-INV-NEXT: flat_store_dword v[0:1], v2
14252 ; SKIP-CACHE-INV-NEXT: s_endpgm
14254 ; GFX90A-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14255 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14256 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14257 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14258 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
14259 ; GFX90A-NOTTGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
14260 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbl2
14261 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14262 ; GFX90A-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
14263 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14264 ; GFX90A-NOTTGSPLIT-NEXT: buffer_invl2
14265 ; GFX90A-NOTTGSPLIT-NEXT: buffer_wbinvl1_vol
14266 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14267 ; GFX90A-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
14268 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14270 ; GFX90A-TGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14271 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14272 ; GFX90A-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
14273 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14274 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[0:1], s[0:1], s[0:1] op_sel:[0,1]
14275 ; GFX90A-TGSPLIT-NEXT: v_pk_mov_b32 v[2:3], s[2:3], s[2:3] op_sel:[0,1]
14276 ; GFX90A-TGSPLIT-NEXT: buffer_wbl2
14277 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14278 ; GFX90A-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 glc
14279 ; GFX90A-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14280 ; GFX90A-TGSPLIT-NEXT: buffer_invl2
14281 ; GFX90A-TGSPLIT-NEXT: buffer_wbinvl1_vol
14282 ; GFX90A-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
14283 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14285 ; GFX940-NOTTGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14286 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14287 ; GFX940-NOTTGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14288 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14289 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
14290 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
14291 ; GFX940-NOTTGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14292 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14293 ; GFX940-NOTTGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
14294 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt vmcnt(0)
14295 ; GFX940-NOTTGSPLIT-NEXT: buffer_inv sc0 sc1
14296 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14297 ; GFX940-NOTTGSPLIT-NEXT: flat_store_dword v[0:1], v2
14298 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14300 ; GFX940-TGSPLIT-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14301 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14302 ; GFX940-TGSPLIT-NEXT: s_load_dwordx4 s[0:3], s[0:1], 0x0
14303 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14304 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
14305 ; GFX940-TGSPLIT-NEXT: v_mov_b64_e32 v[2:3], s[2:3]
14306 ; GFX940-TGSPLIT-NEXT: buffer_wbl2 sc0 sc1
14307 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14308 ; GFX940-TGSPLIT-NEXT: flat_atomic_cmpswap v2, v[0:1], v[2:3] offset:16 sc0 sc1
14309 ; GFX940-TGSPLIT-NEXT: s_waitcnt vmcnt(0)
14310 ; GFX940-TGSPLIT-NEXT: buffer_inv sc0 sc1
14311 ; GFX940-TGSPLIT-NEXT: flat_store_dword v[0:1], v2
14312 ; GFX940-TGSPLIT-NEXT: s_endpgm
14314 ; GFX11-WGP-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14315 ; GFX11-WGP: ; %bb.0: ; %entry
14316 ; GFX11-WGP-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
14317 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14318 ; GFX11-WGP-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
14319 ; GFX11-WGP-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
14320 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14321 ; GFX11-WGP-NEXT: s_waitcnt_vscnt null, 0x0
14322 ; GFX11-WGP-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
14323 ; GFX11-WGP-NEXT: s_waitcnt vmcnt(0)
14324 ; GFX11-WGP-NEXT: buffer_gl0_inv
14325 ; GFX11-WGP-NEXT: buffer_gl1_inv
14326 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14327 ; GFX11-WGP-NEXT: flat_store_b32 v[0:1], v2
14328 ; GFX11-WGP-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
14329 ; GFX11-WGP-NEXT: s_endpgm
14331 ; GFX11-CU-LABEL: flat_system_one_as_seq_cst_seq_cst_ret_cmpxchg:
14332 ; GFX11-CU: ; %bb.0: ; %entry
14333 ; GFX11-CU-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
14334 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14335 ; GFX11-CU-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
14336 ; GFX11-CU-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
14337 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14338 ; GFX11-CU-NEXT: s_waitcnt_vscnt null, 0x0
14339 ; GFX11-CU-NEXT: flat_atomic_cmpswap_b32 v2, v[0:1], v[2:3] offset:16 glc
14340 ; GFX11-CU-NEXT: s_waitcnt vmcnt(0)
14341 ; GFX11-CU-NEXT: buffer_gl0_inv
14342 ; GFX11-CU-NEXT: buffer_gl1_inv
14343 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14344 ; GFX11-CU-NEXT: flat_store_b32 v[0:1], v2
14345 ; GFX11-CU-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
14346 ; GFX11-CU-NEXT: s_endpgm
14347 i32* %out, i32 %in, i32 %old) {
14349 %gep = getelementptr i32, i32* %out, i32 4
14350 %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("one-as") seq_cst seq_cst
14351 %val0 = extractvalue { i32, i1 } %val, 0
14352 store i32 %val0, i32* %out, align 4