1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx600 < %s | FileCheck --check-prefixes=GFX6 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx700 < %s | FileCheck --check-prefixes=GFX7 %s
4 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1010 < %s | FileCheck --check-prefixes=GFX10-WGP %s
5 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1010 -mattr=+cumode < %s | FileCheck --check-prefixes=GFX10-CU %s
6 ; RUN: llc -mtriple=amdgcn-amd-amdpal -O0 -mcpu=gfx700 -amdgcn-skip-cache-invalidations < %s | FileCheck --check-prefixes=SKIP-CACHE-INV %s
7 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx90a < %s | FileCheck -check-prefixes=GFX90A-NOTTGSPLIT %s
8 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx90a -mattr=+tgsplit < %s | FileCheck -check-prefixes=GFX90A-TGSPLIT %s
9 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx940 < %s | FileCheck -check-prefixes=GFX940-NOTTGSPLIT %s
10 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx940 -mattr=+tgsplit < %s | FileCheck -check-prefixes=GFX940-TGSPLIT %s
11 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1100 < %s | FileCheck --check-prefixes=GFX11-WGP %s
12 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1100 -mattr=+cumode < %s | FileCheck --check-prefixes=GFX11-CU %s
13 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1200 < %s | FileCheck --check-prefixes=GFX12-WGP %s
14 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1200 -mattr=+cumode < %s | FileCheck --check-prefixes=GFX12-CU %s
16 define amdgpu_kernel void @local_singlethread_unordered_load(
17 ; GFX6-LABEL: local_singlethread_unordered_load:
18 ; GFX6: ; %bb.0: ; %entry
19 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
20 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
21 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr4
22 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr5
23 ; GFX6-NEXT: s_mov_b32 m0, -1
24 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
25 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
26 ; GFX6-NEXT: ds_read_b32 v1, v0
27 ; GFX6-NEXT: s_mov_b32 m0, -1
28 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
29 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
30 ; GFX6-NEXT: ds_write_b32 v0, v1
33 ; GFX7-LABEL: local_singlethread_unordered_load:
34 ; GFX7: ; %bb.0: ; %entry
35 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
36 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
37 ; GFX7-NEXT: s_mov_b32 m0, -1
38 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
39 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
40 ; GFX7-NEXT: ds_read_b32 v1, v0
41 ; GFX7-NEXT: s_mov_b32 m0, -1
42 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
43 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
44 ; GFX7-NEXT: ds_write_b32 v0, v1
47 ; GFX10-WGP-LABEL: local_singlethread_unordered_load:
48 ; GFX10-WGP: ; %bb.0: ; %entry
49 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
50 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
51 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
52 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
53 ; GFX10-WGP-NEXT: ds_read_b32 v1, v0
54 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
55 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
56 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
57 ; GFX10-WGP-NEXT: s_endpgm
59 ; GFX10-CU-LABEL: local_singlethread_unordered_load:
60 ; GFX10-CU: ; %bb.0: ; %entry
61 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
62 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
63 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
64 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
65 ; GFX10-CU-NEXT: ds_read_b32 v1, v0
66 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
67 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
68 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
69 ; GFX10-CU-NEXT: s_endpgm
71 ; SKIP-CACHE-INV-LABEL: local_singlethread_unordered_load:
72 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
73 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
74 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
75 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
76 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
77 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
78 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v1, v0
79 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
80 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
81 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
82 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
83 ; SKIP-CACHE-INV-NEXT: s_endpgm
85 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_unordered_load:
86 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
87 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
88 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
89 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
90 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
91 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
92 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
93 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
94 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
95 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
97 ; GFX90A-TGSPLIT-LABEL: local_singlethread_unordered_load:
98 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
99 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
100 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
101 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
102 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
103 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v1, v0
104 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
105 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
106 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
107 ; GFX90A-TGSPLIT-NEXT: s_endpgm
109 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_unordered_load:
110 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
111 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
112 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
113 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
114 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
115 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
116 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
117 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
118 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
119 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
121 ; GFX940-TGSPLIT-LABEL: local_singlethread_unordered_load:
122 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
123 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
124 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
125 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
126 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
127 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v1, v0
128 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
129 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
130 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
131 ; GFX940-TGSPLIT-NEXT: s_endpgm
133 ; GFX11-WGP-LABEL: local_singlethread_unordered_load:
134 ; GFX11-WGP: ; %bb.0: ; %entry
135 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
136 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
137 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
138 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
139 ; GFX11-WGP-NEXT: ds_load_b32 v1, v0
140 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
141 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
142 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
143 ; GFX11-WGP-NEXT: s_endpgm
145 ; GFX11-CU-LABEL: local_singlethread_unordered_load:
146 ; GFX11-CU: ; %bb.0: ; %entry
147 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
148 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
149 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
150 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
151 ; GFX11-CU-NEXT: ds_load_b32 v1, v0
152 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
153 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
154 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
155 ; GFX11-CU-NEXT: s_endpgm
157 ; GFX12-WGP-LABEL: local_singlethread_unordered_load:
158 ; GFX12-WGP: ; %bb.0: ; %entry
159 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
160 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
161 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
162 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
163 ; GFX12-WGP-NEXT: ds_load_b32 v1, v0
164 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
165 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
166 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
167 ; GFX12-WGP-NEXT: s_endpgm
169 ; GFX12-CU-LABEL: local_singlethread_unordered_load:
170 ; GFX12-CU: ; %bb.0: ; %entry
171 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
172 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
173 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
174 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
175 ; GFX12-CU-NEXT: ds_load_b32 v1, v0
176 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
177 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
178 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
179 ; GFX12-CU-NEXT: s_endpgm
180 ptr addrspace(3) %in, ptr addrspace(3) %out) {
182 %val = load atomic i32, ptr addrspace(3) %in syncscope("singlethread") unordered, align 4
183 store i32 %val, ptr addrspace(3) %out
187 define amdgpu_kernel void @local_singlethread_monotonic_load(
188 ; GFX6-LABEL: local_singlethread_monotonic_load:
189 ; GFX6: ; %bb.0: ; %entry
190 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
191 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
192 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr4
193 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr5
194 ; GFX6-NEXT: s_mov_b32 m0, -1
195 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
196 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
197 ; GFX6-NEXT: ds_read_b32 v1, v0
198 ; GFX6-NEXT: s_mov_b32 m0, -1
199 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
200 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
201 ; GFX6-NEXT: ds_write_b32 v0, v1
202 ; GFX6-NEXT: s_endpgm
204 ; GFX7-LABEL: local_singlethread_monotonic_load:
205 ; GFX7: ; %bb.0: ; %entry
206 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
207 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
208 ; GFX7-NEXT: s_mov_b32 m0, -1
209 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
210 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
211 ; GFX7-NEXT: ds_read_b32 v1, v0
212 ; GFX7-NEXT: s_mov_b32 m0, -1
213 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
214 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
215 ; GFX7-NEXT: ds_write_b32 v0, v1
216 ; GFX7-NEXT: s_endpgm
218 ; GFX10-WGP-LABEL: local_singlethread_monotonic_load:
219 ; GFX10-WGP: ; %bb.0: ; %entry
220 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
221 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
222 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
223 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
224 ; GFX10-WGP-NEXT: ds_read_b32 v1, v0
225 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
226 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
227 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
228 ; GFX10-WGP-NEXT: s_endpgm
230 ; GFX10-CU-LABEL: local_singlethread_monotonic_load:
231 ; GFX10-CU: ; %bb.0: ; %entry
232 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
233 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
234 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
235 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
236 ; GFX10-CU-NEXT: ds_read_b32 v1, v0
237 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
238 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
239 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
240 ; GFX10-CU-NEXT: s_endpgm
242 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_load:
243 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
244 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
245 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
246 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
247 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
248 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
249 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v1, v0
250 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
251 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
252 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
253 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
254 ; SKIP-CACHE-INV-NEXT: s_endpgm
256 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_load:
257 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
258 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
259 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
260 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
261 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
262 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
263 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
264 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
265 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
266 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
268 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_load:
269 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
270 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
271 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
272 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
273 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
274 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v1, v0
275 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
276 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
277 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
278 ; GFX90A-TGSPLIT-NEXT: s_endpgm
280 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_monotonic_load:
281 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
282 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
283 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
284 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
285 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
286 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
287 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
288 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
289 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
290 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
292 ; GFX940-TGSPLIT-LABEL: local_singlethread_monotonic_load:
293 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
294 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
295 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
296 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
297 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
298 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v1, v0
299 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
300 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
301 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
302 ; GFX940-TGSPLIT-NEXT: s_endpgm
304 ; GFX11-WGP-LABEL: local_singlethread_monotonic_load:
305 ; GFX11-WGP: ; %bb.0: ; %entry
306 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
307 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
308 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
309 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
310 ; GFX11-WGP-NEXT: ds_load_b32 v1, v0
311 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
312 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
313 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
314 ; GFX11-WGP-NEXT: s_endpgm
316 ; GFX11-CU-LABEL: local_singlethread_monotonic_load:
317 ; GFX11-CU: ; %bb.0: ; %entry
318 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
319 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
320 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
321 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
322 ; GFX11-CU-NEXT: ds_load_b32 v1, v0
323 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
324 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
325 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
326 ; GFX11-CU-NEXT: s_endpgm
328 ; GFX12-WGP-LABEL: local_singlethread_monotonic_load:
329 ; GFX12-WGP: ; %bb.0: ; %entry
330 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
331 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
332 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
333 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
334 ; GFX12-WGP-NEXT: ds_load_b32 v1, v0
335 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
336 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
337 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
338 ; GFX12-WGP-NEXT: s_endpgm
340 ; GFX12-CU-LABEL: local_singlethread_monotonic_load:
341 ; GFX12-CU: ; %bb.0: ; %entry
342 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
343 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
344 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
345 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
346 ; GFX12-CU-NEXT: ds_load_b32 v1, v0
347 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
348 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
349 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
350 ; GFX12-CU-NEXT: s_endpgm
351 ptr addrspace(3) %in, ptr addrspace(3) %out) {
353 %val = load atomic i32, ptr addrspace(3) %in syncscope("singlethread") monotonic, align 4
354 store i32 %val, ptr addrspace(3) %out
358 define amdgpu_kernel void @local_singlethread_acquire_load(
359 ; GFX6-LABEL: local_singlethread_acquire_load:
360 ; GFX6: ; %bb.0: ; %entry
361 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
362 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
363 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr4
364 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr5
365 ; GFX6-NEXT: s_mov_b32 m0, -1
366 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
367 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
368 ; GFX6-NEXT: ds_read_b32 v1, v0
369 ; GFX6-NEXT: s_mov_b32 m0, -1
370 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
371 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
372 ; GFX6-NEXT: ds_write_b32 v0, v1
373 ; GFX6-NEXT: s_endpgm
375 ; GFX7-LABEL: local_singlethread_acquire_load:
376 ; GFX7: ; %bb.0: ; %entry
377 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
378 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
379 ; GFX7-NEXT: s_mov_b32 m0, -1
380 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
381 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
382 ; GFX7-NEXT: ds_read_b32 v1, v0
383 ; GFX7-NEXT: s_mov_b32 m0, -1
384 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
385 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
386 ; GFX7-NEXT: ds_write_b32 v0, v1
387 ; GFX7-NEXT: s_endpgm
389 ; GFX10-WGP-LABEL: local_singlethread_acquire_load:
390 ; GFX10-WGP: ; %bb.0: ; %entry
391 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
392 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
393 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
394 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
395 ; GFX10-WGP-NEXT: ds_read_b32 v1, v0
396 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
397 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
398 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
399 ; GFX10-WGP-NEXT: s_endpgm
401 ; GFX10-CU-LABEL: local_singlethread_acquire_load:
402 ; GFX10-CU: ; %bb.0: ; %entry
403 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
404 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
405 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
406 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
407 ; GFX10-CU-NEXT: ds_read_b32 v1, v0
408 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
409 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
410 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
411 ; GFX10-CU-NEXT: s_endpgm
413 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_load:
414 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
415 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
416 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
417 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
418 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
419 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
420 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v1, v0
421 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
422 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
423 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
424 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
425 ; SKIP-CACHE-INV-NEXT: s_endpgm
427 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_load:
428 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
429 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
430 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
431 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
432 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
433 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
434 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
435 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
436 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
437 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
439 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_load:
440 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
441 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
442 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
443 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
444 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
445 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v1, v0
446 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
447 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
448 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
449 ; GFX90A-TGSPLIT-NEXT: s_endpgm
451 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acquire_load:
452 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
453 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
454 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
455 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
456 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
457 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
458 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
459 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
460 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
461 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
463 ; GFX940-TGSPLIT-LABEL: local_singlethread_acquire_load:
464 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
465 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
466 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
467 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
468 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
469 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v1, v0
470 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
471 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
472 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
473 ; GFX940-TGSPLIT-NEXT: s_endpgm
475 ; GFX11-WGP-LABEL: local_singlethread_acquire_load:
476 ; GFX11-WGP: ; %bb.0: ; %entry
477 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
478 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
479 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
480 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
481 ; GFX11-WGP-NEXT: ds_load_b32 v1, v0
482 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
483 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
484 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
485 ; GFX11-WGP-NEXT: s_endpgm
487 ; GFX11-CU-LABEL: local_singlethread_acquire_load:
488 ; GFX11-CU: ; %bb.0: ; %entry
489 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
490 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
491 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
492 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
493 ; GFX11-CU-NEXT: ds_load_b32 v1, v0
494 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
495 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
496 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
497 ; GFX11-CU-NEXT: s_endpgm
499 ; GFX12-WGP-LABEL: local_singlethread_acquire_load:
500 ; GFX12-WGP: ; %bb.0: ; %entry
501 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
502 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
503 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
504 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
505 ; GFX12-WGP-NEXT: ds_load_b32 v1, v0
506 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
507 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
508 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
509 ; GFX12-WGP-NEXT: s_endpgm
511 ; GFX12-CU-LABEL: local_singlethread_acquire_load:
512 ; GFX12-CU: ; %bb.0: ; %entry
513 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
514 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
515 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
516 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
517 ; GFX12-CU-NEXT: ds_load_b32 v1, v0
518 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
519 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
520 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
521 ; GFX12-CU-NEXT: s_endpgm
522 ptr addrspace(3) %in, ptr addrspace(3) %out) {
524 %val = load atomic i32, ptr addrspace(3) %in syncscope("singlethread") acquire, align 4
525 store i32 %val, ptr addrspace(3) %out
529 define amdgpu_kernel void @local_singlethread_seq_cst_load(
530 ; GFX6-LABEL: local_singlethread_seq_cst_load:
531 ; GFX6: ; %bb.0: ; %entry
532 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
533 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
534 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr4
535 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr5
536 ; GFX6-NEXT: s_mov_b32 m0, -1
537 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
538 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
539 ; GFX6-NEXT: ds_read_b32 v1, v0
540 ; GFX6-NEXT: s_mov_b32 m0, -1
541 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
542 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
543 ; GFX6-NEXT: ds_write_b32 v0, v1
544 ; GFX6-NEXT: s_endpgm
546 ; GFX7-LABEL: local_singlethread_seq_cst_load:
547 ; GFX7: ; %bb.0: ; %entry
548 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
549 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
550 ; GFX7-NEXT: s_mov_b32 m0, -1
551 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
552 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
553 ; GFX7-NEXT: ds_read_b32 v1, v0
554 ; GFX7-NEXT: s_mov_b32 m0, -1
555 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
556 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
557 ; GFX7-NEXT: ds_write_b32 v0, v1
558 ; GFX7-NEXT: s_endpgm
560 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_load:
561 ; GFX10-WGP: ; %bb.0: ; %entry
562 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
563 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
564 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
565 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
566 ; GFX10-WGP-NEXT: ds_read_b32 v1, v0
567 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
568 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
569 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
570 ; GFX10-WGP-NEXT: s_endpgm
572 ; GFX10-CU-LABEL: local_singlethread_seq_cst_load:
573 ; GFX10-CU: ; %bb.0: ; %entry
574 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
575 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
576 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
577 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
578 ; GFX10-CU-NEXT: ds_read_b32 v1, v0
579 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
580 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
581 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
582 ; GFX10-CU-NEXT: s_endpgm
584 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_load:
585 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
586 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
587 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
588 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
589 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
590 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
591 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v1, v0
592 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
593 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
594 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
595 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
596 ; SKIP-CACHE-INV-NEXT: s_endpgm
598 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_load:
599 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
600 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
601 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
602 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
603 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
604 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
605 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
606 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
607 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
608 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
610 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_load:
611 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
612 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
613 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
614 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
615 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
616 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v1, v0
617 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
618 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
619 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
620 ; GFX90A-TGSPLIT-NEXT: s_endpgm
622 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_load:
623 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
624 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
625 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
626 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
627 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
628 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
629 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
630 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
631 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
632 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
634 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_load:
635 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
636 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
637 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
638 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
639 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
640 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v1, v0
641 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
642 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
643 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
644 ; GFX940-TGSPLIT-NEXT: s_endpgm
646 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_load:
647 ; GFX11-WGP: ; %bb.0: ; %entry
648 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
649 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
650 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
651 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
652 ; GFX11-WGP-NEXT: ds_load_b32 v1, v0
653 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
654 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
655 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
656 ; GFX11-WGP-NEXT: s_endpgm
658 ; GFX11-CU-LABEL: local_singlethread_seq_cst_load:
659 ; GFX11-CU: ; %bb.0: ; %entry
660 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
661 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
662 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
663 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
664 ; GFX11-CU-NEXT: ds_load_b32 v1, v0
665 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
666 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
667 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
668 ; GFX11-CU-NEXT: s_endpgm
670 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_load:
671 ; GFX12-WGP: ; %bb.0: ; %entry
672 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
673 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
674 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
675 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
676 ; GFX12-WGP-NEXT: ds_load_b32 v1, v0
677 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
678 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
679 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
680 ; GFX12-WGP-NEXT: s_endpgm
682 ; GFX12-CU-LABEL: local_singlethread_seq_cst_load:
683 ; GFX12-CU: ; %bb.0: ; %entry
684 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
685 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
686 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
687 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
688 ; GFX12-CU-NEXT: ds_load_b32 v1, v0
689 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
690 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
691 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
692 ; GFX12-CU-NEXT: s_endpgm
693 ptr addrspace(3) %in, ptr addrspace(3) %out) {
695 %val = load atomic i32, ptr addrspace(3) %in syncscope("singlethread") seq_cst, align 4
696 store i32 %val, ptr addrspace(3) %out
700 define amdgpu_kernel void @local_singlethread_unordered_store(
701 ; GFX6-LABEL: local_singlethread_unordered_store:
702 ; GFX6: ; %bb.0: ; %entry
703 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
704 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
705 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
706 ; GFX6-NEXT: s_mov_b32 m0, -1
707 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
708 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
709 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
710 ; GFX6-NEXT: ds_write_b32 v0, v1
711 ; GFX6-NEXT: s_endpgm
713 ; GFX7-LABEL: local_singlethread_unordered_store:
714 ; GFX7: ; %bb.0: ; %entry
715 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
716 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
717 ; GFX7-NEXT: s_mov_b32 m0, -1
718 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
719 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
720 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
721 ; GFX7-NEXT: ds_write_b32 v0, v1
722 ; GFX7-NEXT: s_endpgm
724 ; GFX10-WGP-LABEL: local_singlethread_unordered_store:
725 ; GFX10-WGP: ; %bb.0: ; %entry
726 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
727 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
728 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
729 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
730 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
731 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
732 ; GFX10-WGP-NEXT: s_endpgm
734 ; GFX10-CU-LABEL: local_singlethread_unordered_store:
735 ; GFX10-CU: ; %bb.0: ; %entry
736 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
737 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
738 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
739 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
740 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
741 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
742 ; GFX10-CU-NEXT: s_endpgm
744 ; SKIP-CACHE-INV-LABEL: local_singlethread_unordered_store:
745 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
746 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
747 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
748 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
749 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
750 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
751 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
752 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
753 ; SKIP-CACHE-INV-NEXT: s_endpgm
755 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_unordered_store:
756 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
757 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
758 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
759 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
760 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
761 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
762 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
763 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
765 ; GFX90A-TGSPLIT-LABEL: local_singlethread_unordered_store:
766 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
767 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
768 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
769 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
770 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
771 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
772 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
773 ; GFX90A-TGSPLIT-NEXT: s_endpgm
775 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_unordered_store:
776 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
777 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
778 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
779 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
780 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
781 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
782 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
783 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
785 ; GFX940-TGSPLIT-LABEL: local_singlethread_unordered_store:
786 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
787 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
788 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
789 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
790 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
791 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
792 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
793 ; GFX940-TGSPLIT-NEXT: s_endpgm
795 ; GFX11-WGP-LABEL: local_singlethread_unordered_store:
796 ; GFX11-WGP: ; %bb.0: ; %entry
797 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
798 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
799 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
800 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
801 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
802 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
803 ; GFX11-WGP-NEXT: s_endpgm
805 ; GFX11-CU-LABEL: local_singlethread_unordered_store:
806 ; GFX11-CU: ; %bb.0: ; %entry
807 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
808 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
809 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
810 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
811 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
812 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
813 ; GFX11-CU-NEXT: s_endpgm
815 ; GFX12-WGP-LABEL: local_singlethread_unordered_store:
816 ; GFX12-WGP: ; %bb.0: ; %entry
817 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
818 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
819 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
820 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
821 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
822 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
823 ; GFX12-WGP-NEXT: s_endpgm
825 ; GFX12-CU-LABEL: local_singlethread_unordered_store:
826 ; GFX12-CU: ; %bb.0: ; %entry
827 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
828 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
829 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
830 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
831 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
832 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
833 ; GFX12-CU-NEXT: s_endpgm
834 i32 %in, ptr addrspace(3) %out) {
836 store atomic i32 %in, ptr addrspace(3) %out syncscope("singlethread") unordered, align 4
840 define amdgpu_kernel void @local_singlethread_monotonic_store(
841 ; GFX6-LABEL: local_singlethread_monotonic_store:
842 ; GFX6: ; %bb.0: ; %entry
843 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
844 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
845 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
846 ; GFX6-NEXT: s_mov_b32 m0, -1
847 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
848 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
849 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
850 ; GFX6-NEXT: ds_write_b32 v0, v1
851 ; GFX6-NEXT: s_endpgm
853 ; GFX7-LABEL: local_singlethread_monotonic_store:
854 ; GFX7: ; %bb.0: ; %entry
855 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
856 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
857 ; GFX7-NEXT: s_mov_b32 m0, -1
858 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
859 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
860 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
861 ; GFX7-NEXT: ds_write_b32 v0, v1
862 ; GFX7-NEXT: s_endpgm
864 ; GFX10-WGP-LABEL: local_singlethread_monotonic_store:
865 ; GFX10-WGP: ; %bb.0: ; %entry
866 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
867 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
868 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
869 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
870 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
871 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
872 ; GFX10-WGP-NEXT: s_endpgm
874 ; GFX10-CU-LABEL: local_singlethread_monotonic_store:
875 ; GFX10-CU: ; %bb.0: ; %entry
876 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
877 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
878 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
879 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
880 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
881 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
882 ; GFX10-CU-NEXT: s_endpgm
884 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_store:
885 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
886 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
887 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
888 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
889 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
890 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
891 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
892 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
893 ; SKIP-CACHE-INV-NEXT: s_endpgm
895 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_store:
896 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
897 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
898 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
899 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
900 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
901 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
902 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
903 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
905 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_store:
906 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
907 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
908 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
909 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
910 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
911 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
912 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
913 ; GFX90A-TGSPLIT-NEXT: s_endpgm
915 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_monotonic_store:
916 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
917 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
918 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
919 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
920 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
921 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
922 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
923 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
925 ; GFX940-TGSPLIT-LABEL: local_singlethread_monotonic_store:
926 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
927 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
928 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
929 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
930 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
931 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
932 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
933 ; GFX940-TGSPLIT-NEXT: s_endpgm
935 ; GFX11-WGP-LABEL: local_singlethread_monotonic_store:
936 ; GFX11-WGP: ; %bb.0: ; %entry
937 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
938 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
939 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
940 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
941 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
942 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
943 ; GFX11-WGP-NEXT: s_endpgm
945 ; GFX11-CU-LABEL: local_singlethread_monotonic_store:
946 ; GFX11-CU: ; %bb.0: ; %entry
947 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
948 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
949 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
950 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
951 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
952 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
953 ; GFX11-CU-NEXT: s_endpgm
955 ; GFX12-WGP-LABEL: local_singlethread_monotonic_store:
956 ; GFX12-WGP: ; %bb.0: ; %entry
957 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
958 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
959 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
960 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
961 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
962 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
963 ; GFX12-WGP-NEXT: s_endpgm
965 ; GFX12-CU-LABEL: local_singlethread_monotonic_store:
966 ; GFX12-CU: ; %bb.0: ; %entry
967 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
968 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
969 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
970 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
971 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
972 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
973 ; GFX12-CU-NEXT: s_endpgm
974 i32 %in, ptr addrspace(3) %out) {
976 store atomic i32 %in, ptr addrspace(3) %out syncscope("singlethread") monotonic, align 4
980 define amdgpu_kernel void @local_singlethread_release_store(
981 ; GFX6-LABEL: local_singlethread_release_store:
982 ; GFX6: ; %bb.0: ; %entry
983 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
984 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
985 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
986 ; GFX6-NEXT: s_mov_b32 m0, -1
987 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
988 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
989 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
990 ; GFX6-NEXT: ds_write_b32 v0, v1
991 ; GFX6-NEXT: s_endpgm
993 ; GFX7-LABEL: local_singlethread_release_store:
994 ; GFX7: ; %bb.0: ; %entry
995 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
996 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
997 ; GFX7-NEXT: s_mov_b32 m0, -1
998 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
999 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
1000 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
1001 ; GFX7-NEXT: ds_write_b32 v0, v1
1002 ; GFX7-NEXT: s_endpgm
1004 ; GFX10-WGP-LABEL: local_singlethread_release_store:
1005 ; GFX10-WGP: ; %bb.0: ; %entry
1006 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
1007 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
1008 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1009 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
1010 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
1011 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
1012 ; GFX10-WGP-NEXT: s_endpgm
1014 ; GFX10-CU-LABEL: local_singlethread_release_store:
1015 ; GFX10-CU: ; %bb.0: ; %entry
1016 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
1017 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
1018 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1019 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
1020 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
1021 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
1022 ; GFX10-CU-NEXT: s_endpgm
1024 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_store:
1025 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1026 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
1027 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
1028 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1029 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1030 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
1031 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1032 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
1033 ; SKIP-CACHE-INV-NEXT: s_endpgm
1035 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_store:
1036 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1037 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
1038 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
1039 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1040 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1041 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1042 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1043 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1045 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_store:
1046 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1047 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
1048 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
1049 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1050 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1051 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1052 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
1053 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1055 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_release_store:
1056 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1057 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
1058 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
1059 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1060 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1061 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1062 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1063 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1065 ; GFX940-TGSPLIT-LABEL: local_singlethread_release_store:
1066 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1067 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
1068 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
1069 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1070 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1071 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1072 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
1073 ; GFX940-TGSPLIT-NEXT: s_endpgm
1075 ; GFX11-WGP-LABEL: local_singlethread_release_store:
1076 ; GFX11-WGP: ; %bb.0: ; %entry
1077 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
1078 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
1079 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1080 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
1081 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
1082 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
1083 ; GFX11-WGP-NEXT: s_endpgm
1085 ; GFX11-CU-LABEL: local_singlethread_release_store:
1086 ; GFX11-CU: ; %bb.0: ; %entry
1087 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
1088 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
1089 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1090 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
1091 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
1092 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
1093 ; GFX11-CU-NEXT: s_endpgm
1095 ; GFX12-WGP-LABEL: local_singlethread_release_store:
1096 ; GFX12-WGP: ; %bb.0: ; %entry
1097 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
1098 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
1099 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1100 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
1101 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
1102 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
1103 ; GFX12-WGP-NEXT: s_endpgm
1105 ; GFX12-CU-LABEL: local_singlethread_release_store:
1106 ; GFX12-CU: ; %bb.0: ; %entry
1107 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
1108 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
1109 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1110 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
1111 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
1112 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
1113 ; GFX12-CU-NEXT: s_endpgm
1114 i32 %in, ptr addrspace(3) %out) {
1116 store atomic i32 %in, ptr addrspace(3) %out syncscope("singlethread") release, align 4
1120 define amdgpu_kernel void @local_singlethread_seq_cst_store(
1121 ; GFX6-LABEL: local_singlethread_seq_cst_store:
1122 ; GFX6: ; %bb.0: ; %entry
1123 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
1124 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
1125 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
1126 ; GFX6-NEXT: s_mov_b32 m0, -1
1127 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1128 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
1129 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
1130 ; GFX6-NEXT: ds_write_b32 v0, v1
1131 ; GFX6-NEXT: s_endpgm
1133 ; GFX7-LABEL: local_singlethread_seq_cst_store:
1134 ; GFX7: ; %bb.0: ; %entry
1135 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
1136 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
1137 ; GFX7-NEXT: s_mov_b32 m0, -1
1138 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1139 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
1140 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
1141 ; GFX7-NEXT: ds_write_b32 v0, v1
1142 ; GFX7-NEXT: s_endpgm
1144 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_store:
1145 ; GFX10-WGP: ; %bb.0: ; %entry
1146 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
1147 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
1148 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1149 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
1150 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
1151 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
1152 ; GFX10-WGP-NEXT: s_endpgm
1154 ; GFX10-CU-LABEL: local_singlethread_seq_cst_store:
1155 ; GFX10-CU: ; %bb.0: ; %entry
1156 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
1157 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
1158 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1159 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
1160 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
1161 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
1162 ; GFX10-CU-NEXT: s_endpgm
1164 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_store:
1165 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1166 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
1167 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
1168 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1169 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1170 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
1171 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1172 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
1173 ; SKIP-CACHE-INV-NEXT: s_endpgm
1175 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_store:
1176 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1177 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
1178 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
1179 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1180 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1181 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1182 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1183 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1185 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_store:
1186 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1187 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
1188 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
1189 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1190 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1191 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1192 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
1193 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1195 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_store:
1196 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1197 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
1198 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
1199 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1200 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1201 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1202 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
1203 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1205 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_store:
1206 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1207 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
1208 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
1209 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1210 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1211 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1212 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
1213 ; GFX940-TGSPLIT-NEXT: s_endpgm
1215 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_store:
1216 ; GFX11-WGP: ; %bb.0: ; %entry
1217 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
1218 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
1219 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1220 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
1221 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
1222 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
1223 ; GFX11-WGP-NEXT: s_endpgm
1225 ; GFX11-CU-LABEL: local_singlethread_seq_cst_store:
1226 ; GFX11-CU: ; %bb.0: ; %entry
1227 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
1228 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
1229 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1230 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
1231 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
1232 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
1233 ; GFX11-CU-NEXT: s_endpgm
1235 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_store:
1236 ; GFX12-WGP: ; %bb.0: ; %entry
1237 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
1238 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
1239 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1240 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
1241 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
1242 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
1243 ; GFX12-WGP-NEXT: s_endpgm
1245 ; GFX12-CU-LABEL: local_singlethread_seq_cst_store:
1246 ; GFX12-CU: ; %bb.0: ; %entry
1247 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
1248 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
1249 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1250 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
1251 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
1252 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
1253 ; GFX12-CU-NEXT: s_endpgm
1254 i32 %in, ptr addrspace(3) %out) {
1256 store atomic i32 %in, ptr addrspace(3) %out syncscope("singlethread") seq_cst, align 4
1260 define amdgpu_kernel void @local_singlethread_monotonic_atomicrmw(
1261 ; GFX6-LABEL: local_singlethread_monotonic_atomicrmw:
1262 ; GFX6: ; %bb.0: ; %entry
1263 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
1264 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
1265 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
1266 ; GFX6-NEXT: s_mov_b32 m0, -1
1267 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1268 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
1269 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
1270 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1271 ; GFX6-NEXT: s_endpgm
1273 ; GFX7-LABEL: local_singlethread_monotonic_atomicrmw:
1274 ; GFX7: ; %bb.0: ; %entry
1275 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
1276 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
1277 ; GFX7-NEXT: s_mov_b32 m0, -1
1278 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1279 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
1280 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
1281 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1282 ; GFX7-NEXT: s_endpgm
1284 ; GFX10-WGP-LABEL: local_singlethread_monotonic_atomicrmw:
1285 ; GFX10-WGP: ; %bb.0: ; %entry
1286 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
1287 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
1288 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1289 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
1290 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
1291 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1292 ; GFX10-WGP-NEXT: s_endpgm
1294 ; GFX10-CU-LABEL: local_singlethread_monotonic_atomicrmw:
1295 ; GFX10-CU: ; %bb.0: ; %entry
1296 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
1297 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
1298 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1299 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
1300 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
1301 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1302 ; GFX10-CU-NEXT: s_endpgm
1304 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_atomicrmw:
1305 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1306 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
1307 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
1308 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1309 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1310 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
1311 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1312 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1313 ; SKIP-CACHE-INV-NEXT: s_endpgm
1315 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_atomicrmw:
1316 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1317 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1318 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1319 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1320 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1321 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1322 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1323 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1325 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_atomicrmw:
1326 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1327 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1328 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1329 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1330 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1331 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1332 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1333 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1335 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_monotonic_atomicrmw:
1336 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1337 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1338 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1339 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1340 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1341 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1342 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1343 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1345 ; GFX940-TGSPLIT-LABEL: local_singlethread_monotonic_atomicrmw:
1346 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1347 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1348 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1349 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1350 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1351 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1352 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1353 ; GFX940-TGSPLIT-NEXT: s_endpgm
1355 ; GFX11-WGP-LABEL: local_singlethread_monotonic_atomicrmw:
1356 ; GFX11-WGP: ; %bb.0: ; %entry
1357 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1358 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1359 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1360 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
1361 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
1362 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1363 ; GFX11-WGP-NEXT: s_endpgm
1365 ; GFX11-CU-LABEL: local_singlethread_monotonic_atomicrmw:
1366 ; GFX11-CU: ; %bb.0: ; %entry
1367 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1368 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1369 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1370 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
1371 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
1372 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1373 ; GFX11-CU-NEXT: s_endpgm
1375 ; GFX12-WGP-LABEL: local_singlethread_monotonic_atomicrmw:
1376 ; GFX12-WGP: ; %bb.0: ; %entry
1377 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1378 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1379 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1380 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
1381 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
1382 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1383 ; GFX12-WGP-NEXT: s_endpgm
1385 ; GFX12-CU-LABEL: local_singlethread_monotonic_atomicrmw:
1386 ; GFX12-CU: ; %bb.0: ; %entry
1387 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1388 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1389 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1390 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
1391 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
1392 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1393 ; GFX12-CU-NEXT: s_endpgm
1394 ptr addrspace(3) %out, i32 %in) {
1396 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread") monotonic
1400 define amdgpu_kernel void @local_singlethread_acquire_atomicrmw(
1401 ; GFX6-LABEL: local_singlethread_acquire_atomicrmw:
1402 ; GFX6: ; %bb.0: ; %entry
1403 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
1404 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
1405 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
1406 ; GFX6-NEXT: s_mov_b32 m0, -1
1407 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1408 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
1409 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
1410 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1411 ; GFX6-NEXT: s_endpgm
1413 ; GFX7-LABEL: local_singlethread_acquire_atomicrmw:
1414 ; GFX7: ; %bb.0: ; %entry
1415 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
1416 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
1417 ; GFX7-NEXT: s_mov_b32 m0, -1
1418 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1419 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
1420 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
1421 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1422 ; GFX7-NEXT: s_endpgm
1424 ; GFX10-WGP-LABEL: local_singlethread_acquire_atomicrmw:
1425 ; GFX10-WGP: ; %bb.0: ; %entry
1426 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
1427 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
1428 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1429 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
1430 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
1431 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1432 ; GFX10-WGP-NEXT: s_endpgm
1434 ; GFX10-CU-LABEL: local_singlethread_acquire_atomicrmw:
1435 ; GFX10-CU: ; %bb.0: ; %entry
1436 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
1437 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
1438 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1439 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
1440 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
1441 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1442 ; GFX10-CU-NEXT: s_endpgm
1444 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_atomicrmw:
1445 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1446 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
1447 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
1448 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1449 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1450 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
1451 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1452 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1453 ; SKIP-CACHE-INV-NEXT: s_endpgm
1455 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_atomicrmw:
1456 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1457 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1458 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1459 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1460 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1461 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1462 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1463 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1465 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_atomicrmw:
1466 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1467 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1468 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1469 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1470 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1471 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1472 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1473 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1475 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acquire_atomicrmw:
1476 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1477 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1478 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1479 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1480 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1481 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1482 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1483 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1485 ; GFX940-TGSPLIT-LABEL: local_singlethread_acquire_atomicrmw:
1486 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1487 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1488 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1489 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1490 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1491 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1492 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1493 ; GFX940-TGSPLIT-NEXT: s_endpgm
1495 ; GFX11-WGP-LABEL: local_singlethread_acquire_atomicrmw:
1496 ; GFX11-WGP: ; %bb.0: ; %entry
1497 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1498 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1499 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1500 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
1501 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
1502 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1503 ; GFX11-WGP-NEXT: s_endpgm
1505 ; GFX11-CU-LABEL: local_singlethread_acquire_atomicrmw:
1506 ; GFX11-CU: ; %bb.0: ; %entry
1507 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1508 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1509 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1510 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
1511 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
1512 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1513 ; GFX11-CU-NEXT: s_endpgm
1515 ; GFX12-WGP-LABEL: local_singlethread_acquire_atomicrmw:
1516 ; GFX12-WGP: ; %bb.0: ; %entry
1517 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1518 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1519 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1520 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
1521 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
1522 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1523 ; GFX12-WGP-NEXT: s_endpgm
1525 ; GFX12-CU-LABEL: local_singlethread_acquire_atomicrmw:
1526 ; GFX12-CU: ; %bb.0: ; %entry
1527 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1528 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1529 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1530 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
1531 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
1532 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1533 ; GFX12-CU-NEXT: s_endpgm
1534 ptr addrspace(3) %out, i32 %in) {
1536 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread") acquire
1540 define amdgpu_kernel void @local_singlethread_release_atomicrmw(
1541 ; GFX6-LABEL: local_singlethread_release_atomicrmw:
1542 ; GFX6: ; %bb.0: ; %entry
1543 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
1544 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
1545 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
1546 ; GFX6-NEXT: s_mov_b32 m0, -1
1547 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1548 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
1549 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
1550 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1551 ; GFX6-NEXT: s_endpgm
1553 ; GFX7-LABEL: local_singlethread_release_atomicrmw:
1554 ; GFX7: ; %bb.0: ; %entry
1555 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
1556 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
1557 ; GFX7-NEXT: s_mov_b32 m0, -1
1558 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1559 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
1560 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
1561 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1562 ; GFX7-NEXT: s_endpgm
1564 ; GFX10-WGP-LABEL: local_singlethread_release_atomicrmw:
1565 ; GFX10-WGP: ; %bb.0: ; %entry
1566 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
1567 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
1568 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1569 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
1570 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
1571 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1572 ; GFX10-WGP-NEXT: s_endpgm
1574 ; GFX10-CU-LABEL: local_singlethread_release_atomicrmw:
1575 ; GFX10-CU: ; %bb.0: ; %entry
1576 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
1577 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
1578 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1579 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
1580 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
1581 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1582 ; GFX10-CU-NEXT: s_endpgm
1584 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_atomicrmw:
1585 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1586 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
1587 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
1588 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1589 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1590 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
1591 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1592 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1593 ; SKIP-CACHE-INV-NEXT: s_endpgm
1595 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_atomicrmw:
1596 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1597 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1598 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1599 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1600 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1601 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1602 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1603 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1605 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_atomicrmw:
1606 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1607 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1608 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1609 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1610 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1611 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1612 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1613 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1615 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_release_atomicrmw:
1616 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1617 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1618 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1619 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1620 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1621 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1622 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1623 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1625 ; GFX940-TGSPLIT-LABEL: local_singlethread_release_atomicrmw:
1626 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1627 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1628 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1629 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1630 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1631 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1632 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1633 ; GFX940-TGSPLIT-NEXT: s_endpgm
1635 ; GFX11-WGP-LABEL: local_singlethread_release_atomicrmw:
1636 ; GFX11-WGP: ; %bb.0: ; %entry
1637 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1638 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1639 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1640 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
1641 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
1642 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1643 ; GFX11-WGP-NEXT: s_endpgm
1645 ; GFX11-CU-LABEL: local_singlethread_release_atomicrmw:
1646 ; GFX11-CU: ; %bb.0: ; %entry
1647 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1648 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1649 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1650 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
1651 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
1652 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1653 ; GFX11-CU-NEXT: s_endpgm
1655 ; GFX12-WGP-LABEL: local_singlethread_release_atomicrmw:
1656 ; GFX12-WGP: ; %bb.0: ; %entry
1657 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1658 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1659 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1660 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
1661 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
1662 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1663 ; GFX12-WGP-NEXT: s_endpgm
1665 ; GFX12-CU-LABEL: local_singlethread_release_atomicrmw:
1666 ; GFX12-CU: ; %bb.0: ; %entry
1667 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1668 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1669 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1670 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
1671 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
1672 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1673 ; GFX12-CU-NEXT: s_endpgm
1674 ptr addrspace(3) %out, i32 %in) {
1676 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread") release
1680 define amdgpu_kernel void @local_singlethread_acq_rel_atomicrmw(
1681 ; GFX6-LABEL: local_singlethread_acq_rel_atomicrmw:
1682 ; GFX6: ; %bb.0: ; %entry
1683 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
1684 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
1685 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
1686 ; GFX6-NEXT: s_mov_b32 m0, -1
1687 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1688 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
1689 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
1690 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1691 ; GFX6-NEXT: s_endpgm
1693 ; GFX7-LABEL: local_singlethread_acq_rel_atomicrmw:
1694 ; GFX7: ; %bb.0: ; %entry
1695 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
1696 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
1697 ; GFX7-NEXT: s_mov_b32 m0, -1
1698 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1699 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
1700 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
1701 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1702 ; GFX7-NEXT: s_endpgm
1704 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_atomicrmw:
1705 ; GFX10-WGP: ; %bb.0: ; %entry
1706 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
1707 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
1708 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1709 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
1710 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
1711 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1712 ; GFX10-WGP-NEXT: s_endpgm
1714 ; GFX10-CU-LABEL: local_singlethread_acq_rel_atomicrmw:
1715 ; GFX10-CU: ; %bb.0: ; %entry
1716 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
1717 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
1718 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1719 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
1720 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
1721 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1722 ; GFX10-CU-NEXT: s_endpgm
1724 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_atomicrmw:
1725 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1726 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
1727 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
1728 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1729 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1730 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
1731 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1732 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1733 ; SKIP-CACHE-INV-NEXT: s_endpgm
1735 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_atomicrmw:
1736 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1737 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1738 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1739 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1740 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1741 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1742 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1743 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1745 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_atomicrmw:
1746 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1747 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1748 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1749 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1750 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1751 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1752 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1753 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1755 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_atomicrmw:
1756 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1757 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1758 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1759 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1760 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1761 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1762 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1763 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1765 ; GFX940-TGSPLIT-LABEL: local_singlethread_acq_rel_atomicrmw:
1766 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1767 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1768 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1769 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1770 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1771 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1772 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1773 ; GFX940-TGSPLIT-NEXT: s_endpgm
1775 ; GFX11-WGP-LABEL: local_singlethread_acq_rel_atomicrmw:
1776 ; GFX11-WGP: ; %bb.0: ; %entry
1777 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1778 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1779 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1780 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
1781 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
1782 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1783 ; GFX11-WGP-NEXT: s_endpgm
1785 ; GFX11-CU-LABEL: local_singlethread_acq_rel_atomicrmw:
1786 ; GFX11-CU: ; %bb.0: ; %entry
1787 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1788 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1789 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1790 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
1791 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
1792 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1793 ; GFX11-CU-NEXT: s_endpgm
1795 ; GFX12-WGP-LABEL: local_singlethread_acq_rel_atomicrmw:
1796 ; GFX12-WGP: ; %bb.0: ; %entry
1797 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1798 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1799 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1800 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
1801 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
1802 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1803 ; GFX12-WGP-NEXT: s_endpgm
1805 ; GFX12-CU-LABEL: local_singlethread_acq_rel_atomicrmw:
1806 ; GFX12-CU: ; %bb.0: ; %entry
1807 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1808 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1809 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1810 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
1811 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
1812 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1813 ; GFX12-CU-NEXT: s_endpgm
1814 ptr addrspace(3) %out, i32 %in) {
1816 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread") acq_rel
1820 define amdgpu_kernel void @local_singlethread_seq_cst_atomicrmw(
1821 ; GFX6-LABEL: local_singlethread_seq_cst_atomicrmw:
1822 ; GFX6: ; %bb.0: ; %entry
1823 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
1824 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
1825 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
1826 ; GFX6-NEXT: s_mov_b32 m0, -1
1827 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1828 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
1829 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
1830 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1831 ; GFX6-NEXT: s_endpgm
1833 ; GFX7-LABEL: local_singlethread_seq_cst_atomicrmw:
1834 ; GFX7: ; %bb.0: ; %entry
1835 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
1836 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
1837 ; GFX7-NEXT: s_mov_b32 m0, -1
1838 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1839 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
1840 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
1841 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1842 ; GFX7-NEXT: s_endpgm
1844 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_atomicrmw:
1845 ; GFX10-WGP: ; %bb.0: ; %entry
1846 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
1847 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
1848 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1849 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
1850 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
1851 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1852 ; GFX10-WGP-NEXT: s_endpgm
1854 ; GFX10-CU-LABEL: local_singlethread_seq_cst_atomicrmw:
1855 ; GFX10-CU: ; %bb.0: ; %entry
1856 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
1857 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
1858 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
1859 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
1860 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
1861 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1862 ; GFX10-CU-NEXT: s_endpgm
1864 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_atomicrmw:
1865 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
1866 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
1867 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
1868 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
1869 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
1870 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
1871 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
1872 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1873 ; SKIP-CACHE-INV-NEXT: s_endpgm
1875 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_atomicrmw:
1876 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
1877 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1878 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1879 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1880 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1881 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1882 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1883 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
1885 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_atomicrmw:
1886 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
1887 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
1888 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
1889 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1890 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
1891 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
1892 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1893 ; GFX90A-TGSPLIT-NEXT: s_endpgm
1895 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_atomicrmw:
1896 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
1897 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1898 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1899 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1900 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1901 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1902 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1903 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
1905 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_atomicrmw:
1906 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
1907 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
1908 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
1909 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
1910 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
1911 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
1912 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
1913 ; GFX940-TGSPLIT-NEXT: s_endpgm
1915 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_atomicrmw:
1916 ; GFX11-WGP: ; %bb.0: ; %entry
1917 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1918 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1919 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
1920 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
1921 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
1922 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1923 ; GFX11-WGP-NEXT: s_endpgm
1925 ; GFX11-CU-LABEL: local_singlethread_seq_cst_atomicrmw:
1926 ; GFX11-CU: ; %bb.0: ; %entry
1927 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1928 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1929 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
1930 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
1931 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
1932 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1933 ; GFX11-CU-NEXT: s_endpgm
1935 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_atomicrmw:
1936 ; GFX12-WGP: ; %bb.0: ; %entry
1937 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
1938 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
1939 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
1940 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
1941 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
1942 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1943 ; GFX12-WGP-NEXT: s_endpgm
1945 ; GFX12-CU-LABEL: local_singlethread_seq_cst_atomicrmw:
1946 ; GFX12-CU: ; %bb.0: ; %entry
1947 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
1948 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
1949 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
1950 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
1951 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
1952 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
1953 ; GFX12-CU-NEXT: s_endpgm
1954 ptr addrspace(3) %out, i32 %in) {
1956 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread") seq_cst
1960 define amdgpu_kernel void @local_singlethread_acquire_ret_atomicrmw(
1961 ; GFX6-LABEL: local_singlethread_acquire_ret_atomicrmw:
1962 ; GFX6: ; %bb.0: ; %entry
1963 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
1964 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
1965 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
1966 ; GFX6-NEXT: s_mov_b32 m0, -1
1967 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1968 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
1969 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
1970 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1971 ; GFX6-NEXT: s_mov_b32 m0, -1
1972 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
1973 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
1974 ; GFX6-NEXT: ds_write_b32 v0, v1
1975 ; GFX6-NEXT: s_endpgm
1977 ; GFX7-LABEL: local_singlethread_acquire_ret_atomicrmw:
1978 ; GFX7: ; %bb.0: ; %entry
1979 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
1980 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
1981 ; GFX7-NEXT: s_mov_b32 m0, -1
1982 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1983 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
1984 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
1985 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
1986 ; GFX7-NEXT: s_mov_b32 m0, -1
1987 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
1988 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
1989 ; GFX7-NEXT: ds_write_b32 v0, v1
1990 ; GFX7-NEXT: s_endpgm
1992 ; GFX10-WGP-LABEL: local_singlethread_acquire_ret_atomicrmw:
1993 ; GFX10-WGP: ; %bb.0: ; %entry
1994 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
1995 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
1996 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
1997 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
1998 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
1999 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2000 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
2001 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2002 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
2003 ; GFX10-WGP-NEXT: s_endpgm
2005 ; GFX10-CU-LABEL: local_singlethread_acquire_ret_atomicrmw:
2006 ; GFX10-CU: ; %bb.0: ; %entry
2007 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
2008 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
2009 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2010 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
2011 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
2012 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2013 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
2014 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2015 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
2016 ; GFX10-CU-NEXT: s_endpgm
2018 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_ret_atomicrmw:
2019 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2020 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
2021 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
2022 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2023 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2024 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2025 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2026 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2027 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2028 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2029 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2030 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
2031 ; SKIP-CACHE-INV-NEXT: s_endpgm
2033 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_ret_atomicrmw:
2034 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2035 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
2036 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
2037 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2038 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2039 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2040 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2041 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2042 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2043 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2044 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2046 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_ret_atomicrmw:
2047 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2048 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
2049 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
2050 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2051 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2052 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2053 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2054 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2055 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2056 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
2057 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2059 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acquire_ret_atomicrmw:
2060 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2061 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
2062 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
2063 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2064 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2065 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2066 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2067 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2068 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2069 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2070 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2072 ; GFX940-TGSPLIT-LABEL: local_singlethread_acquire_ret_atomicrmw:
2073 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2074 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
2075 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
2076 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2077 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2078 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2079 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2080 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2081 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2082 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
2083 ; GFX940-TGSPLIT-NEXT: s_endpgm
2085 ; GFX11-WGP-LABEL: local_singlethread_acquire_ret_atomicrmw:
2086 ; GFX11-WGP: ; %bb.0: ; %entry
2087 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
2088 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
2089 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2090 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
2091 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
2092 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2093 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
2094 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2095 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
2096 ; GFX11-WGP-NEXT: s_endpgm
2098 ; GFX11-CU-LABEL: local_singlethread_acquire_ret_atomicrmw:
2099 ; GFX11-CU: ; %bb.0: ; %entry
2100 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
2101 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
2102 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2103 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
2104 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
2105 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2106 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
2107 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2108 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
2109 ; GFX11-CU-NEXT: s_endpgm
2111 ; GFX12-WGP-LABEL: local_singlethread_acquire_ret_atomicrmw:
2112 ; GFX12-WGP: ; %bb.0: ; %entry
2113 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
2114 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
2115 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2116 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
2117 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
2118 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2119 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
2120 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
2121 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
2122 ; GFX12-WGP-NEXT: s_endpgm
2124 ; GFX12-CU-LABEL: local_singlethread_acquire_ret_atomicrmw:
2125 ; GFX12-CU: ; %bb.0: ; %entry
2126 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
2127 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
2128 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2129 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
2130 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
2131 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2132 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
2133 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
2134 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
2135 ; GFX12-CU-NEXT: s_endpgm
2136 ptr addrspace(3) %out, i32 %in) {
2138 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread") acquire
2139 store i32 %val, ptr addrspace(3) %out, align 4
2143 define amdgpu_kernel void @local_singlethread_acq_rel_ret_atomicrmw(
2144 ; GFX6-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2145 ; GFX6: ; %bb.0: ; %entry
2146 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
2147 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
2148 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
2149 ; GFX6-NEXT: s_mov_b32 m0, -1
2150 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2151 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
2152 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
2153 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2154 ; GFX6-NEXT: s_mov_b32 m0, -1
2155 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
2156 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2157 ; GFX6-NEXT: ds_write_b32 v0, v1
2158 ; GFX6-NEXT: s_endpgm
2160 ; GFX7-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2161 ; GFX7: ; %bb.0: ; %entry
2162 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
2163 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
2164 ; GFX7-NEXT: s_mov_b32 m0, -1
2165 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2166 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
2167 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
2168 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2169 ; GFX7-NEXT: s_mov_b32 m0, -1
2170 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
2171 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2172 ; GFX7-NEXT: ds_write_b32 v0, v1
2173 ; GFX7-NEXT: s_endpgm
2175 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2176 ; GFX10-WGP: ; %bb.0: ; %entry
2177 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
2178 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
2179 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2180 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
2181 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
2182 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2183 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
2184 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2185 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
2186 ; GFX10-WGP-NEXT: s_endpgm
2188 ; GFX10-CU-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2189 ; GFX10-CU: ; %bb.0: ; %entry
2190 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
2191 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
2192 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2193 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
2194 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
2195 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2196 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
2197 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2198 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
2199 ; GFX10-CU-NEXT: s_endpgm
2201 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2202 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2203 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
2204 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
2205 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2206 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2207 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2208 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2209 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2210 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2211 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2212 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2213 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
2214 ; SKIP-CACHE-INV-NEXT: s_endpgm
2216 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2217 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2218 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
2219 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
2220 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2221 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2222 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2223 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2224 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2225 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2226 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2227 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2229 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2230 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2231 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
2232 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
2233 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2234 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2235 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2236 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2237 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2238 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2239 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
2240 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2242 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2243 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2244 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
2245 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
2246 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2247 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2248 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2249 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2250 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2251 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2252 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2253 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2255 ; GFX940-TGSPLIT-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2256 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2257 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
2258 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
2259 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2260 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2261 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2262 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2263 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2264 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2265 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
2266 ; GFX940-TGSPLIT-NEXT: s_endpgm
2268 ; GFX11-WGP-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2269 ; GFX11-WGP: ; %bb.0: ; %entry
2270 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
2271 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
2272 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2273 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
2274 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
2275 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2276 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
2277 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2278 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
2279 ; GFX11-WGP-NEXT: s_endpgm
2281 ; GFX11-CU-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2282 ; GFX11-CU: ; %bb.0: ; %entry
2283 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
2284 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
2285 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2286 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
2287 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
2288 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2289 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
2290 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2291 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
2292 ; GFX11-CU-NEXT: s_endpgm
2294 ; GFX12-WGP-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2295 ; GFX12-WGP: ; %bb.0: ; %entry
2296 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
2297 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
2298 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2299 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
2300 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
2301 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2302 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
2303 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
2304 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
2305 ; GFX12-WGP-NEXT: s_endpgm
2307 ; GFX12-CU-LABEL: local_singlethread_acq_rel_ret_atomicrmw:
2308 ; GFX12-CU: ; %bb.0: ; %entry
2309 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
2310 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
2311 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2312 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
2313 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
2314 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2315 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
2316 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
2317 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
2318 ; GFX12-CU-NEXT: s_endpgm
2319 ptr addrspace(3) %out, i32 %in) {
2321 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread") acq_rel
2322 store i32 %val, ptr addrspace(3) %out, align 4
2326 define amdgpu_kernel void @local_singlethread_seq_cst_ret_atomicrmw(
2327 ; GFX6-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2328 ; GFX6: ; %bb.0: ; %entry
2329 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
2330 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
2331 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
2332 ; GFX6-NEXT: s_mov_b32 m0, -1
2333 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2334 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
2335 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
2336 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2337 ; GFX6-NEXT: s_mov_b32 m0, -1
2338 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
2339 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2340 ; GFX6-NEXT: ds_write_b32 v0, v1
2341 ; GFX6-NEXT: s_endpgm
2343 ; GFX7-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2344 ; GFX7: ; %bb.0: ; %entry
2345 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
2346 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
2347 ; GFX7-NEXT: s_mov_b32 m0, -1
2348 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2349 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
2350 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
2351 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2352 ; GFX7-NEXT: s_mov_b32 m0, -1
2353 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
2354 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2355 ; GFX7-NEXT: ds_write_b32 v0, v1
2356 ; GFX7-NEXT: s_endpgm
2358 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2359 ; GFX10-WGP: ; %bb.0: ; %entry
2360 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
2361 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
2362 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2363 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
2364 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
2365 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2366 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
2367 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2368 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
2369 ; GFX10-WGP-NEXT: s_endpgm
2371 ; GFX10-CU-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2372 ; GFX10-CU: ; %bb.0: ; %entry
2373 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
2374 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
2375 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2376 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
2377 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
2378 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2379 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
2380 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2381 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
2382 ; GFX10-CU-NEXT: s_endpgm
2384 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2385 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2386 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
2387 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
2388 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2389 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2390 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2391 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2392 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2393 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2394 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
2395 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2396 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
2397 ; SKIP-CACHE-INV-NEXT: s_endpgm
2399 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2400 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2401 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
2402 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
2403 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2404 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2405 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2406 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2407 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2408 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2409 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2410 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2412 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2413 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2414 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
2415 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
2416 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2417 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2418 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2419 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2420 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
2421 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2422 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
2423 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2425 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2426 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2427 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
2428 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
2429 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2430 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2431 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2432 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2433 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2434 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2435 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
2436 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2438 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2439 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2440 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
2441 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
2442 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2443 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2444 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2445 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
2446 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
2447 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2448 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
2449 ; GFX940-TGSPLIT-NEXT: s_endpgm
2451 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2452 ; GFX11-WGP: ; %bb.0: ; %entry
2453 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
2454 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
2455 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2456 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
2457 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
2458 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2459 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
2460 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2461 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
2462 ; GFX11-WGP-NEXT: s_endpgm
2464 ; GFX11-CU-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2465 ; GFX11-CU: ; %bb.0: ; %entry
2466 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
2467 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
2468 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2469 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
2470 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
2471 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2472 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
2473 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2474 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
2475 ; GFX11-CU-NEXT: s_endpgm
2477 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2478 ; GFX12-WGP: ; %bb.0: ; %entry
2479 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
2480 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
2481 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2482 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
2483 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
2484 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2485 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
2486 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
2487 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
2488 ; GFX12-WGP-NEXT: s_endpgm
2490 ; GFX12-CU-LABEL: local_singlethread_seq_cst_ret_atomicrmw:
2491 ; GFX12-CU: ; %bb.0: ; %entry
2492 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
2493 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
2494 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2495 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
2496 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
2497 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
2498 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
2499 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
2500 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
2501 ; GFX12-CU-NEXT: s_endpgm
2502 ptr addrspace(3) %out, i32 %in) {
2504 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread") seq_cst
2505 store i32 %val, ptr addrspace(3) %out, align 4
2509 define amdgpu_kernel void @local_singlethread_monotonic_monotonic_cmpxchg(
2510 ; GFX6-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2511 ; GFX6: ; %bb.0: ; %entry
2512 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
2513 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
2514 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
2515 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
2516 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
2517 ; GFX6-NEXT: s_mov_b32 m0, -1
2518 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2519 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
2520 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
2521 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
2522 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2523 ; GFX6-NEXT: s_endpgm
2525 ; GFX7-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2526 ; GFX7: ; %bb.0: ; %entry
2527 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
2528 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
2529 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
2530 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
2531 ; GFX7-NEXT: s_mov_b32 m0, -1
2532 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2533 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
2534 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
2535 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
2536 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2537 ; GFX7-NEXT: s_endpgm
2539 ; GFX10-WGP-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2540 ; GFX10-WGP: ; %bb.0: ; %entry
2541 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
2542 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
2543 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
2544 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
2545 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2546 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
2547 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
2548 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
2549 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2550 ; GFX10-WGP-NEXT: s_endpgm
2552 ; GFX10-CU-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2553 ; GFX10-CU: ; %bb.0: ; %entry
2554 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
2555 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
2556 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
2557 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
2558 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2559 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
2560 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
2561 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
2562 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2563 ; GFX10-CU-NEXT: s_endpgm
2565 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2566 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2567 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
2568 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
2569 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
2570 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
2571 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2572 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2573 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2574 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2575 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
2576 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2577 ; SKIP-CACHE-INV-NEXT: s_endpgm
2579 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2580 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2581 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
2582 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
2583 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
2584 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
2585 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2586 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
2587 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2588 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2589 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2590 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2592 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2593 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2594 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
2595 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
2596 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
2597 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
2598 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2599 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
2600 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2601 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2602 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2603 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2605 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2606 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2607 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
2608 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
2609 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
2610 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
2611 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2612 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
2613 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2614 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
2615 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2616 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2618 ; GFX940-TGSPLIT-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2619 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2620 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
2621 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
2622 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
2623 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
2624 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2625 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
2626 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2627 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
2628 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2629 ; GFX940-TGSPLIT-NEXT: s_endpgm
2631 ; GFX11-WGP-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2632 ; GFX11-WGP: ; %bb.0: ; %entry
2633 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
2634 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
2635 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
2636 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
2637 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2638 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
2639 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
2640 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
2641 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2642 ; GFX11-WGP-NEXT: s_endpgm
2644 ; GFX11-CU-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2645 ; GFX11-CU: ; %bb.0: ; %entry
2646 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
2647 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
2648 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
2649 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
2650 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2651 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
2652 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
2653 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
2654 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2655 ; GFX11-CU-NEXT: s_endpgm
2657 ; GFX12-WGP-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2658 ; GFX12-WGP: ; %bb.0: ; %entry
2659 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
2660 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
2661 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
2662 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
2663 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2664 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
2665 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
2666 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
2667 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2668 ; GFX12-WGP-NEXT: s_endpgm
2670 ; GFX12-CU-LABEL: local_singlethread_monotonic_monotonic_cmpxchg:
2671 ; GFX12-CU: ; %bb.0: ; %entry
2672 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
2673 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
2674 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
2675 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
2676 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2677 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
2678 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
2679 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
2680 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2681 ; GFX12-CU-NEXT: s_endpgm
2682 ptr addrspace(3) %out, i32 %in, i32 %old) {
2684 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2685 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic monotonic
2689 define amdgpu_kernel void @local_singlethread_acquire_monotonic_cmpxchg(
2690 ; GFX6-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2691 ; GFX6: ; %bb.0: ; %entry
2692 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
2693 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
2694 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
2695 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
2696 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
2697 ; GFX6-NEXT: s_mov_b32 m0, -1
2698 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2699 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
2700 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
2701 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
2702 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2703 ; GFX6-NEXT: s_endpgm
2705 ; GFX7-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2706 ; GFX7: ; %bb.0: ; %entry
2707 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
2708 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
2709 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
2710 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
2711 ; GFX7-NEXT: s_mov_b32 m0, -1
2712 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2713 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
2714 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
2715 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
2716 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2717 ; GFX7-NEXT: s_endpgm
2719 ; GFX10-WGP-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2720 ; GFX10-WGP: ; %bb.0: ; %entry
2721 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
2722 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
2723 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
2724 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
2725 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2726 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
2727 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
2728 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
2729 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2730 ; GFX10-WGP-NEXT: s_endpgm
2732 ; GFX10-CU-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2733 ; GFX10-CU: ; %bb.0: ; %entry
2734 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
2735 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
2736 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
2737 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
2738 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2739 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
2740 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
2741 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
2742 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2743 ; GFX10-CU-NEXT: s_endpgm
2745 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2746 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2747 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
2748 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
2749 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
2750 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
2751 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2752 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2753 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2754 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2755 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
2756 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2757 ; SKIP-CACHE-INV-NEXT: s_endpgm
2759 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2760 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2761 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
2762 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
2763 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
2764 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
2765 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2766 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
2767 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2768 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2769 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2770 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2772 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2773 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2774 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
2775 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
2776 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
2777 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
2778 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2779 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
2780 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2781 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2782 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2783 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2785 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2786 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2787 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
2788 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
2789 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
2790 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
2791 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2792 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
2793 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2794 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
2795 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2796 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2798 ; GFX940-TGSPLIT-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2799 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2800 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
2801 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
2802 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
2803 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
2804 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2805 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
2806 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2807 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
2808 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2809 ; GFX940-TGSPLIT-NEXT: s_endpgm
2811 ; GFX11-WGP-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2812 ; GFX11-WGP: ; %bb.0: ; %entry
2813 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
2814 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
2815 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
2816 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
2817 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2818 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
2819 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
2820 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
2821 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2822 ; GFX11-WGP-NEXT: s_endpgm
2824 ; GFX11-CU-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2825 ; GFX11-CU: ; %bb.0: ; %entry
2826 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
2827 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
2828 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
2829 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
2830 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
2831 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
2832 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
2833 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
2834 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2835 ; GFX11-CU-NEXT: s_endpgm
2837 ; GFX12-WGP-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2838 ; GFX12-WGP: ; %bb.0: ; %entry
2839 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
2840 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
2841 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
2842 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
2843 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
2844 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
2845 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
2846 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
2847 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2848 ; GFX12-WGP-NEXT: s_endpgm
2850 ; GFX12-CU-LABEL: local_singlethread_acquire_monotonic_cmpxchg:
2851 ; GFX12-CU: ; %bb.0: ; %entry
2852 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
2853 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
2854 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
2855 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
2856 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
2857 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
2858 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
2859 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
2860 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
2861 ; GFX12-CU-NEXT: s_endpgm
2862 ptr addrspace(3) %out, i32 %in, i32 %old) {
2864 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
2865 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acquire monotonic
2869 define amdgpu_kernel void @local_singlethread_release_monotonic_cmpxchg(
2870 ; GFX6-LABEL: local_singlethread_release_monotonic_cmpxchg:
2871 ; GFX6: ; %bb.0: ; %entry
2872 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
2873 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
2874 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
2875 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
2876 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
2877 ; GFX6-NEXT: s_mov_b32 m0, -1
2878 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
2879 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
2880 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
2881 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
2882 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2883 ; GFX6-NEXT: s_endpgm
2885 ; GFX7-LABEL: local_singlethread_release_monotonic_cmpxchg:
2886 ; GFX7: ; %bb.0: ; %entry
2887 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
2888 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
2889 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
2890 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
2891 ; GFX7-NEXT: s_mov_b32 m0, -1
2892 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
2893 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
2894 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
2895 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
2896 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2897 ; GFX7-NEXT: s_endpgm
2899 ; GFX10-WGP-LABEL: local_singlethread_release_monotonic_cmpxchg:
2900 ; GFX10-WGP: ; %bb.0: ; %entry
2901 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
2902 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
2903 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
2904 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
2905 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
2906 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
2907 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
2908 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
2909 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2910 ; GFX10-WGP-NEXT: s_endpgm
2912 ; GFX10-CU-LABEL: local_singlethread_release_monotonic_cmpxchg:
2913 ; GFX10-CU: ; %bb.0: ; %entry
2914 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
2915 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
2916 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
2917 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
2918 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
2919 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
2920 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
2921 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
2922 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2923 ; GFX10-CU-NEXT: s_endpgm
2925 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_monotonic_cmpxchg:
2926 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
2927 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
2928 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
2929 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
2930 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
2931 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
2932 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
2933 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
2934 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
2935 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
2936 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2937 ; SKIP-CACHE-INV-NEXT: s_endpgm
2939 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_monotonic_cmpxchg:
2940 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
2941 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
2942 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
2943 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
2944 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
2945 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2946 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
2947 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2948 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2949 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2950 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
2952 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_monotonic_cmpxchg:
2953 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
2954 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
2955 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
2956 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
2957 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
2958 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2959 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
2960 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
2961 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
2962 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2963 ; GFX90A-TGSPLIT-NEXT: s_endpgm
2965 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_release_monotonic_cmpxchg:
2966 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
2967 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
2968 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
2969 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
2970 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
2971 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2972 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
2973 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2974 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
2975 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2976 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
2978 ; GFX940-TGSPLIT-LABEL: local_singlethread_release_monotonic_cmpxchg:
2979 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
2980 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
2981 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
2982 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
2983 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
2984 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
2985 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
2986 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
2987 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
2988 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
2989 ; GFX940-TGSPLIT-NEXT: s_endpgm
2991 ; GFX11-WGP-LABEL: local_singlethread_release_monotonic_cmpxchg:
2992 ; GFX11-WGP: ; %bb.0: ; %entry
2993 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
2994 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
2995 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
2996 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
2997 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
2998 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
2999 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
3000 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
3001 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3002 ; GFX11-WGP-NEXT: s_endpgm
3004 ; GFX11-CU-LABEL: local_singlethread_release_monotonic_cmpxchg:
3005 ; GFX11-CU: ; %bb.0: ; %entry
3006 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3007 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3008 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3009 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3010 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3011 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
3012 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
3013 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
3014 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3015 ; GFX11-CU-NEXT: s_endpgm
3017 ; GFX12-WGP-LABEL: local_singlethread_release_monotonic_cmpxchg:
3018 ; GFX12-WGP: ; %bb.0: ; %entry
3019 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3020 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3021 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3022 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3023 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3024 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
3025 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
3026 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
3027 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3028 ; GFX12-WGP-NEXT: s_endpgm
3030 ; GFX12-CU-LABEL: local_singlethread_release_monotonic_cmpxchg:
3031 ; GFX12-CU: ; %bb.0: ; %entry
3032 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3033 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3034 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3035 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3036 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3037 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
3038 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
3039 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
3040 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3041 ; GFX12-CU-NEXT: s_endpgm
3042 ptr addrspace(3) %out, i32 %in, i32 %old) {
3044 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3045 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") release monotonic
3049 define amdgpu_kernel void @local_singlethread_acq_rel_monotonic_cmpxchg(
3050 ; GFX6-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3051 ; GFX6: ; %bb.0: ; %entry
3052 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
3053 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
3054 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
3055 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
3056 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
3057 ; GFX6-NEXT: s_mov_b32 m0, -1
3058 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3059 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
3060 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
3061 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
3062 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3063 ; GFX6-NEXT: s_endpgm
3065 ; GFX7-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3066 ; GFX7: ; %bb.0: ; %entry
3067 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
3068 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
3069 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
3070 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
3071 ; GFX7-NEXT: s_mov_b32 m0, -1
3072 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3073 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
3074 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3075 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
3076 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3077 ; GFX7-NEXT: s_endpgm
3079 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3080 ; GFX10-WGP: ; %bb.0: ; %entry
3081 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
3082 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
3083 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
3084 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
3085 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3086 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
3087 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
3088 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
3089 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3090 ; GFX10-WGP-NEXT: s_endpgm
3092 ; GFX10-CU-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3093 ; GFX10-CU: ; %bb.0: ; %entry
3094 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
3095 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
3096 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
3097 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
3098 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3099 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
3100 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
3101 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
3102 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3103 ; GFX10-CU-NEXT: s_endpgm
3105 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3106 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3107 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
3108 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
3109 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
3110 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
3111 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3112 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3113 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3114 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3115 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
3116 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3117 ; SKIP-CACHE-INV-NEXT: s_endpgm
3119 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3120 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3121 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3122 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3123 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3124 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3125 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3126 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3127 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3128 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3129 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3130 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3132 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3133 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3134 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3135 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3136 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3137 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3138 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3139 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3140 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3141 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3142 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3143 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3145 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3146 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3147 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3148 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3149 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3150 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3151 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3152 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3153 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3154 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3155 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3156 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3158 ; GFX940-TGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3159 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3160 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3161 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3162 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3163 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3164 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3165 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3166 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3167 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3168 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3169 ; GFX940-TGSPLIT-NEXT: s_endpgm
3171 ; GFX11-WGP-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3172 ; GFX11-WGP: ; %bb.0: ; %entry
3173 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3174 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3175 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3176 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3177 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3178 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
3179 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
3180 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
3181 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3182 ; GFX11-WGP-NEXT: s_endpgm
3184 ; GFX11-CU-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3185 ; GFX11-CU: ; %bb.0: ; %entry
3186 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3187 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3188 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3189 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3190 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3191 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
3192 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
3193 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
3194 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3195 ; GFX11-CU-NEXT: s_endpgm
3197 ; GFX12-WGP-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3198 ; GFX12-WGP: ; %bb.0: ; %entry
3199 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3200 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3201 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3202 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3203 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3204 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
3205 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
3206 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
3207 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3208 ; GFX12-WGP-NEXT: s_endpgm
3210 ; GFX12-CU-LABEL: local_singlethread_acq_rel_monotonic_cmpxchg:
3211 ; GFX12-CU: ; %bb.0: ; %entry
3212 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3213 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3214 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3215 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3216 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3217 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
3218 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
3219 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
3220 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3221 ; GFX12-CU-NEXT: s_endpgm
3222 ptr addrspace(3) %out, i32 %in, i32 %old) {
3224 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3225 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel monotonic
3229 define amdgpu_kernel void @local_singlethread_seq_cst_monotonic_cmpxchg(
3230 ; GFX6-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3231 ; GFX6: ; %bb.0: ; %entry
3232 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
3233 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
3234 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
3235 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
3236 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
3237 ; GFX6-NEXT: s_mov_b32 m0, -1
3238 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3239 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
3240 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
3241 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
3242 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3243 ; GFX6-NEXT: s_endpgm
3245 ; GFX7-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3246 ; GFX7: ; %bb.0: ; %entry
3247 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
3248 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
3249 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
3250 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
3251 ; GFX7-NEXT: s_mov_b32 m0, -1
3252 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3253 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
3254 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3255 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
3256 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3257 ; GFX7-NEXT: s_endpgm
3259 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3260 ; GFX10-WGP: ; %bb.0: ; %entry
3261 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
3262 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
3263 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
3264 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
3265 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3266 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
3267 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
3268 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
3269 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3270 ; GFX10-WGP-NEXT: s_endpgm
3272 ; GFX10-CU-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3273 ; GFX10-CU: ; %bb.0: ; %entry
3274 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
3275 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
3276 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
3277 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
3278 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3279 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
3280 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
3281 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
3282 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3283 ; GFX10-CU-NEXT: s_endpgm
3285 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3286 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3287 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
3288 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
3289 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
3290 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
3291 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3292 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3293 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3294 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3295 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
3296 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3297 ; SKIP-CACHE-INV-NEXT: s_endpgm
3299 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3300 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3301 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3302 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3303 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3304 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3305 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3306 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3307 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3308 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3309 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3310 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3312 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3313 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3314 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3315 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3316 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3317 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3318 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3319 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3320 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3321 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3322 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3323 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3325 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3326 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3327 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3328 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3329 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3330 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3331 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3332 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3333 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3334 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3335 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3336 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3338 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3339 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3340 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3341 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3342 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3343 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3344 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3345 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3346 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3347 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3348 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3349 ; GFX940-TGSPLIT-NEXT: s_endpgm
3351 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3352 ; GFX11-WGP: ; %bb.0: ; %entry
3353 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3354 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3355 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3356 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3357 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3358 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
3359 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
3360 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
3361 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3362 ; GFX11-WGP-NEXT: s_endpgm
3364 ; GFX11-CU-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3365 ; GFX11-CU: ; %bb.0: ; %entry
3366 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3367 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3368 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3369 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3370 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3371 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
3372 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
3373 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
3374 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3375 ; GFX11-CU-NEXT: s_endpgm
3377 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3378 ; GFX12-WGP: ; %bb.0: ; %entry
3379 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3380 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3381 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3382 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3383 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3384 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
3385 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
3386 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
3387 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3388 ; GFX12-WGP-NEXT: s_endpgm
3390 ; GFX12-CU-LABEL: local_singlethread_seq_cst_monotonic_cmpxchg:
3391 ; GFX12-CU: ; %bb.0: ; %entry
3392 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3393 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3394 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3395 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3396 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3397 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
3398 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
3399 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
3400 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3401 ; GFX12-CU-NEXT: s_endpgm
3402 ptr addrspace(3) %out, i32 %in, i32 %old) {
3404 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3405 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst monotonic
3409 define amdgpu_kernel void @local_singlethread_monotonic_acquire_cmpxchg(
3410 ; GFX6-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3411 ; GFX6: ; %bb.0: ; %entry
3412 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
3413 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
3414 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
3415 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
3416 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
3417 ; GFX6-NEXT: s_mov_b32 m0, -1
3418 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3419 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
3420 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
3421 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
3422 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3423 ; GFX6-NEXT: s_endpgm
3425 ; GFX7-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3426 ; GFX7: ; %bb.0: ; %entry
3427 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
3428 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
3429 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
3430 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
3431 ; GFX7-NEXT: s_mov_b32 m0, -1
3432 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3433 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
3434 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3435 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
3436 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3437 ; GFX7-NEXT: s_endpgm
3439 ; GFX10-WGP-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3440 ; GFX10-WGP: ; %bb.0: ; %entry
3441 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
3442 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
3443 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
3444 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
3445 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3446 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
3447 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
3448 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
3449 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3450 ; GFX10-WGP-NEXT: s_endpgm
3452 ; GFX10-CU-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3453 ; GFX10-CU: ; %bb.0: ; %entry
3454 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
3455 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
3456 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
3457 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
3458 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3459 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
3460 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
3461 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
3462 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3463 ; GFX10-CU-NEXT: s_endpgm
3465 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3466 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3467 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
3468 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
3469 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
3470 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
3471 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3472 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3473 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3474 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3475 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
3476 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3477 ; SKIP-CACHE-INV-NEXT: s_endpgm
3479 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3480 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3481 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3482 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3483 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3484 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3485 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3486 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3487 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3488 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3489 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3490 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3492 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3493 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3494 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3495 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3496 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3497 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3498 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3499 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3500 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3501 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3502 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3503 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3505 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3506 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3507 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3508 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3509 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3510 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3511 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3512 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3513 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3514 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3515 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3516 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3518 ; GFX940-TGSPLIT-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3519 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3520 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3521 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3522 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3523 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3524 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3525 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3526 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3527 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3528 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3529 ; GFX940-TGSPLIT-NEXT: s_endpgm
3531 ; GFX11-WGP-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3532 ; GFX11-WGP: ; %bb.0: ; %entry
3533 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3534 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3535 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3536 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3537 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3538 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
3539 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
3540 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
3541 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3542 ; GFX11-WGP-NEXT: s_endpgm
3544 ; GFX11-CU-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3545 ; GFX11-CU: ; %bb.0: ; %entry
3546 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3547 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3548 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3549 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3550 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3551 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
3552 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
3553 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
3554 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3555 ; GFX11-CU-NEXT: s_endpgm
3557 ; GFX12-WGP-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3558 ; GFX12-WGP: ; %bb.0: ; %entry
3559 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3560 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3561 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3562 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3563 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3564 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
3565 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
3566 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
3567 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3568 ; GFX12-WGP-NEXT: s_endpgm
3570 ; GFX12-CU-LABEL: local_singlethread_monotonic_acquire_cmpxchg:
3571 ; GFX12-CU: ; %bb.0: ; %entry
3572 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3573 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3574 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3575 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3576 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3577 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
3578 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
3579 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
3580 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3581 ; GFX12-CU-NEXT: s_endpgm
3582 ptr addrspace(3) %out, i32 %in, i32 %old) {
3584 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3585 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic acquire
3589 define amdgpu_kernel void @local_singlethread_acquire_acquire_cmpxchg(
3590 ; GFX6-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3591 ; GFX6: ; %bb.0: ; %entry
3592 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
3593 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
3594 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
3595 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
3596 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
3597 ; GFX6-NEXT: s_mov_b32 m0, -1
3598 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3599 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
3600 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
3601 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
3602 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3603 ; GFX6-NEXT: s_endpgm
3605 ; GFX7-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3606 ; GFX7: ; %bb.0: ; %entry
3607 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
3608 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
3609 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
3610 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
3611 ; GFX7-NEXT: s_mov_b32 m0, -1
3612 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3613 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
3614 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3615 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
3616 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3617 ; GFX7-NEXT: s_endpgm
3619 ; GFX10-WGP-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3620 ; GFX10-WGP: ; %bb.0: ; %entry
3621 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
3622 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
3623 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
3624 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
3625 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3626 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
3627 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
3628 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
3629 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3630 ; GFX10-WGP-NEXT: s_endpgm
3632 ; GFX10-CU-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3633 ; GFX10-CU: ; %bb.0: ; %entry
3634 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
3635 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
3636 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
3637 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
3638 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3639 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
3640 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
3641 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
3642 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3643 ; GFX10-CU-NEXT: s_endpgm
3645 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3646 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3647 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
3648 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
3649 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
3650 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
3651 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3652 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3653 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3654 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3655 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
3656 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3657 ; SKIP-CACHE-INV-NEXT: s_endpgm
3659 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3660 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3661 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3662 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3663 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3664 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3665 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3666 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3667 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3668 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3669 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3670 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3672 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3673 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3674 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3675 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3676 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3677 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3678 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3679 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3680 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3681 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3682 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3683 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3685 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3686 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3687 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3688 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3689 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3690 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3691 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3692 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3693 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3694 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3695 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3696 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3698 ; GFX940-TGSPLIT-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3699 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3700 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3701 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3702 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3703 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3704 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3705 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3706 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3707 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3708 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3709 ; GFX940-TGSPLIT-NEXT: s_endpgm
3711 ; GFX11-WGP-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3712 ; GFX11-WGP: ; %bb.0: ; %entry
3713 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3714 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3715 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3716 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3717 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3718 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
3719 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
3720 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
3721 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3722 ; GFX11-WGP-NEXT: s_endpgm
3724 ; GFX11-CU-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3725 ; GFX11-CU: ; %bb.0: ; %entry
3726 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3727 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3728 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3729 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3730 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3731 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
3732 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
3733 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
3734 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3735 ; GFX11-CU-NEXT: s_endpgm
3737 ; GFX12-WGP-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3738 ; GFX12-WGP: ; %bb.0: ; %entry
3739 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3740 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3741 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3742 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3743 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3744 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
3745 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
3746 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
3747 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3748 ; GFX12-WGP-NEXT: s_endpgm
3750 ; GFX12-CU-LABEL: local_singlethread_acquire_acquire_cmpxchg:
3751 ; GFX12-CU: ; %bb.0: ; %entry
3752 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3753 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3754 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3755 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3756 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3757 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
3758 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
3759 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
3760 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3761 ; GFX12-CU-NEXT: s_endpgm
3762 ptr addrspace(3) %out, i32 %in, i32 %old) {
3764 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3765 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acquire acquire
3769 define amdgpu_kernel void @local_singlethread_release_acquire_cmpxchg(
3770 ; GFX6-LABEL: local_singlethread_release_acquire_cmpxchg:
3771 ; GFX6: ; %bb.0: ; %entry
3772 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
3773 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
3774 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
3775 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
3776 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
3777 ; GFX6-NEXT: s_mov_b32 m0, -1
3778 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3779 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
3780 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
3781 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
3782 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3783 ; GFX6-NEXT: s_endpgm
3785 ; GFX7-LABEL: local_singlethread_release_acquire_cmpxchg:
3786 ; GFX7: ; %bb.0: ; %entry
3787 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
3788 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
3789 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
3790 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
3791 ; GFX7-NEXT: s_mov_b32 m0, -1
3792 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3793 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
3794 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3795 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
3796 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3797 ; GFX7-NEXT: s_endpgm
3799 ; GFX10-WGP-LABEL: local_singlethread_release_acquire_cmpxchg:
3800 ; GFX10-WGP: ; %bb.0: ; %entry
3801 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
3802 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
3803 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
3804 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
3805 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3806 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
3807 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
3808 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
3809 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3810 ; GFX10-WGP-NEXT: s_endpgm
3812 ; GFX10-CU-LABEL: local_singlethread_release_acquire_cmpxchg:
3813 ; GFX10-CU: ; %bb.0: ; %entry
3814 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
3815 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
3816 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
3817 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
3818 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3819 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
3820 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
3821 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
3822 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3823 ; GFX10-CU-NEXT: s_endpgm
3825 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_acquire_cmpxchg:
3826 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
3827 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
3828 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
3829 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
3830 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
3831 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
3832 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
3833 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
3834 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
3835 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
3836 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3837 ; SKIP-CACHE-INV-NEXT: s_endpgm
3839 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_acquire_cmpxchg:
3840 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
3841 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3842 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3843 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3844 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3845 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3846 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3847 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3848 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3849 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3850 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
3852 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_acquire_cmpxchg:
3853 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
3854 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
3855 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
3856 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
3857 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
3858 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3859 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
3860 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
3861 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
3862 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3863 ; GFX90A-TGSPLIT-NEXT: s_endpgm
3865 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_release_acquire_cmpxchg:
3866 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
3867 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3868 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3869 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3870 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3871 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3872 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3873 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3874 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3875 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3876 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
3878 ; GFX940-TGSPLIT-LABEL: local_singlethread_release_acquire_cmpxchg:
3879 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
3880 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
3881 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
3882 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
3883 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
3884 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
3885 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
3886 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
3887 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
3888 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3889 ; GFX940-TGSPLIT-NEXT: s_endpgm
3891 ; GFX11-WGP-LABEL: local_singlethread_release_acquire_cmpxchg:
3892 ; GFX11-WGP: ; %bb.0: ; %entry
3893 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3894 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3895 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3896 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3897 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
3898 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
3899 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
3900 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
3901 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3902 ; GFX11-WGP-NEXT: s_endpgm
3904 ; GFX11-CU-LABEL: local_singlethread_release_acquire_cmpxchg:
3905 ; GFX11-CU: ; %bb.0: ; %entry
3906 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3907 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3908 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3909 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3910 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
3911 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
3912 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
3913 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
3914 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3915 ; GFX11-CU-NEXT: s_endpgm
3917 ; GFX12-WGP-LABEL: local_singlethread_release_acquire_cmpxchg:
3918 ; GFX12-WGP: ; %bb.0: ; %entry
3919 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
3920 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
3921 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
3922 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
3923 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
3924 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
3925 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
3926 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
3927 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3928 ; GFX12-WGP-NEXT: s_endpgm
3930 ; GFX12-CU-LABEL: local_singlethread_release_acquire_cmpxchg:
3931 ; GFX12-CU: ; %bb.0: ; %entry
3932 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
3933 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
3934 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
3935 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
3936 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
3937 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
3938 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
3939 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
3940 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
3941 ; GFX12-CU-NEXT: s_endpgm
3942 ptr addrspace(3) %out, i32 %in, i32 %old) {
3944 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
3945 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") release acquire
3949 define amdgpu_kernel void @local_singlethread_acq_rel_acquire_cmpxchg(
3950 ; GFX6-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
3951 ; GFX6: ; %bb.0: ; %entry
3952 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
3953 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
3954 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
3955 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
3956 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
3957 ; GFX6-NEXT: s_mov_b32 m0, -1
3958 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
3959 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
3960 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
3961 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
3962 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3963 ; GFX6-NEXT: s_endpgm
3965 ; GFX7-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
3966 ; GFX7: ; %bb.0: ; %entry
3967 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
3968 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
3969 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
3970 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
3971 ; GFX7-NEXT: s_mov_b32 m0, -1
3972 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
3973 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
3974 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
3975 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
3976 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3977 ; GFX7-NEXT: s_endpgm
3979 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
3980 ; GFX10-WGP: ; %bb.0: ; %entry
3981 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
3982 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
3983 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
3984 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
3985 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
3986 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
3987 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
3988 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
3989 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
3990 ; GFX10-WGP-NEXT: s_endpgm
3992 ; GFX10-CU-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
3993 ; GFX10-CU: ; %bb.0: ; %entry
3994 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
3995 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
3996 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
3997 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
3998 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
3999 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
4000 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4001 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
4002 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4003 ; GFX10-CU-NEXT: s_endpgm
4005 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
4006 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4007 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
4008 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
4009 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
4010 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
4011 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4012 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4013 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4014 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4015 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
4016 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4017 ; SKIP-CACHE-INV-NEXT: s_endpgm
4019 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
4020 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4021 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4022 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4023 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4024 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4025 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4026 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4027 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4028 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4029 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4030 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4032 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
4033 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4034 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4035 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4036 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4037 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4038 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4039 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4040 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4041 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4042 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4043 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4045 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
4046 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4047 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4048 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4049 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4050 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4051 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4052 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4053 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4054 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4055 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4056 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4058 ; GFX940-TGSPLIT-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
4059 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4060 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4061 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4062 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4063 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4064 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4065 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4066 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4067 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4068 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4069 ; GFX940-TGSPLIT-NEXT: s_endpgm
4071 ; GFX11-WGP-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
4072 ; GFX11-WGP: ; %bb.0: ; %entry
4073 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4074 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4075 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4076 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4077 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4078 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
4079 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
4080 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
4081 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4082 ; GFX11-WGP-NEXT: s_endpgm
4084 ; GFX11-CU-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
4085 ; GFX11-CU: ; %bb.0: ; %entry
4086 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4087 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4088 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4089 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4090 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4091 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
4092 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
4093 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
4094 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4095 ; GFX11-CU-NEXT: s_endpgm
4097 ; GFX12-WGP-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
4098 ; GFX12-WGP: ; %bb.0: ; %entry
4099 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4100 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4101 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4102 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4103 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
4104 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
4105 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
4106 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
4107 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4108 ; GFX12-WGP-NEXT: s_endpgm
4110 ; GFX12-CU-LABEL: local_singlethread_acq_rel_acquire_cmpxchg:
4111 ; GFX12-CU: ; %bb.0: ; %entry
4112 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4113 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4114 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4115 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4116 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
4117 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
4118 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
4119 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
4120 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4121 ; GFX12-CU-NEXT: s_endpgm
4122 ptr addrspace(3) %out, i32 %in, i32 %old) {
4124 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4125 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel acquire
4129 define amdgpu_kernel void @local_singlethread_seq_cst_acquire_cmpxchg(
4130 ; GFX6-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4131 ; GFX6: ; %bb.0: ; %entry
4132 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
4133 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
4134 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
4135 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
4136 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
4137 ; GFX6-NEXT: s_mov_b32 m0, -1
4138 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4139 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
4140 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
4141 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
4142 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4143 ; GFX6-NEXT: s_endpgm
4145 ; GFX7-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4146 ; GFX7: ; %bb.0: ; %entry
4147 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
4148 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
4149 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
4150 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
4151 ; GFX7-NEXT: s_mov_b32 m0, -1
4152 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4153 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
4154 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4155 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
4156 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4157 ; GFX7-NEXT: s_endpgm
4159 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4160 ; GFX10-WGP: ; %bb.0: ; %entry
4161 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
4162 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
4163 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
4164 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
4165 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4166 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
4167 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4168 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
4169 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4170 ; GFX10-WGP-NEXT: s_endpgm
4172 ; GFX10-CU-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4173 ; GFX10-CU: ; %bb.0: ; %entry
4174 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
4175 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
4176 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
4177 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
4178 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4179 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
4180 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4181 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
4182 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4183 ; GFX10-CU-NEXT: s_endpgm
4185 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4186 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4187 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
4188 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
4189 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
4190 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
4191 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4192 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4193 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4194 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4195 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
4196 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4197 ; SKIP-CACHE-INV-NEXT: s_endpgm
4199 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4200 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4201 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4202 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4203 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4204 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4205 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4206 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4207 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4208 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4209 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4210 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4212 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4213 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4214 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4215 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4216 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4217 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4218 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4219 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4220 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4221 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4222 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4223 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4225 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4226 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4227 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4228 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4229 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4230 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4231 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4232 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4233 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4234 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4235 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4236 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4238 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4239 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4240 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4241 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4242 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4243 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4244 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4245 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4246 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4247 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4248 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4249 ; GFX940-TGSPLIT-NEXT: s_endpgm
4251 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4252 ; GFX11-WGP: ; %bb.0: ; %entry
4253 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4254 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4255 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4256 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4257 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4258 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
4259 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
4260 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
4261 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4262 ; GFX11-WGP-NEXT: s_endpgm
4264 ; GFX11-CU-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4265 ; GFX11-CU: ; %bb.0: ; %entry
4266 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4267 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4268 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4269 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4270 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4271 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
4272 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
4273 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
4274 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4275 ; GFX11-CU-NEXT: s_endpgm
4277 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4278 ; GFX12-WGP: ; %bb.0: ; %entry
4279 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4280 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4281 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4282 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4283 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
4284 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
4285 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
4286 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
4287 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4288 ; GFX12-WGP-NEXT: s_endpgm
4290 ; GFX12-CU-LABEL: local_singlethread_seq_cst_acquire_cmpxchg:
4291 ; GFX12-CU: ; %bb.0: ; %entry
4292 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4293 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4294 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4295 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4296 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
4297 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
4298 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
4299 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
4300 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4301 ; GFX12-CU-NEXT: s_endpgm
4302 ptr addrspace(3) %out, i32 %in, i32 %old) {
4304 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4305 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst acquire
4309 define amdgpu_kernel void @local_singlethread_monotonic_seq_cst_cmpxchg(
4310 ; GFX6-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4311 ; GFX6: ; %bb.0: ; %entry
4312 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
4313 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
4314 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
4315 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
4316 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
4317 ; GFX6-NEXT: s_mov_b32 m0, -1
4318 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4319 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
4320 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
4321 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
4322 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4323 ; GFX6-NEXT: s_endpgm
4325 ; GFX7-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4326 ; GFX7: ; %bb.0: ; %entry
4327 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
4328 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
4329 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
4330 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
4331 ; GFX7-NEXT: s_mov_b32 m0, -1
4332 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4333 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
4334 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4335 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
4336 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4337 ; GFX7-NEXT: s_endpgm
4339 ; GFX10-WGP-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4340 ; GFX10-WGP: ; %bb.0: ; %entry
4341 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
4342 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
4343 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
4344 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
4345 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4346 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
4347 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4348 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
4349 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4350 ; GFX10-WGP-NEXT: s_endpgm
4352 ; GFX10-CU-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4353 ; GFX10-CU: ; %bb.0: ; %entry
4354 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
4355 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
4356 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
4357 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
4358 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4359 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
4360 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4361 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
4362 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4363 ; GFX10-CU-NEXT: s_endpgm
4365 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4366 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4367 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
4368 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
4369 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
4370 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
4371 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4372 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4373 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4374 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4375 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
4376 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4377 ; SKIP-CACHE-INV-NEXT: s_endpgm
4379 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4380 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4381 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4382 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4383 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4384 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4385 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4386 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4387 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4388 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4389 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4390 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4392 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4393 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4394 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4395 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4396 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4397 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4398 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4399 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4400 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4401 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4402 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4403 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4405 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4406 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4407 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4408 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4409 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4410 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4411 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4412 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4413 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4414 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4415 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4416 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4418 ; GFX940-TGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4419 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4420 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4421 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4422 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4423 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4424 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4425 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4426 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4427 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4428 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4429 ; GFX940-TGSPLIT-NEXT: s_endpgm
4431 ; GFX11-WGP-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4432 ; GFX11-WGP: ; %bb.0: ; %entry
4433 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4434 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4435 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4436 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4437 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4438 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
4439 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
4440 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
4441 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4442 ; GFX11-WGP-NEXT: s_endpgm
4444 ; GFX11-CU-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4445 ; GFX11-CU: ; %bb.0: ; %entry
4446 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4447 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4448 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4449 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4450 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4451 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
4452 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
4453 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
4454 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4455 ; GFX11-CU-NEXT: s_endpgm
4457 ; GFX12-WGP-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4458 ; GFX12-WGP: ; %bb.0: ; %entry
4459 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4460 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4461 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4462 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4463 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
4464 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
4465 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
4466 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
4467 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4468 ; GFX12-WGP-NEXT: s_endpgm
4470 ; GFX12-CU-LABEL: local_singlethread_monotonic_seq_cst_cmpxchg:
4471 ; GFX12-CU: ; %bb.0: ; %entry
4472 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4473 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4474 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4475 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4476 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
4477 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
4478 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
4479 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
4480 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4481 ; GFX12-CU-NEXT: s_endpgm
4482 ptr addrspace(3) %out, i32 %in, i32 %old) {
4484 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4485 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic seq_cst
4489 define amdgpu_kernel void @local_singlethread_acquire_seq_cst_cmpxchg(
4490 ; GFX6-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4491 ; GFX6: ; %bb.0: ; %entry
4492 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
4493 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
4494 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
4495 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
4496 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
4497 ; GFX6-NEXT: s_mov_b32 m0, -1
4498 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4499 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
4500 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
4501 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
4502 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4503 ; GFX6-NEXT: s_endpgm
4505 ; GFX7-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4506 ; GFX7: ; %bb.0: ; %entry
4507 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
4508 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
4509 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
4510 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
4511 ; GFX7-NEXT: s_mov_b32 m0, -1
4512 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4513 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
4514 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4515 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
4516 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4517 ; GFX7-NEXT: s_endpgm
4519 ; GFX10-WGP-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4520 ; GFX10-WGP: ; %bb.0: ; %entry
4521 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
4522 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
4523 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
4524 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
4525 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4526 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
4527 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4528 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
4529 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4530 ; GFX10-WGP-NEXT: s_endpgm
4532 ; GFX10-CU-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4533 ; GFX10-CU: ; %bb.0: ; %entry
4534 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
4535 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
4536 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
4537 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
4538 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4539 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
4540 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4541 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
4542 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4543 ; GFX10-CU-NEXT: s_endpgm
4545 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4546 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4547 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
4548 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
4549 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
4550 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
4551 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4552 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4553 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4554 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4555 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
4556 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4557 ; SKIP-CACHE-INV-NEXT: s_endpgm
4559 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4560 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4561 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4562 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4563 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4564 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4565 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4566 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4567 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4568 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4569 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4570 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4572 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4573 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4574 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4575 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4576 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4577 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4578 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4579 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4580 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4581 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4582 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4583 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4585 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4586 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4587 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4588 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4589 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4590 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4591 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4592 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4593 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4594 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4595 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4596 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4598 ; GFX940-TGSPLIT-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4599 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4600 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4601 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4602 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4603 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4604 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4605 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4606 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4607 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4608 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4609 ; GFX940-TGSPLIT-NEXT: s_endpgm
4611 ; GFX11-WGP-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4612 ; GFX11-WGP: ; %bb.0: ; %entry
4613 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4614 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4615 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4616 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4617 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4618 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
4619 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
4620 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
4621 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4622 ; GFX11-WGP-NEXT: s_endpgm
4624 ; GFX11-CU-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4625 ; GFX11-CU: ; %bb.0: ; %entry
4626 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4627 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4628 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4629 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4630 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4631 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
4632 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
4633 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
4634 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4635 ; GFX11-CU-NEXT: s_endpgm
4637 ; GFX12-WGP-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4638 ; GFX12-WGP: ; %bb.0: ; %entry
4639 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4640 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4641 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4642 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4643 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
4644 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
4645 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
4646 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
4647 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4648 ; GFX12-WGP-NEXT: s_endpgm
4650 ; GFX12-CU-LABEL: local_singlethread_acquire_seq_cst_cmpxchg:
4651 ; GFX12-CU: ; %bb.0: ; %entry
4652 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4653 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4654 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4655 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4656 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
4657 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
4658 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
4659 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
4660 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4661 ; GFX12-CU-NEXT: s_endpgm
4662 ptr addrspace(3) %out, i32 %in, i32 %old) {
4664 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4665 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acquire seq_cst
4669 define amdgpu_kernel void @local_singlethread_release_seq_cst_cmpxchg(
4670 ; GFX6-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4671 ; GFX6: ; %bb.0: ; %entry
4672 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
4673 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
4674 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
4675 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
4676 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
4677 ; GFX6-NEXT: s_mov_b32 m0, -1
4678 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4679 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
4680 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
4681 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
4682 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4683 ; GFX6-NEXT: s_endpgm
4685 ; GFX7-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4686 ; GFX7: ; %bb.0: ; %entry
4687 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
4688 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
4689 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
4690 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
4691 ; GFX7-NEXT: s_mov_b32 m0, -1
4692 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4693 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
4694 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4695 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
4696 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4697 ; GFX7-NEXT: s_endpgm
4699 ; GFX10-WGP-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4700 ; GFX10-WGP: ; %bb.0: ; %entry
4701 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
4702 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
4703 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
4704 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
4705 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4706 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
4707 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4708 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
4709 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4710 ; GFX10-WGP-NEXT: s_endpgm
4712 ; GFX10-CU-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4713 ; GFX10-CU: ; %bb.0: ; %entry
4714 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
4715 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
4716 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
4717 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
4718 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4719 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
4720 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4721 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
4722 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4723 ; GFX10-CU-NEXT: s_endpgm
4725 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4726 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4727 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
4728 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
4729 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
4730 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
4731 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4732 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4733 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4734 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4735 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
4736 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4737 ; SKIP-CACHE-INV-NEXT: s_endpgm
4739 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4740 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4741 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4742 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4743 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4744 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4745 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4746 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4747 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4748 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4749 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4750 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4752 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4753 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4754 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4755 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4756 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4757 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4758 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4759 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4760 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4761 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4762 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4763 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4765 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4766 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4767 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4768 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4769 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4770 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4771 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4772 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4773 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4774 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4775 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4776 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4778 ; GFX940-TGSPLIT-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4779 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4780 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4781 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4782 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4783 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4784 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4785 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4786 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4787 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4788 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4789 ; GFX940-TGSPLIT-NEXT: s_endpgm
4791 ; GFX11-WGP-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4792 ; GFX11-WGP: ; %bb.0: ; %entry
4793 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4794 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4795 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4796 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4797 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4798 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
4799 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
4800 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
4801 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4802 ; GFX11-WGP-NEXT: s_endpgm
4804 ; GFX11-CU-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4805 ; GFX11-CU: ; %bb.0: ; %entry
4806 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4807 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4808 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4809 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4810 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4811 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
4812 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
4813 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
4814 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4815 ; GFX11-CU-NEXT: s_endpgm
4817 ; GFX12-WGP-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4818 ; GFX12-WGP: ; %bb.0: ; %entry
4819 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4820 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4821 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4822 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4823 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
4824 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
4825 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
4826 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
4827 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4828 ; GFX12-WGP-NEXT: s_endpgm
4830 ; GFX12-CU-LABEL: local_singlethread_release_seq_cst_cmpxchg:
4831 ; GFX12-CU: ; %bb.0: ; %entry
4832 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4833 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4834 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4835 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4836 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
4837 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
4838 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
4839 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
4840 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4841 ; GFX12-CU-NEXT: s_endpgm
4842 ptr addrspace(3) %out, i32 %in, i32 %old) {
4844 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
4845 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") release seq_cst
4849 define amdgpu_kernel void @local_singlethread_acq_rel_seq_cst_cmpxchg(
4850 ; GFX6-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4851 ; GFX6: ; %bb.0: ; %entry
4852 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
4853 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
4854 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
4855 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
4856 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
4857 ; GFX6-NEXT: s_mov_b32 m0, -1
4858 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
4859 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
4860 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
4861 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
4862 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4863 ; GFX6-NEXT: s_endpgm
4865 ; GFX7-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4866 ; GFX7: ; %bb.0: ; %entry
4867 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
4868 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
4869 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
4870 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
4871 ; GFX7-NEXT: s_mov_b32 m0, -1
4872 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
4873 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
4874 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
4875 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
4876 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4877 ; GFX7-NEXT: s_endpgm
4879 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4880 ; GFX10-WGP: ; %bb.0: ; %entry
4881 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
4882 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
4883 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
4884 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
4885 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
4886 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
4887 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
4888 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
4889 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4890 ; GFX10-WGP-NEXT: s_endpgm
4892 ; GFX10-CU-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4893 ; GFX10-CU: ; %bb.0: ; %entry
4894 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
4895 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
4896 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
4897 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
4898 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
4899 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
4900 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
4901 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
4902 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4903 ; GFX10-CU-NEXT: s_endpgm
4905 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4906 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
4907 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
4908 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
4909 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
4910 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
4911 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
4912 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
4913 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
4914 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
4915 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
4916 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4917 ; SKIP-CACHE-INV-NEXT: s_endpgm
4919 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4920 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
4921 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4922 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4923 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4924 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4925 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4926 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4927 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4928 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4929 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4930 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
4932 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4933 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
4934 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
4935 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
4936 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
4937 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
4938 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4939 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
4940 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
4941 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
4942 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4943 ; GFX90A-TGSPLIT-NEXT: s_endpgm
4945 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4946 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
4947 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4948 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4949 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4950 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4951 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4952 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4953 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4954 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4955 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4956 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
4958 ; GFX940-TGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4959 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
4960 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
4961 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
4962 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
4963 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
4964 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
4965 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
4966 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
4967 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
4968 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
4969 ; GFX940-TGSPLIT-NEXT: s_endpgm
4971 ; GFX11-WGP-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4972 ; GFX11-WGP: ; %bb.0: ; %entry
4973 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
4974 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
4975 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
4976 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
4977 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
4978 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
4979 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
4980 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
4981 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4982 ; GFX11-WGP-NEXT: s_endpgm
4984 ; GFX11-CU-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4985 ; GFX11-CU: ; %bb.0: ; %entry
4986 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
4987 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
4988 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
4989 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
4990 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
4991 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
4992 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
4993 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
4994 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
4995 ; GFX11-CU-NEXT: s_endpgm
4997 ; GFX12-WGP-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
4998 ; GFX12-WGP: ; %bb.0: ; %entry
4999 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5000 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
5001 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
5002 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
5003 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
5004 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
5005 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
5006 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
5007 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
5008 ; GFX12-WGP-NEXT: s_endpgm
5010 ; GFX12-CU-LABEL: local_singlethread_acq_rel_seq_cst_cmpxchg:
5011 ; GFX12-CU: ; %bb.0: ; %entry
5012 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5013 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
5014 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
5015 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
5016 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
5017 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
5018 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
5019 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
5020 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
5021 ; GFX12-CU-NEXT: s_endpgm
5022 ptr addrspace(3) %out, i32 %in, i32 %old) {
5024 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5025 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel seq_cst
5029 define amdgpu_kernel void @local_singlethread_seq_cst_seq_cst_cmpxchg(
5030 ; GFX6-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5031 ; GFX6: ; %bb.0: ; %entry
5032 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
5033 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
5034 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
5035 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
5036 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
5037 ; GFX6-NEXT: s_mov_b32 m0, -1
5038 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5039 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
5040 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
5041 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
5042 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5043 ; GFX6-NEXT: s_endpgm
5045 ; GFX7-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5046 ; GFX7: ; %bb.0: ; %entry
5047 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
5048 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
5049 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
5050 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
5051 ; GFX7-NEXT: s_mov_b32 m0, -1
5052 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5053 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
5054 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
5055 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
5056 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5057 ; GFX7-NEXT: s_endpgm
5059 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5060 ; GFX10-WGP: ; %bb.0: ; %entry
5061 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
5062 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
5063 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
5064 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
5065 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5066 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
5067 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
5068 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
5069 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5070 ; GFX10-WGP-NEXT: s_endpgm
5072 ; GFX10-CU-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5073 ; GFX10-CU: ; %bb.0: ; %entry
5074 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
5075 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
5076 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
5077 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
5078 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5079 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
5080 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
5081 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
5082 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5083 ; GFX10-CU-NEXT: s_endpgm
5085 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5086 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5087 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
5088 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
5089 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
5090 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
5091 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5092 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5093 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
5094 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
5095 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
5096 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5097 ; SKIP-CACHE-INV-NEXT: s_endpgm
5099 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5100 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5101 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
5102 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
5103 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
5104 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
5105 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5106 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
5107 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
5108 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
5109 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5110 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5112 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5113 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5114 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
5115 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
5116 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
5117 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
5118 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5119 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
5120 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
5121 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
5122 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5123 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5125 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5126 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5127 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
5128 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
5129 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
5130 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
5131 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5132 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
5133 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5134 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
5135 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5136 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5138 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5139 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5140 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
5141 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
5142 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
5143 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
5144 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5145 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
5146 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
5147 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
5148 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
5149 ; GFX940-TGSPLIT-NEXT: s_endpgm
5151 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5152 ; GFX11-WGP: ; %bb.0: ; %entry
5153 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5154 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
5155 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
5156 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
5157 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5158 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
5159 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
5160 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
5161 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
5162 ; GFX11-WGP-NEXT: s_endpgm
5164 ; GFX11-CU-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5165 ; GFX11-CU: ; %bb.0: ; %entry
5166 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5167 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
5168 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
5169 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
5170 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5171 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
5172 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
5173 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
5174 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
5175 ; GFX11-CU-NEXT: s_endpgm
5177 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5178 ; GFX12-WGP: ; %bb.0: ; %entry
5179 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5180 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
5181 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
5182 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
5183 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
5184 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
5185 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
5186 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
5187 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
5188 ; GFX12-WGP-NEXT: s_endpgm
5190 ; GFX12-CU-LABEL: local_singlethread_seq_cst_seq_cst_cmpxchg:
5191 ; GFX12-CU: ; %bb.0: ; %entry
5192 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5193 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
5194 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
5195 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
5196 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
5197 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
5198 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
5199 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
5200 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
5201 ; GFX12-CU-NEXT: s_endpgm
5202 ptr addrspace(3) %out, i32 %in, i32 %old) {
5204 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5205 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst seq_cst
5209 define amdgpu_kernel void @local_singlethread_monotonic_monotonic_ret_cmpxchg(
5210 ; GFX6-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5211 ; GFX6: ; %bb.0: ; %entry
5212 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
5213 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
5214 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
5215 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
5216 ; GFX6-NEXT: s_mov_b32 m0, -1
5217 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5218 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
5219 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
5220 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
5221 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5222 ; GFX6-NEXT: s_mov_b32 m0, -1
5223 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
5224 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5225 ; GFX6-NEXT: ds_write_b32 v0, v1
5226 ; GFX6-NEXT: s_endpgm
5228 ; GFX7-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5229 ; GFX7: ; %bb.0: ; %entry
5230 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
5231 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
5232 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
5233 ; GFX7-NEXT: s_mov_b32 m0, -1
5234 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5235 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5236 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
5237 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
5238 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5239 ; GFX7-NEXT: s_mov_b32 m0, -1
5240 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5241 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5242 ; GFX7-NEXT: ds_write_b32 v0, v1
5243 ; GFX7-NEXT: s_endpgm
5245 ; GFX10-WGP-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5246 ; GFX10-WGP: ; %bb.0: ; %entry
5247 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
5248 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
5249 ; GFX10-WGP-NEXT: s_nop 0
5250 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
5251 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5252 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5253 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
5254 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
5255 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5256 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5257 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5258 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5259 ; GFX10-WGP-NEXT: s_endpgm
5261 ; GFX10-CU-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5262 ; GFX10-CU: ; %bb.0: ; %entry
5263 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
5264 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
5265 ; GFX10-CU-NEXT: s_nop 0
5266 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
5267 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5268 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5269 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
5270 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
5271 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5272 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5273 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5274 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5275 ; GFX10-CU-NEXT: s_endpgm
5277 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5278 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5279 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
5280 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
5281 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
5282 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5283 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5284 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5285 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5286 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5287 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5288 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5289 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5290 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5291 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5292 ; SKIP-CACHE-INV-NEXT: s_endpgm
5294 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5295 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5296 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
5297 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
5298 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
5299 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
5300 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5301 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5302 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5303 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
5304 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5305 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5306 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5307 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5308 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5310 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5311 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5312 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
5313 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
5314 ; GFX90A-TGSPLIT-NEXT: s_nop 0
5315 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
5316 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5317 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5318 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5319 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
5320 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5321 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5322 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5323 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5324 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5326 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5327 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5328 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
5329 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
5330 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
5331 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
5332 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5333 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5334 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5335 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5336 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5337 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5338 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5339 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5340 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5342 ; GFX940-TGSPLIT-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5343 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5344 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
5345 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
5346 ; GFX940-TGSPLIT-NEXT: s_nop 0
5347 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
5348 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5349 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5350 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5351 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5352 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5353 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5354 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5355 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
5356 ; GFX940-TGSPLIT-NEXT: s_endpgm
5358 ; GFX11-WGP-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5359 ; GFX11-WGP: ; %bb.0: ; %entry
5360 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5361 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
5362 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
5363 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
5364 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5365 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
5366 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
5367 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
5368 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5369 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
5370 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5371 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
5372 ; GFX11-WGP-NEXT: s_endpgm
5374 ; GFX11-CU-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5375 ; GFX11-CU: ; %bb.0: ; %entry
5376 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5377 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
5378 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
5379 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
5380 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5381 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
5382 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
5383 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
5384 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5385 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
5386 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5387 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
5388 ; GFX11-CU-NEXT: s_endpgm
5390 ; GFX12-WGP-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5391 ; GFX12-WGP: ; %bb.0: ; %entry
5392 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5393 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
5394 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
5395 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
5396 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
5397 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
5398 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
5399 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
5400 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5401 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
5402 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
5403 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
5404 ; GFX12-WGP-NEXT: s_endpgm
5406 ; GFX12-CU-LABEL: local_singlethread_monotonic_monotonic_ret_cmpxchg:
5407 ; GFX12-CU: ; %bb.0: ; %entry
5408 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5409 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
5410 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
5411 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
5412 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
5413 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
5414 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
5415 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
5416 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5417 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
5418 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
5419 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
5420 ; GFX12-CU-NEXT: s_endpgm
5421 ptr addrspace(3) %out, i32 %in, i32 %old) {
5423 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5424 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic monotonic
5425 %val0 = extractvalue { i32, i1 } %val, 0
5426 store i32 %val0, ptr addrspace(3) %out, align 4
5430 define amdgpu_kernel void @local_singlethread_acquire_monotonic_ret_cmpxchg(
5431 ; GFX6-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5432 ; GFX6: ; %bb.0: ; %entry
5433 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
5434 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
5435 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
5436 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
5437 ; GFX6-NEXT: s_mov_b32 m0, -1
5438 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5439 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
5440 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
5441 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
5442 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5443 ; GFX6-NEXT: s_mov_b32 m0, -1
5444 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
5445 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5446 ; GFX6-NEXT: ds_write_b32 v0, v1
5447 ; GFX6-NEXT: s_endpgm
5449 ; GFX7-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5450 ; GFX7: ; %bb.0: ; %entry
5451 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
5452 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
5453 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
5454 ; GFX7-NEXT: s_mov_b32 m0, -1
5455 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5456 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5457 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
5458 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
5459 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5460 ; GFX7-NEXT: s_mov_b32 m0, -1
5461 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5462 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5463 ; GFX7-NEXT: ds_write_b32 v0, v1
5464 ; GFX7-NEXT: s_endpgm
5466 ; GFX10-WGP-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5467 ; GFX10-WGP: ; %bb.0: ; %entry
5468 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
5469 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
5470 ; GFX10-WGP-NEXT: s_nop 0
5471 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
5472 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5473 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5474 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
5475 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
5476 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5477 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5478 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5479 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5480 ; GFX10-WGP-NEXT: s_endpgm
5482 ; GFX10-CU-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5483 ; GFX10-CU: ; %bb.0: ; %entry
5484 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
5485 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
5486 ; GFX10-CU-NEXT: s_nop 0
5487 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
5488 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5489 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5490 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
5491 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
5492 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5493 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5494 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5495 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5496 ; GFX10-CU-NEXT: s_endpgm
5498 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5499 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5500 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
5501 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
5502 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
5503 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5504 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5505 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5506 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5507 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5508 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5509 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5510 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5511 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5512 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5513 ; SKIP-CACHE-INV-NEXT: s_endpgm
5515 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5516 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5517 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
5518 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
5519 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
5520 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
5521 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5522 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5523 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5524 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
5525 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5526 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5527 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5528 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5529 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5531 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5532 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5533 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
5534 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
5535 ; GFX90A-TGSPLIT-NEXT: s_nop 0
5536 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
5537 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5538 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5539 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5540 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
5541 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5542 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5543 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5544 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5545 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5547 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5548 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5549 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
5550 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
5551 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
5552 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
5553 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5554 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5555 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5556 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5557 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5558 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5559 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5560 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5561 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5563 ; GFX940-TGSPLIT-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5564 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5565 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
5566 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
5567 ; GFX940-TGSPLIT-NEXT: s_nop 0
5568 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
5569 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5570 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5571 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5572 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5573 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5574 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5575 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5576 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
5577 ; GFX940-TGSPLIT-NEXT: s_endpgm
5579 ; GFX11-WGP-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5580 ; GFX11-WGP: ; %bb.0: ; %entry
5581 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5582 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
5583 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
5584 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
5585 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5586 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
5587 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
5588 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
5589 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5590 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
5591 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5592 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
5593 ; GFX11-WGP-NEXT: s_endpgm
5595 ; GFX11-CU-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5596 ; GFX11-CU: ; %bb.0: ; %entry
5597 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5598 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
5599 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
5600 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
5601 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5602 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
5603 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
5604 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
5605 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5606 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
5607 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5608 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
5609 ; GFX11-CU-NEXT: s_endpgm
5611 ; GFX12-WGP-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5612 ; GFX12-WGP: ; %bb.0: ; %entry
5613 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5614 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
5615 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
5616 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
5617 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
5618 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
5619 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
5620 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
5621 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5622 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
5623 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
5624 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
5625 ; GFX12-WGP-NEXT: s_endpgm
5627 ; GFX12-CU-LABEL: local_singlethread_acquire_monotonic_ret_cmpxchg:
5628 ; GFX12-CU: ; %bb.0: ; %entry
5629 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5630 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
5631 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
5632 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
5633 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
5634 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
5635 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
5636 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
5637 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5638 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
5639 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
5640 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
5641 ; GFX12-CU-NEXT: s_endpgm
5642 ptr addrspace(3) %out, i32 %in, i32 %old) {
5644 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5645 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acquire monotonic
5646 %val0 = extractvalue { i32, i1 } %val, 0
5647 store i32 %val0, ptr addrspace(3) %out, align 4
5651 define amdgpu_kernel void @local_singlethread_release_monotonic_ret_cmpxchg(
5652 ; GFX6-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5653 ; GFX6: ; %bb.0: ; %entry
5654 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
5655 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
5656 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
5657 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
5658 ; GFX6-NEXT: s_mov_b32 m0, -1
5659 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5660 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
5661 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
5662 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
5663 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5664 ; GFX6-NEXT: s_mov_b32 m0, -1
5665 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
5666 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5667 ; GFX6-NEXT: ds_write_b32 v0, v1
5668 ; GFX6-NEXT: s_endpgm
5670 ; GFX7-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5671 ; GFX7: ; %bb.0: ; %entry
5672 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
5673 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
5674 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
5675 ; GFX7-NEXT: s_mov_b32 m0, -1
5676 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5677 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5678 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
5679 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
5680 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5681 ; GFX7-NEXT: s_mov_b32 m0, -1
5682 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5683 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5684 ; GFX7-NEXT: ds_write_b32 v0, v1
5685 ; GFX7-NEXT: s_endpgm
5687 ; GFX10-WGP-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5688 ; GFX10-WGP: ; %bb.0: ; %entry
5689 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
5690 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
5691 ; GFX10-WGP-NEXT: s_nop 0
5692 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
5693 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5694 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5695 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
5696 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
5697 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5698 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5699 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5700 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5701 ; GFX10-WGP-NEXT: s_endpgm
5703 ; GFX10-CU-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5704 ; GFX10-CU: ; %bb.0: ; %entry
5705 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
5706 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
5707 ; GFX10-CU-NEXT: s_nop 0
5708 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
5709 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5710 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5711 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
5712 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
5713 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5714 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5715 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5716 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5717 ; GFX10-CU-NEXT: s_endpgm
5719 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5720 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5721 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
5722 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
5723 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
5724 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5725 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5726 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5727 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5728 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5729 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5730 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5731 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5732 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5733 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5734 ; SKIP-CACHE-INV-NEXT: s_endpgm
5736 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5737 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5738 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
5739 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
5740 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
5741 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
5742 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5743 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5744 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5745 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
5746 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5747 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5748 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5749 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5750 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5752 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5753 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5754 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
5755 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
5756 ; GFX90A-TGSPLIT-NEXT: s_nop 0
5757 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
5758 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5759 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5760 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5761 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
5762 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5763 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5764 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5765 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5766 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5768 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5769 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5770 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
5771 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
5772 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
5773 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
5774 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5775 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5776 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5777 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5778 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5779 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5780 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5781 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5782 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
5784 ; GFX940-TGSPLIT-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5785 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
5786 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
5787 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
5788 ; GFX940-TGSPLIT-NEXT: s_nop 0
5789 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
5790 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5791 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5792 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5793 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5794 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5795 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5796 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5797 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
5798 ; GFX940-TGSPLIT-NEXT: s_endpgm
5800 ; GFX11-WGP-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5801 ; GFX11-WGP: ; %bb.0: ; %entry
5802 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5803 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
5804 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
5805 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
5806 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5807 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
5808 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
5809 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
5810 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5811 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
5812 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
5813 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
5814 ; GFX11-WGP-NEXT: s_endpgm
5816 ; GFX11-CU-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5817 ; GFX11-CU: ; %bb.0: ; %entry
5818 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5819 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
5820 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
5821 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
5822 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5823 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
5824 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
5825 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
5826 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5827 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
5828 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
5829 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
5830 ; GFX11-CU-NEXT: s_endpgm
5832 ; GFX12-WGP-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5833 ; GFX12-WGP: ; %bb.0: ; %entry
5834 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
5835 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
5836 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
5837 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
5838 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
5839 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
5840 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
5841 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
5842 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5843 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
5844 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
5845 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
5846 ; GFX12-WGP-NEXT: s_endpgm
5848 ; GFX12-CU-LABEL: local_singlethread_release_monotonic_ret_cmpxchg:
5849 ; GFX12-CU: ; %bb.0: ; %entry
5850 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
5851 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
5852 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
5853 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
5854 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
5855 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
5856 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
5857 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
5858 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
5859 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
5860 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
5861 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
5862 ; GFX12-CU-NEXT: s_endpgm
5863 ptr addrspace(3) %out, i32 %in, i32 %old) {
5865 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
5866 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") release monotonic
5867 %val0 = extractvalue { i32, i1 } %val, 0
5868 store i32 %val0, ptr addrspace(3) %out, align 4
5872 define amdgpu_kernel void @local_singlethread_acq_rel_monotonic_ret_cmpxchg(
5873 ; GFX6-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
5874 ; GFX6: ; %bb.0: ; %entry
5875 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
5876 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
5877 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
5878 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
5879 ; GFX6-NEXT: s_mov_b32 m0, -1
5880 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5881 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
5882 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
5883 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
5884 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5885 ; GFX6-NEXT: s_mov_b32 m0, -1
5886 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
5887 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
5888 ; GFX6-NEXT: ds_write_b32 v0, v1
5889 ; GFX6-NEXT: s_endpgm
5891 ; GFX7-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
5892 ; GFX7: ; %bb.0: ; %entry
5893 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
5894 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
5895 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
5896 ; GFX7-NEXT: s_mov_b32 m0, -1
5897 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5898 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5899 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
5900 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
5901 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5902 ; GFX7-NEXT: s_mov_b32 m0, -1
5903 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
5904 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
5905 ; GFX7-NEXT: ds_write_b32 v0, v1
5906 ; GFX7-NEXT: s_endpgm
5908 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
5909 ; GFX10-WGP: ; %bb.0: ; %entry
5910 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
5911 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
5912 ; GFX10-WGP-NEXT: s_nop 0
5913 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
5914 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5915 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5916 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
5917 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
5918 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5919 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
5920 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
5921 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
5922 ; GFX10-WGP-NEXT: s_endpgm
5924 ; GFX10-CU-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
5925 ; GFX10-CU: ; %bb.0: ; %entry
5926 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
5927 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
5928 ; GFX10-CU-NEXT: s_nop 0
5929 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
5930 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5931 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5932 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
5933 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
5934 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5935 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
5936 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
5937 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
5938 ; GFX10-CU-NEXT: s_endpgm
5940 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
5941 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
5942 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
5943 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
5944 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
5945 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5946 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5947 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5948 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
5949 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
5950 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5951 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
5952 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
5953 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
5954 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
5955 ; SKIP-CACHE-INV-NEXT: s_endpgm
5957 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
5958 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
5959 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
5960 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
5961 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
5962 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
5963 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5964 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5965 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5966 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
5967 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5968 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5969 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5970 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
5971 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
5973 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
5974 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
5975 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
5976 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
5977 ; GFX90A-TGSPLIT-NEXT: s_nop 0
5978 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
5979 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5980 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5981 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
5982 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
5983 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
5984 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
5985 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5986 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
5987 ; GFX90A-TGSPLIT-NEXT: s_endpgm
5989 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
5990 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
5991 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
5992 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
5993 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
5994 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
5995 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
5996 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
5997 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
5998 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
5999 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6000 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6001 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6002 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6003 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6005 ; GFX940-TGSPLIT-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
6006 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6007 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
6008 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
6009 ; GFX940-TGSPLIT-NEXT: s_nop 0
6010 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
6011 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6012 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6013 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6014 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6015 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6016 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6017 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6018 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
6019 ; GFX940-TGSPLIT-NEXT: s_endpgm
6021 ; GFX11-WGP-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
6022 ; GFX11-WGP: ; %bb.0: ; %entry
6023 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6024 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6025 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6026 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6027 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6028 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6029 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
6030 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
6031 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6032 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6033 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6034 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
6035 ; GFX11-WGP-NEXT: s_endpgm
6037 ; GFX11-CU-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
6038 ; GFX11-CU: ; %bb.0: ; %entry
6039 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6040 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6041 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6042 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6043 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6044 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6045 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
6046 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
6047 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6048 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6049 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6050 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
6051 ; GFX11-CU-NEXT: s_endpgm
6053 ; GFX12-WGP-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
6054 ; GFX12-WGP: ; %bb.0: ; %entry
6055 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6056 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6057 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6058 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6059 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
6060 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6061 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
6062 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
6063 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6064 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6065 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
6066 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
6067 ; GFX12-WGP-NEXT: s_endpgm
6069 ; GFX12-CU-LABEL: local_singlethread_acq_rel_monotonic_ret_cmpxchg:
6070 ; GFX12-CU: ; %bb.0: ; %entry
6071 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6072 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6073 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6074 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6075 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
6076 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6077 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
6078 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
6079 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6080 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6081 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
6082 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
6083 ; GFX12-CU-NEXT: s_endpgm
6084 ptr addrspace(3) %out, i32 %in, i32 %old) {
6086 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
6087 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel monotonic
6088 %val0 = extractvalue { i32, i1 } %val, 0
6089 store i32 %val0, ptr addrspace(3) %out, align 4
6093 define amdgpu_kernel void @local_singlethread_seq_cst_monotonic_ret_cmpxchg(
6094 ; GFX6-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6095 ; GFX6: ; %bb.0: ; %entry
6096 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
6097 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
6098 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
6099 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
6100 ; GFX6-NEXT: s_mov_b32 m0, -1
6101 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6102 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6103 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
6104 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
6105 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6106 ; GFX6-NEXT: s_mov_b32 m0, -1
6107 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6108 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6109 ; GFX6-NEXT: ds_write_b32 v0, v1
6110 ; GFX6-NEXT: s_endpgm
6112 ; GFX7-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6113 ; GFX7: ; %bb.0: ; %entry
6114 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
6115 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
6116 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
6117 ; GFX7-NEXT: s_mov_b32 m0, -1
6118 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6119 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6120 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
6121 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
6122 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6123 ; GFX7-NEXT: s_mov_b32 m0, -1
6124 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6125 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6126 ; GFX7-NEXT: ds_write_b32 v0, v1
6127 ; GFX7-NEXT: s_endpgm
6129 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6130 ; GFX10-WGP: ; %bb.0: ; %entry
6131 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
6132 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
6133 ; GFX10-WGP-NEXT: s_nop 0
6134 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
6135 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6136 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6137 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
6138 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
6139 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6140 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6141 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6142 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6143 ; GFX10-WGP-NEXT: s_endpgm
6145 ; GFX10-CU-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6146 ; GFX10-CU: ; %bb.0: ; %entry
6147 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
6148 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
6149 ; GFX10-CU-NEXT: s_nop 0
6150 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
6151 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6152 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6153 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
6154 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
6155 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6156 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6157 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6158 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6159 ; GFX10-CU-NEXT: s_endpgm
6161 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6162 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6163 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
6164 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
6165 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
6166 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6167 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6168 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6169 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
6170 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
6171 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6172 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6173 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6174 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6175 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6176 ; SKIP-CACHE-INV-NEXT: s_endpgm
6178 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6179 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6180 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
6181 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
6182 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
6183 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
6184 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6185 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6186 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6187 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
6188 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6189 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6190 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6191 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6192 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6194 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6195 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6196 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
6197 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
6198 ; GFX90A-TGSPLIT-NEXT: s_nop 0
6199 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
6200 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6201 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6202 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6203 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
6204 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6205 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6206 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6207 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6208 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6210 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6211 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6212 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
6213 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
6214 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
6215 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
6216 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6217 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6218 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6219 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6220 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6221 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6222 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6223 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6224 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6226 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6227 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6228 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
6229 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
6230 ; GFX940-TGSPLIT-NEXT: s_nop 0
6231 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
6232 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6233 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6234 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6235 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6236 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6237 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6238 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6239 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
6240 ; GFX940-TGSPLIT-NEXT: s_endpgm
6242 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6243 ; GFX11-WGP: ; %bb.0: ; %entry
6244 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6245 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6246 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6247 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6248 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6249 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6250 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
6251 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
6252 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6253 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6254 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6255 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
6256 ; GFX11-WGP-NEXT: s_endpgm
6258 ; GFX11-CU-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6259 ; GFX11-CU: ; %bb.0: ; %entry
6260 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6261 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6262 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6263 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6264 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6265 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6266 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
6267 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
6268 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6269 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6270 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6271 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
6272 ; GFX11-CU-NEXT: s_endpgm
6274 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6275 ; GFX12-WGP: ; %bb.0: ; %entry
6276 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6277 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6278 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6279 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6280 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
6281 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6282 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
6283 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
6284 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6285 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6286 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
6287 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
6288 ; GFX12-WGP-NEXT: s_endpgm
6290 ; GFX12-CU-LABEL: local_singlethread_seq_cst_monotonic_ret_cmpxchg:
6291 ; GFX12-CU: ; %bb.0: ; %entry
6292 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6293 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6294 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6295 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6296 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
6297 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6298 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
6299 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
6300 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6301 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6302 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
6303 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
6304 ; GFX12-CU-NEXT: s_endpgm
6305 ptr addrspace(3) %out, i32 %in, i32 %old) {
6307 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
6308 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst monotonic
6309 %val0 = extractvalue { i32, i1 } %val, 0
6310 store i32 %val0, ptr addrspace(3) %out, align 4
6314 define amdgpu_kernel void @local_singlethread_monotonic_acquire_ret_cmpxchg(
6315 ; GFX6-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6316 ; GFX6: ; %bb.0: ; %entry
6317 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
6318 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
6319 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
6320 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
6321 ; GFX6-NEXT: s_mov_b32 m0, -1
6322 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6323 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6324 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
6325 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
6326 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6327 ; GFX6-NEXT: s_mov_b32 m0, -1
6328 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6329 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6330 ; GFX6-NEXT: ds_write_b32 v0, v1
6331 ; GFX6-NEXT: s_endpgm
6333 ; GFX7-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6334 ; GFX7: ; %bb.0: ; %entry
6335 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
6336 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
6337 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
6338 ; GFX7-NEXT: s_mov_b32 m0, -1
6339 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6340 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6341 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
6342 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
6343 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6344 ; GFX7-NEXT: s_mov_b32 m0, -1
6345 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6346 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6347 ; GFX7-NEXT: ds_write_b32 v0, v1
6348 ; GFX7-NEXT: s_endpgm
6350 ; GFX10-WGP-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6351 ; GFX10-WGP: ; %bb.0: ; %entry
6352 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
6353 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
6354 ; GFX10-WGP-NEXT: s_nop 0
6355 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
6356 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6357 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6358 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
6359 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
6360 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6361 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6362 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6363 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6364 ; GFX10-WGP-NEXT: s_endpgm
6366 ; GFX10-CU-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6367 ; GFX10-CU: ; %bb.0: ; %entry
6368 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
6369 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
6370 ; GFX10-CU-NEXT: s_nop 0
6371 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
6372 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6373 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6374 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
6375 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
6376 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6377 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6378 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6379 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6380 ; GFX10-CU-NEXT: s_endpgm
6382 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6383 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6384 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
6385 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
6386 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
6387 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6388 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6389 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6390 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
6391 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
6392 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6393 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6394 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6395 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6396 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6397 ; SKIP-CACHE-INV-NEXT: s_endpgm
6399 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6400 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6401 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
6402 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
6403 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
6404 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
6405 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6406 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6407 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6408 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
6409 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6410 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6411 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6412 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6413 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6415 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6416 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6417 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
6418 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
6419 ; GFX90A-TGSPLIT-NEXT: s_nop 0
6420 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
6421 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6422 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6423 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6424 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
6425 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6426 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6427 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6428 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6429 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6431 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6432 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6433 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
6434 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
6435 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
6436 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
6437 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6438 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6439 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6440 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6441 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6442 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6443 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6444 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6445 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6447 ; GFX940-TGSPLIT-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6448 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6449 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
6450 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
6451 ; GFX940-TGSPLIT-NEXT: s_nop 0
6452 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
6453 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6454 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6455 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6456 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6457 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6458 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6459 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6460 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
6461 ; GFX940-TGSPLIT-NEXT: s_endpgm
6463 ; GFX11-WGP-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6464 ; GFX11-WGP: ; %bb.0: ; %entry
6465 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6466 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6467 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6468 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6469 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6470 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6471 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
6472 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
6473 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6474 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6475 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6476 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
6477 ; GFX11-WGP-NEXT: s_endpgm
6479 ; GFX11-CU-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6480 ; GFX11-CU: ; %bb.0: ; %entry
6481 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6482 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6483 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6484 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6485 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6486 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6487 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
6488 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
6489 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6490 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6491 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6492 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
6493 ; GFX11-CU-NEXT: s_endpgm
6495 ; GFX12-WGP-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6496 ; GFX12-WGP: ; %bb.0: ; %entry
6497 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6498 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6499 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6500 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6501 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
6502 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6503 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
6504 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
6505 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6506 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6507 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
6508 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
6509 ; GFX12-WGP-NEXT: s_endpgm
6511 ; GFX12-CU-LABEL: local_singlethread_monotonic_acquire_ret_cmpxchg:
6512 ; GFX12-CU: ; %bb.0: ; %entry
6513 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6514 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6515 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6516 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6517 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
6518 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6519 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
6520 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
6521 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6522 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6523 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
6524 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
6525 ; GFX12-CU-NEXT: s_endpgm
6526 ptr addrspace(3) %out, i32 %in, i32 %old) {
6528 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
6529 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic acquire
6530 %val0 = extractvalue { i32, i1 } %val, 0
6531 store i32 %val0, ptr addrspace(3) %out, align 4
6535 define amdgpu_kernel void @local_singlethread_acquire_acquire_ret_cmpxchg(
6536 ; GFX6-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6537 ; GFX6: ; %bb.0: ; %entry
6538 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
6539 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
6540 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
6541 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
6542 ; GFX6-NEXT: s_mov_b32 m0, -1
6543 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6544 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6545 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
6546 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
6547 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6548 ; GFX6-NEXT: s_mov_b32 m0, -1
6549 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6550 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6551 ; GFX6-NEXT: ds_write_b32 v0, v1
6552 ; GFX6-NEXT: s_endpgm
6554 ; GFX7-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6555 ; GFX7: ; %bb.0: ; %entry
6556 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
6557 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
6558 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
6559 ; GFX7-NEXT: s_mov_b32 m0, -1
6560 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6561 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6562 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
6563 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
6564 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6565 ; GFX7-NEXT: s_mov_b32 m0, -1
6566 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6567 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6568 ; GFX7-NEXT: ds_write_b32 v0, v1
6569 ; GFX7-NEXT: s_endpgm
6571 ; GFX10-WGP-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6572 ; GFX10-WGP: ; %bb.0: ; %entry
6573 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
6574 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
6575 ; GFX10-WGP-NEXT: s_nop 0
6576 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
6577 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6578 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6579 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
6580 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
6581 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6582 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6583 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6584 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6585 ; GFX10-WGP-NEXT: s_endpgm
6587 ; GFX10-CU-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6588 ; GFX10-CU: ; %bb.0: ; %entry
6589 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
6590 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
6591 ; GFX10-CU-NEXT: s_nop 0
6592 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
6593 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6594 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6595 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
6596 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
6597 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6598 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6599 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6600 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6601 ; GFX10-CU-NEXT: s_endpgm
6603 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6604 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6605 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
6606 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
6607 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
6608 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6609 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6610 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6611 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
6612 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
6613 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6614 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6615 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6616 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6617 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6618 ; SKIP-CACHE-INV-NEXT: s_endpgm
6620 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6621 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6622 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
6623 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
6624 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
6625 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
6626 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6627 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6628 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6629 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
6630 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6631 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6632 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6633 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6634 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6636 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6637 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6638 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
6639 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
6640 ; GFX90A-TGSPLIT-NEXT: s_nop 0
6641 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
6642 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6643 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6644 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6645 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
6646 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6647 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6648 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6649 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6650 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6652 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6653 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6654 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
6655 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
6656 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
6657 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
6658 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6659 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6660 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6661 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6662 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6663 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6664 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6665 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6666 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6668 ; GFX940-TGSPLIT-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6669 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6670 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
6671 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
6672 ; GFX940-TGSPLIT-NEXT: s_nop 0
6673 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
6674 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6675 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6676 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6677 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6678 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6679 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6680 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6681 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
6682 ; GFX940-TGSPLIT-NEXT: s_endpgm
6684 ; GFX11-WGP-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6685 ; GFX11-WGP: ; %bb.0: ; %entry
6686 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6687 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6688 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6689 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6690 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6691 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6692 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
6693 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
6694 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6695 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6696 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6697 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
6698 ; GFX11-WGP-NEXT: s_endpgm
6700 ; GFX11-CU-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6701 ; GFX11-CU: ; %bb.0: ; %entry
6702 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6703 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6704 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6705 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6706 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6707 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6708 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
6709 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
6710 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6711 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6712 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6713 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
6714 ; GFX11-CU-NEXT: s_endpgm
6716 ; GFX12-WGP-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6717 ; GFX12-WGP: ; %bb.0: ; %entry
6718 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6719 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6720 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6721 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6722 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
6723 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6724 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
6725 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
6726 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6727 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6728 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
6729 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
6730 ; GFX12-WGP-NEXT: s_endpgm
6732 ; GFX12-CU-LABEL: local_singlethread_acquire_acquire_ret_cmpxchg:
6733 ; GFX12-CU: ; %bb.0: ; %entry
6734 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6735 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6736 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6737 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6738 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
6739 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6740 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
6741 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
6742 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6743 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6744 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
6745 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
6746 ; GFX12-CU-NEXT: s_endpgm
6747 ptr addrspace(3) %out, i32 %in, i32 %old) {
6749 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
6750 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acquire acquire
6751 %val0 = extractvalue { i32, i1 } %val, 0
6752 store i32 %val0, ptr addrspace(3) %out, align 4
6756 define amdgpu_kernel void @local_singlethread_release_acquire_ret_cmpxchg(
6757 ; GFX6-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6758 ; GFX6: ; %bb.0: ; %entry
6759 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
6760 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
6761 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
6762 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
6763 ; GFX6-NEXT: s_mov_b32 m0, -1
6764 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6765 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6766 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
6767 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
6768 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6769 ; GFX6-NEXT: s_mov_b32 m0, -1
6770 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6771 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6772 ; GFX6-NEXT: ds_write_b32 v0, v1
6773 ; GFX6-NEXT: s_endpgm
6775 ; GFX7-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6776 ; GFX7: ; %bb.0: ; %entry
6777 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
6778 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
6779 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
6780 ; GFX7-NEXT: s_mov_b32 m0, -1
6781 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6782 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6783 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
6784 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
6785 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6786 ; GFX7-NEXT: s_mov_b32 m0, -1
6787 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
6788 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
6789 ; GFX7-NEXT: ds_write_b32 v0, v1
6790 ; GFX7-NEXT: s_endpgm
6792 ; GFX10-WGP-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6793 ; GFX10-WGP: ; %bb.0: ; %entry
6794 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
6795 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
6796 ; GFX10-WGP-NEXT: s_nop 0
6797 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
6798 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6799 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6800 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
6801 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
6802 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6803 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
6804 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
6805 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
6806 ; GFX10-WGP-NEXT: s_endpgm
6808 ; GFX10-CU-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6809 ; GFX10-CU: ; %bb.0: ; %entry
6810 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
6811 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
6812 ; GFX10-CU-NEXT: s_nop 0
6813 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
6814 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6815 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6816 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
6817 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
6818 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6819 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
6820 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
6821 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
6822 ; GFX10-CU-NEXT: s_endpgm
6824 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6825 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
6826 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
6827 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
6828 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
6829 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6830 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6831 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6832 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
6833 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
6834 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6835 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
6836 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
6837 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
6838 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
6839 ; SKIP-CACHE-INV-NEXT: s_endpgm
6841 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6842 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
6843 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
6844 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
6845 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
6846 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
6847 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6848 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6849 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6850 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
6851 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6852 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6853 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6854 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6855 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
6857 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6858 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
6859 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
6860 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
6861 ; GFX90A-TGSPLIT-NEXT: s_nop 0
6862 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
6863 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6864 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6865 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
6866 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
6867 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6868 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
6869 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6870 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
6871 ; GFX90A-TGSPLIT-NEXT: s_endpgm
6873 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6874 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
6875 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
6876 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
6877 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
6878 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
6879 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6880 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6881 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6882 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6883 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6884 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6885 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6886 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
6887 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
6889 ; GFX940-TGSPLIT-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6890 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
6891 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
6892 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
6893 ; GFX940-TGSPLIT-NEXT: s_nop 0
6894 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
6895 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6896 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6897 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
6898 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
6899 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6900 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
6901 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
6902 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
6903 ; GFX940-TGSPLIT-NEXT: s_endpgm
6905 ; GFX11-WGP-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6906 ; GFX11-WGP: ; %bb.0: ; %entry
6907 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6908 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6909 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6910 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6911 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6912 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6913 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
6914 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
6915 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6916 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
6917 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
6918 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
6919 ; GFX11-WGP-NEXT: s_endpgm
6921 ; GFX11-CU-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6922 ; GFX11-CU: ; %bb.0: ; %entry
6923 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6924 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6925 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6926 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6927 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6928 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6929 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
6930 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
6931 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6932 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
6933 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
6934 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
6935 ; GFX11-CU-NEXT: s_endpgm
6937 ; GFX12-WGP-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6938 ; GFX12-WGP: ; %bb.0: ; %entry
6939 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
6940 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
6941 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
6942 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
6943 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
6944 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6945 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
6946 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
6947 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6948 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
6949 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
6950 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
6951 ; GFX12-WGP-NEXT: s_endpgm
6953 ; GFX12-CU-LABEL: local_singlethread_release_acquire_ret_cmpxchg:
6954 ; GFX12-CU: ; %bb.0: ; %entry
6955 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
6956 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
6957 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
6958 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
6959 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
6960 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6961 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
6962 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
6963 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
6964 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
6965 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
6966 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
6967 ; GFX12-CU-NEXT: s_endpgm
6968 ptr addrspace(3) %out, i32 %in, i32 %old) {
6970 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
6971 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") release acquire
6972 %val0 = extractvalue { i32, i1 } %val, 0
6973 store i32 %val0, ptr addrspace(3) %out, align 4
6977 define amdgpu_kernel void @local_singlethread_acq_rel_acquire_ret_cmpxchg(
6978 ; GFX6-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
6979 ; GFX6: ; %bb.0: ; %entry
6980 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
6981 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
6982 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
6983 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
6984 ; GFX6-NEXT: s_mov_b32 m0, -1
6985 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6986 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6987 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
6988 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
6989 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
6990 ; GFX6-NEXT: s_mov_b32 m0, -1
6991 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
6992 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
6993 ; GFX6-NEXT: ds_write_b32 v0, v1
6994 ; GFX6-NEXT: s_endpgm
6996 ; GFX7-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
6997 ; GFX7: ; %bb.0: ; %entry
6998 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
6999 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
7000 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
7001 ; GFX7-NEXT: s_mov_b32 m0, -1
7002 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7003 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7004 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
7005 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
7006 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7007 ; GFX7-NEXT: s_mov_b32 m0, -1
7008 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7009 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7010 ; GFX7-NEXT: ds_write_b32 v0, v1
7011 ; GFX7-NEXT: s_endpgm
7013 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7014 ; GFX10-WGP: ; %bb.0: ; %entry
7015 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
7016 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
7017 ; GFX10-WGP-NEXT: s_nop 0
7018 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
7019 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7020 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7021 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
7022 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
7023 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7024 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7025 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7026 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7027 ; GFX10-WGP-NEXT: s_endpgm
7029 ; GFX10-CU-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7030 ; GFX10-CU: ; %bb.0: ; %entry
7031 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
7032 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
7033 ; GFX10-CU-NEXT: s_nop 0
7034 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
7035 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7036 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7037 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
7038 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
7039 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7040 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7041 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7042 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7043 ; GFX10-CU-NEXT: s_endpgm
7045 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7046 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7047 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
7048 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
7049 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
7050 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7051 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7052 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7053 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
7054 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
7055 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7056 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7057 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7058 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7059 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7060 ; SKIP-CACHE-INV-NEXT: s_endpgm
7062 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7063 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7064 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7065 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7066 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
7067 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7068 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7069 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7070 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7071 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7072 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7073 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7074 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7075 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7076 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7078 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7079 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7080 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7081 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7082 ; GFX90A-TGSPLIT-NEXT: s_nop 0
7083 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7084 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7085 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7086 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7087 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7088 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7089 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7090 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7091 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7092 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7094 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7095 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7096 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7097 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7098 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
7099 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
7100 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7101 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7102 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7103 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7104 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7105 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7106 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7107 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7108 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7110 ; GFX940-TGSPLIT-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7111 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7112 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7113 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7114 ; GFX940-TGSPLIT-NEXT: s_nop 0
7115 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
7116 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7117 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7118 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7119 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7120 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7121 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7122 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7123 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
7124 ; GFX940-TGSPLIT-NEXT: s_endpgm
7126 ; GFX11-WGP-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7127 ; GFX11-WGP: ; %bb.0: ; %entry
7128 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7129 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
7130 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
7131 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
7132 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7133 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
7134 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
7135 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
7136 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7137 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
7138 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7139 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
7140 ; GFX11-WGP-NEXT: s_endpgm
7142 ; GFX11-CU-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7143 ; GFX11-CU: ; %bb.0: ; %entry
7144 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7145 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
7146 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
7147 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
7148 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7149 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
7150 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
7151 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
7152 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7153 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
7154 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7155 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
7156 ; GFX11-CU-NEXT: s_endpgm
7158 ; GFX12-WGP-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7159 ; GFX12-WGP: ; %bb.0: ; %entry
7160 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7161 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
7162 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
7163 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
7164 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
7165 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
7166 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
7167 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
7168 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7169 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
7170 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
7171 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
7172 ; GFX12-WGP-NEXT: s_endpgm
7174 ; GFX12-CU-LABEL: local_singlethread_acq_rel_acquire_ret_cmpxchg:
7175 ; GFX12-CU: ; %bb.0: ; %entry
7176 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7177 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
7178 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
7179 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
7180 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
7181 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
7182 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
7183 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
7184 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7185 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
7186 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
7187 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
7188 ; GFX12-CU-NEXT: s_endpgm
7189 ptr addrspace(3) %out, i32 %in, i32 %old) {
7191 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
7192 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel acquire
7193 %val0 = extractvalue { i32, i1 } %val, 0
7194 store i32 %val0, ptr addrspace(3) %out, align 4
7198 define amdgpu_kernel void @local_singlethread_seq_cst_acquire_ret_cmpxchg(
7199 ; GFX6-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7200 ; GFX6: ; %bb.0: ; %entry
7201 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
7202 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
7203 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
7204 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
7205 ; GFX6-NEXT: s_mov_b32 m0, -1
7206 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7207 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
7208 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
7209 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
7210 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7211 ; GFX6-NEXT: s_mov_b32 m0, -1
7212 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
7213 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7214 ; GFX6-NEXT: ds_write_b32 v0, v1
7215 ; GFX6-NEXT: s_endpgm
7217 ; GFX7-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7218 ; GFX7: ; %bb.0: ; %entry
7219 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
7220 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
7221 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
7222 ; GFX7-NEXT: s_mov_b32 m0, -1
7223 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7224 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7225 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
7226 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
7227 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7228 ; GFX7-NEXT: s_mov_b32 m0, -1
7229 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7230 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7231 ; GFX7-NEXT: ds_write_b32 v0, v1
7232 ; GFX7-NEXT: s_endpgm
7234 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7235 ; GFX10-WGP: ; %bb.0: ; %entry
7236 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
7237 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
7238 ; GFX10-WGP-NEXT: s_nop 0
7239 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
7240 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7241 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7242 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
7243 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
7244 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7245 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7246 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7247 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7248 ; GFX10-WGP-NEXT: s_endpgm
7250 ; GFX10-CU-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7251 ; GFX10-CU: ; %bb.0: ; %entry
7252 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
7253 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
7254 ; GFX10-CU-NEXT: s_nop 0
7255 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
7256 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7257 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7258 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
7259 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
7260 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7261 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7262 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7263 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7264 ; GFX10-CU-NEXT: s_endpgm
7266 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7267 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7268 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
7269 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
7270 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
7271 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7272 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7273 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7274 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
7275 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
7276 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7277 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7278 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7279 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7280 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7281 ; SKIP-CACHE-INV-NEXT: s_endpgm
7283 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7284 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7285 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7286 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7287 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
7288 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7289 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7290 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7291 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7292 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7293 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7294 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7295 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7296 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7297 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7299 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7300 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7301 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7302 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7303 ; GFX90A-TGSPLIT-NEXT: s_nop 0
7304 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7305 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7306 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7307 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7308 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7309 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7310 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7311 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7312 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7313 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7315 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7316 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7317 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7318 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7319 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
7320 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
7321 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7322 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7323 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7324 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7325 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7326 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7327 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7328 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7329 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7331 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7332 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7333 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7334 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7335 ; GFX940-TGSPLIT-NEXT: s_nop 0
7336 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
7337 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7338 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7339 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7340 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7341 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7342 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7343 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7344 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
7345 ; GFX940-TGSPLIT-NEXT: s_endpgm
7347 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7348 ; GFX11-WGP: ; %bb.0: ; %entry
7349 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7350 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
7351 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
7352 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
7353 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7354 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
7355 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
7356 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
7357 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7358 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
7359 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7360 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
7361 ; GFX11-WGP-NEXT: s_endpgm
7363 ; GFX11-CU-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7364 ; GFX11-CU: ; %bb.0: ; %entry
7365 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7366 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
7367 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
7368 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
7369 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7370 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
7371 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
7372 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
7373 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7374 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
7375 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7376 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
7377 ; GFX11-CU-NEXT: s_endpgm
7379 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7380 ; GFX12-WGP: ; %bb.0: ; %entry
7381 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7382 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
7383 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
7384 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
7385 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
7386 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
7387 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
7388 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
7389 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7390 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
7391 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
7392 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
7393 ; GFX12-WGP-NEXT: s_endpgm
7395 ; GFX12-CU-LABEL: local_singlethread_seq_cst_acquire_ret_cmpxchg:
7396 ; GFX12-CU: ; %bb.0: ; %entry
7397 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7398 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
7399 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
7400 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
7401 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
7402 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
7403 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
7404 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
7405 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7406 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
7407 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
7408 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
7409 ; GFX12-CU-NEXT: s_endpgm
7410 ptr addrspace(3) %out, i32 %in, i32 %old) {
7412 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
7413 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst acquire
7414 %val0 = extractvalue { i32, i1 } %val, 0
7415 store i32 %val0, ptr addrspace(3) %out, align 4
7419 define amdgpu_kernel void @local_singlethread_monotonic_seq_cst_ret_cmpxchg(
7420 ; GFX6-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7421 ; GFX6: ; %bb.0: ; %entry
7422 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
7423 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
7424 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
7425 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
7426 ; GFX6-NEXT: s_mov_b32 m0, -1
7427 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7428 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
7429 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
7430 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
7431 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7432 ; GFX6-NEXT: s_mov_b32 m0, -1
7433 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
7434 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7435 ; GFX6-NEXT: ds_write_b32 v0, v1
7436 ; GFX6-NEXT: s_endpgm
7438 ; GFX7-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7439 ; GFX7: ; %bb.0: ; %entry
7440 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
7441 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
7442 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
7443 ; GFX7-NEXT: s_mov_b32 m0, -1
7444 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7445 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7446 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
7447 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
7448 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7449 ; GFX7-NEXT: s_mov_b32 m0, -1
7450 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7451 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7452 ; GFX7-NEXT: ds_write_b32 v0, v1
7453 ; GFX7-NEXT: s_endpgm
7455 ; GFX10-WGP-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7456 ; GFX10-WGP: ; %bb.0: ; %entry
7457 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
7458 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
7459 ; GFX10-WGP-NEXT: s_nop 0
7460 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
7461 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7462 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7463 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
7464 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
7465 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7466 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7467 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7468 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7469 ; GFX10-WGP-NEXT: s_endpgm
7471 ; GFX10-CU-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7472 ; GFX10-CU: ; %bb.0: ; %entry
7473 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
7474 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
7475 ; GFX10-CU-NEXT: s_nop 0
7476 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
7477 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7478 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7479 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
7480 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
7481 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7482 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7483 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7484 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7485 ; GFX10-CU-NEXT: s_endpgm
7487 ; SKIP-CACHE-INV-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7488 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7489 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
7490 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
7491 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
7492 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7493 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7494 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7495 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
7496 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
7497 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7498 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7499 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7500 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7501 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7502 ; SKIP-CACHE-INV-NEXT: s_endpgm
7504 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7505 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7506 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7507 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7508 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
7509 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7510 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7511 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7512 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7513 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7514 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7515 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7516 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7517 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7518 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7520 ; GFX90A-TGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7521 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7522 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7523 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7524 ; GFX90A-TGSPLIT-NEXT: s_nop 0
7525 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7526 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7527 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7528 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7529 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7530 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7531 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7532 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7533 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7534 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7536 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7537 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7538 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7539 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7540 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
7541 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
7542 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7543 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7544 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7545 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7546 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7547 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7548 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7549 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7550 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7552 ; GFX940-TGSPLIT-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7553 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7554 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7555 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7556 ; GFX940-TGSPLIT-NEXT: s_nop 0
7557 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
7558 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7559 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7560 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7561 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7562 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7563 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7564 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7565 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
7566 ; GFX940-TGSPLIT-NEXT: s_endpgm
7568 ; GFX11-WGP-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7569 ; GFX11-WGP: ; %bb.0: ; %entry
7570 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7571 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
7572 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
7573 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
7574 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7575 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
7576 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
7577 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
7578 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7579 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
7580 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7581 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
7582 ; GFX11-WGP-NEXT: s_endpgm
7584 ; GFX11-CU-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7585 ; GFX11-CU: ; %bb.0: ; %entry
7586 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7587 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
7588 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
7589 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
7590 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7591 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
7592 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
7593 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
7594 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7595 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
7596 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7597 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
7598 ; GFX11-CU-NEXT: s_endpgm
7600 ; GFX12-WGP-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7601 ; GFX12-WGP: ; %bb.0: ; %entry
7602 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7603 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
7604 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
7605 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
7606 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
7607 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
7608 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
7609 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
7610 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7611 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
7612 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
7613 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
7614 ; GFX12-WGP-NEXT: s_endpgm
7616 ; GFX12-CU-LABEL: local_singlethread_monotonic_seq_cst_ret_cmpxchg:
7617 ; GFX12-CU: ; %bb.0: ; %entry
7618 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7619 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
7620 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
7621 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
7622 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
7623 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
7624 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
7625 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
7626 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7627 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
7628 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
7629 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
7630 ; GFX12-CU-NEXT: s_endpgm
7631 ptr addrspace(3) %out, i32 %in, i32 %old) {
7633 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
7634 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") monotonic seq_cst
7635 %val0 = extractvalue { i32, i1 } %val, 0
7636 store i32 %val0, ptr addrspace(3) %out, align 4
7640 define amdgpu_kernel void @local_singlethread_acquire_seq_cst_ret_cmpxchg(
7641 ; GFX6-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7642 ; GFX6: ; %bb.0: ; %entry
7643 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
7644 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
7645 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
7646 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
7647 ; GFX6-NEXT: s_mov_b32 m0, -1
7648 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7649 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
7650 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
7651 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
7652 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7653 ; GFX6-NEXT: s_mov_b32 m0, -1
7654 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
7655 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7656 ; GFX6-NEXT: ds_write_b32 v0, v1
7657 ; GFX6-NEXT: s_endpgm
7659 ; GFX7-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7660 ; GFX7: ; %bb.0: ; %entry
7661 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
7662 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
7663 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
7664 ; GFX7-NEXT: s_mov_b32 m0, -1
7665 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7666 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7667 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
7668 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
7669 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7670 ; GFX7-NEXT: s_mov_b32 m0, -1
7671 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7672 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7673 ; GFX7-NEXT: ds_write_b32 v0, v1
7674 ; GFX7-NEXT: s_endpgm
7676 ; GFX10-WGP-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7677 ; GFX10-WGP: ; %bb.0: ; %entry
7678 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
7679 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
7680 ; GFX10-WGP-NEXT: s_nop 0
7681 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
7682 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7683 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7684 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
7685 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
7686 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7687 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7688 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7689 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7690 ; GFX10-WGP-NEXT: s_endpgm
7692 ; GFX10-CU-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7693 ; GFX10-CU: ; %bb.0: ; %entry
7694 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
7695 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
7696 ; GFX10-CU-NEXT: s_nop 0
7697 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
7698 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7699 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7700 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
7701 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
7702 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7703 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7704 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7705 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7706 ; GFX10-CU-NEXT: s_endpgm
7708 ; SKIP-CACHE-INV-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7709 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7710 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
7711 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
7712 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
7713 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7714 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7715 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7716 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
7717 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
7718 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7719 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7720 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7721 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7722 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7723 ; SKIP-CACHE-INV-NEXT: s_endpgm
7725 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7726 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7727 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7728 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7729 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
7730 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7731 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7732 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7733 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7734 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7735 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7736 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7737 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7738 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7739 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7741 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7742 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7743 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7744 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7745 ; GFX90A-TGSPLIT-NEXT: s_nop 0
7746 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7747 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7748 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7749 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7750 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7751 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7752 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7753 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7754 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7755 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7757 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7758 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7759 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7760 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7761 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
7762 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
7763 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7764 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7765 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7766 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7767 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7768 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7769 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7770 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7771 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7773 ; GFX940-TGSPLIT-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7774 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7775 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7776 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7777 ; GFX940-TGSPLIT-NEXT: s_nop 0
7778 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
7779 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7780 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7781 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7782 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7783 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7784 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7785 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7786 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
7787 ; GFX940-TGSPLIT-NEXT: s_endpgm
7789 ; GFX11-WGP-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7790 ; GFX11-WGP: ; %bb.0: ; %entry
7791 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7792 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
7793 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
7794 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
7795 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7796 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
7797 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
7798 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
7799 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7800 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
7801 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
7802 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
7803 ; GFX11-WGP-NEXT: s_endpgm
7805 ; GFX11-CU-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7806 ; GFX11-CU: ; %bb.0: ; %entry
7807 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7808 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
7809 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
7810 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
7811 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7812 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
7813 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
7814 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
7815 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7816 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
7817 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
7818 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
7819 ; GFX11-CU-NEXT: s_endpgm
7821 ; GFX12-WGP-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7822 ; GFX12-WGP: ; %bb.0: ; %entry
7823 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
7824 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
7825 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
7826 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
7827 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
7828 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
7829 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
7830 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
7831 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7832 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
7833 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
7834 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
7835 ; GFX12-WGP-NEXT: s_endpgm
7837 ; GFX12-CU-LABEL: local_singlethread_acquire_seq_cst_ret_cmpxchg:
7838 ; GFX12-CU: ; %bb.0: ; %entry
7839 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
7840 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
7841 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
7842 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
7843 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
7844 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
7845 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
7846 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
7847 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
7848 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
7849 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
7850 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
7851 ; GFX12-CU-NEXT: s_endpgm
7852 ptr addrspace(3) %out, i32 %in, i32 %old) {
7854 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
7855 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acquire seq_cst
7856 %val0 = extractvalue { i32, i1 } %val, 0
7857 store i32 %val0, ptr addrspace(3) %out, align 4
7861 define amdgpu_kernel void @local_singlethread_release_seq_cst_ret_cmpxchg(
7862 ; GFX6-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
7863 ; GFX6: ; %bb.0: ; %entry
7864 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
7865 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
7866 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
7867 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
7868 ; GFX6-NEXT: s_mov_b32 m0, -1
7869 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7870 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
7871 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
7872 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
7873 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7874 ; GFX6-NEXT: s_mov_b32 m0, -1
7875 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
7876 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
7877 ; GFX6-NEXT: ds_write_b32 v0, v1
7878 ; GFX6-NEXT: s_endpgm
7880 ; GFX7-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
7881 ; GFX7: ; %bb.0: ; %entry
7882 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
7883 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
7884 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
7885 ; GFX7-NEXT: s_mov_b32 m0, -1
7886 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7887 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7888 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
7889 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
7890 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7891 ; GFX7-NEXT: s_mov_b32 m0, -1
7892 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
7893 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
7894 ; GFX7-NEXT: ds_write_b32 v0, v1
7895 ; GFX7-NEXT: s_endpgm
7897 ; GFX10-WGP-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
7898 ; GFX10-WGP: ; %bb.0: ; %entry
7899 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
7900 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
7901 ; GFX10-WGP-NEXT: s_nop 0
7902 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
7903 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7904 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7905 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
7906 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
7907 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7908 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
7909 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
7910 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
7911 ; GFX10-WGP-NEXT: s_endpgm
7913 ; GFX10-CU-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
7914 ; GFX10-CU: ; %bb.0: ; %entry
7915 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
7916 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
7917 ; GFX10-CU-NEXT: s_nop 0
7918 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
7919 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7920 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7921 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
7922 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
7923 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7924 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
7925 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
7926 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
7927 ; GFX10-CU-NEXT: s_endpgm
7929 ; SKIP-CACHE-INV-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
7930 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
7931 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
7932 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
7933 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
7934 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7935 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7936 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7937 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
7938 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
7939 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7940 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
7941 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
7942 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
7943 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
7944 ; SKIP-CACHE-INV-NEXT: s_endpgm
7946 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
7947 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
7948 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7949 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7950 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
7951 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7952 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7953 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7954 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7955 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7956 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7957 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7958 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7959 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7960 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
7962 ; GFX90A-TGSPLIT-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
7963 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
7964 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
7965 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
7966 ; GFX90A-TGSPLIT-NEXT: s_nop 0
7967 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
7968 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7969 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7970 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
7971 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
7972 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7973 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
7974 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7975 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
7976 ; GFX90A-TGSPLIT-NEXT: s_endpgm
7978 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
7979 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
7980 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7981 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7982 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
7983 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
7984 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7985 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7986 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
7987 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
7988 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
7989 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
7990 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
7991 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
7992 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
7994 ; GFX940-TGSPLIT-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
7995 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
7996 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
7997 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
7998 ; GFX940-TGSPLIT-NEXT: s_nop 0
7999 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
8000 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8001 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8002 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8003 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8004 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8005 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8006 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8007 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
8008 ; GFX940-TGSPLIT-NEXT: s_endpgm
8010 ; GFX11-WGP-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
8011 ; GFX11-WGP: ; %bb.0: ; %entry
8012 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8013 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
8014 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
8015 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
8016 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8017 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
8018 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
8019 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
8020 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8021 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
8022 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8023 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
8024 ; GFX11-WGP-NEXT: s_endpgm
8026 ; GFX11-CU-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
8027 ; GFX11-CU: ; %bb.0: ; %entry
8028 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8029 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
8030 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
8031 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
8032 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8033 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
8034 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
8035 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
8036 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8037 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
8038 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8039 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
8040 ; GFX11-CU-NEXT: s_endpgm
8042 ; GFX12-WGP-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
8043 ; GFX12-WGP: ; %bb.0: ; %entry
8044 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8045 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
8046 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
8047 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
8048 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
8049 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
8050 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
8051 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
8052 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8053 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
8054 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
8055 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
8056 ; GFX12-WGP-NEXT: s_endpgm
8058 ; GFX12-CU-LABEL: local_singlethread_release_seq_cst_ret_cmpxchg:
8059 ; GFX12-CU: ; %bb.0: ; %entry
8060 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8061 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
8062 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
8063 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
8064 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
8065 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
8066 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
8067 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
8068 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8069 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
8070 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
8071 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
8072 ; GFX12-CU-NEXT: s_endpgm
8073 ptr addrspace(3) %out, i32 %in, i32 %old) {
8075 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8076 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") release seq_cst
8077 %val0 = extractvalue { i32, i1 } %val, 0
8078 store i32 %val0, ptr addrspace(3) %out, align 4
8082 define amdgpu_kernel void @local_singlethread_acq_rel_seq_cst_ret_cmpxchg(
8083 ; GFX6-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8084 ; GFX6: ; %bb.0: ; %entry
8085 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
8086 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
8087 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
8088 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
8089 ; GFX6-NEXT: s_mov_b32 m0, -1
8090 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8091 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
8092 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
8093 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
8094 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8095 ; GFX6-NEXT: s_mov_b32 m0, -1
8096 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
8097 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8098 ; GFX6-NEXT: ds_write_b32 v0, v1
8099 ; GFX6-NEXT: s_endpgm
8101 ; GFX7-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8102 ; GFX7: ; %bb.0: ; %entry
8103 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
8104 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
8105 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
8106 ; GFX7-NEXT: s_mov_b32 m0, -1
8107 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8108 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8109 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
8110 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
8111 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8112 ; GFX7-NEXT: s_mov_b32 m0, -1
8113 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8114 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8115 ; GFX7-NEXT: ds_write_b32 v0, v1
8116 ; GFX7-NEXT: s_endpgm
8118 ; GFX10-WGP-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8119 ; GFX10-WGP: ; %bb.0: ; %entry
8120 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
8121 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
8122 ; GFX10-WGP-NEXT: s_nop 0
8123 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
8124 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8125 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
8126 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
8127 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
8128 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8129 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
8130 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8131 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
8132 ; GFX10-WGP-NEXT: s_endpgm
8134 ; GFX10-CU-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8135 ; GFX10-CU: ; %bb.0: ; %entry
8136 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
8137 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
8138 ; GFX10-CU-NEXT: s_nop 0
8139 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
8140 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8141 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
8142 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
8143 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
8144 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8145 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
8146 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8147 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
8148 ; GFX10-CU-NEXT: s_endpgm
8150 ; SKIP-CACHE-INV-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8151 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8152 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
8153 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
8154 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
8155 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8156 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8157 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8158 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8159 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8160 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8161 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8162 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8163 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8164 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
8165 ; SKIP-CACHE-INV-NEXT: s_endpgm
8167 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8168 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8169 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
8170 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
8171 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
8172 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
8173 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8174 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8175 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8176 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
8177 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8178 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8179 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8180 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8181 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8183 ; GFX90A-TGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8184 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8185 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
8186 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
8187 ; GFX90A-TGSPLIT-NEXT: s_nop 0
8188 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
8189 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8190 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8191 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8192 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
8193 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8194 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8195 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8196 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
8197 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8199 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8200 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8201 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
8202 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
8203 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
8204 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
8205 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8206 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8207 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8208 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8209 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8210 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8211 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8212 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8213 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8215 ; GFX940-TGSPLIT-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8216 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8217 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
8218 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
8219 ; GFX940-TGSPLIT-NEXT: s_nop 0
8220 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
8221 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8222 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8223 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8224 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8225 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8226 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8227 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8228 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
8229 ; GFX940-TGSPLIT-NEXT: s_endpgm
8231 ; GFX11-WGP-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8232 ; GFX11-WGP: ; %bb.0: ; %entry
8233 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8234 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
8235 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
8236 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
8237 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8238 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
8239 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
8240 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
8241 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8242 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
8243 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8244 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
8245 ; GFX11-WGP-NEXT: s_endpgm
8247 ; GFX11-CU-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8248 ; GFX11-CU: ; %bb.0: ; %entry
8249 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8250 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
8251 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
8252 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
8253 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8254 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
8255 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
8256 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
8257 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8258 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
8259 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8260 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
8261 ; GFX11-CU-NEXT: s_endpgm
8263 ; GFX12-WGP-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8264 ; GFX12-WGP: ; %bb.0: ; %entry
8265 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8266 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
8267 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
8268 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
8269 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
8270 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
8271 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
8272 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
8273 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8274 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
8275 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
8276 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
8277 ; GFX12-WGP-NEXT: s_endpgm
8279 ; GFX12-CU-LABEL: local_singlethread_acq_rel_seq_cst_ret_cmpxchg:
8280 ; GFX12-CU: ; %bb.0: ; %entry
8281 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8282 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
8283 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
8284 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
8285 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
8286 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
8287 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
8288 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
8289 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8290 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
8291 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
8292 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
8293 ; GFX12-CU-NEXT: s_endpgm
8294 ptr addrspace(3) %out, i32 %in, i32 %old) {
8296 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8297 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") acq_rel seq_cst
8298 %val0 = extractvalue { i32, i1 } %val, 0
8299 store i32 %val0, ptr addrspace(3) %out, align 4
8303 define amdgpu_kernel void @local_singlethread_seq_cst_seq_cst_ret_cmpxchg(
8304 ; GFX6-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8305 ; GFX6: ; %bb.0: ; %entry
8306 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
8307 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
8308 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
8309 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
8310 ; GFX6-NEXT: s_mov_b32 m0, -1
8311 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8312 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
8313 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
8314 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
8315 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8316 ; GFX6-NEXT: s_mov_b32 m0, -1
8317 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
8318 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8319 ; GFX6-NEXT: ds_write_b32 v0, v1
8320 ; GFX6-NEXT: s_endpgm
8322 ; GFX7-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8323 ; GFX7: ; %bb.0: ; %entry
8324 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
8325 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
8326 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
8327 ; GFX7-NEXT: s_mov_b32 m0, -1
8328 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8329 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8330 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
8331 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
8332 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8333 ; GFX7-NEXT: s_mov_b32 m0, -1
8334 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8335 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8336 ; GFX7-NEXT: ds_write_b32 v0, v1
8337 ; GFX7-NEXT: s_endpgm
8339 ; GFX10-WGP-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8340 ; GFX10-WGP: ; %bb.0: ; %entry
8341 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
8342 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
8343 ; GFX10-WGP-NEXT: s_nop 0
8344 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
8345 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8346 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
8347 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
8348 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
8349 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8350 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
8351 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8352 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
8353 ; GFX10-WGP-NEXT: s_endpgm
8355 ; GFX10-CU-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8356 ; GFX10-CU: ; %bb.0: ; %entry
8357 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
8358 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
8359 ; GFX10-CU-NEXT: s_nop 0
8360 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
8361 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8362 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
8363 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
8364 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
8365 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8366 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
8367 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8368 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
8369 ; GFX10-CU-NEXT: s_endpgm
8371 ; SKIP-CACHE-INV-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8372 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8373 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
8374 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
8375 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
8376 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8377 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8378 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8379 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
8380 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
8381 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8382 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8383 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8384 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8385 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
8386 ; SKIP-CACHE-INV-NEXT: s_endpgm
8388 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8389 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8390 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
8391 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
8392 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
8393 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
8394 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8395 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8396 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8397 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
8398 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8399 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8400 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8401 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8402 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8404 ; GFX90A-TGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8405 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8406 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
8407 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
8408 ; GFX90A-TGSPLIT-NEXT: s_nop 0
8409 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
8410 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8411 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8412 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
8413 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
8414 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8415 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8416 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8417 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
8418 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8420 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8421 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8422 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
8423 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
8424 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
8425 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
8426 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8427 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8428 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8429 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8430 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8431 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8432 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8433 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8434 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8436 ; GFX940-TGSPLIT-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8437 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8438 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
8439 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
8440 ; GFX940-TGSPLIT-NEXT: s_nop 0
8441 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
8442 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8443 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8444 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
8445 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
8446 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
8447 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8448 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8449 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
8450 ; GFX940-TGSPLIT-NEXT: s_endpgm
8452 ; GFX11-WGP-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8453 ; GFX11-WGP: ; %bb.0: ; %entry
8454 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8455 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
8456 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
8457 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
8458 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8459 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
8460 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
8461 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
8462 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8463 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
8464 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8465 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
8466 ; GFX11-WGP-NEXT: s_endpgm
8468 ; GFX11-CU-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8469 ; GFX11-CU: ; %bb.0: ; %entry
8470 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8471 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
8472 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
8473 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
8474 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8475 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
8476 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
8477 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
8478 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8479 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
8480 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8481 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
8482 ; GFX11-CU-NEXT: s_endpgm
8484 ; GFX12-WGP-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8485 ; GFX12-WGP: ; %bb.0: ; %entry
8486 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
8487 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
8488 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
8489 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
8490 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
8491 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
8492 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
8493 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
8494 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8495 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
8496 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
8497 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
8498 ; GFX12-WGP-NEXT: s_endpgm
8500 ; GFX12-CU-LABEL: local_singlethread_seq_cst_seq_cst_ret_cmpxchg:
8501 ; GFX12-CU: ; %bb.0: ; %entry
8502 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
8503 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
8504 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
8505 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
8506 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
8507 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
8508 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
8509 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
8510 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
8511 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
8512 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
8513 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
8514 ; GFX12-CU-NEXT: s_endpgm
8515 ptr addrspace(3) %out, i32 %in, i32 %old) {
8517 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
8518 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread") seq_cst seq_cst
8519 %val0 = extractvalue { i32, i1 } %val, 0
8520 store i32 %val0, ptr addrspace(3) %out, align 4
8524 define amdgpu_kernel void @local_singlethread_one_as_unordered_load(
8525 ; GFX6-LABEL: local_singlethread_one_as_unordered_load:
8526 ; GFX6: ; %bb.0: ; %entry
8527 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
8528 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
8529 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr4
8530 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr5
8531 ; GFX6-NEXT: s_mov_b32 m0, -1
8532 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8533 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
8534 ; GFX6-NEXT: ds_read_b32 v1, v0
8535 ; GFX6-NEXT: s_mov_b32 m0, -1
8536 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
8537 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8538 ; GFX6-NEXT: ds_write_b32 v0, v1
8539 ; GFX6-NEXT: s_endpgm
8541 ; GFX7-LABEL: local_singlethread_one_as_unordered_load:
8542 ; GFX7: ; %bb.0: ; %entry
8543 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
8544 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
8545 ; GFX7-NEXT: s_mov_b32 m0, -1
8546 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8547 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
8548 ; GFX7-NEXT: ds_read_b32 v1, v0
8549 ; GFX7-NEXT: s_mov_b32 m0, -1
8550 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8551 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8552 ; GFX7-NEXT: ds_write_b32 v0, v1
8553 ; GFX7-NEXT: s_endpgm
8555 ; GFX10-WGP-LABEL: local_singlethread_one_as_unordered_load:
8556 ; GFX10-WGP: ; %bb.0: ; %entry
8557 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
8558 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
8559 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8560 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
8561 ; GFX10-WGP-NEXT: ds_read_b32 v1, v0
8562 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
8563 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8564 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
8565 ; GFX10-WGP-NEXT: s_endpgm
8567 ; GFX10-CU-LABEL: local_singlethread_one_as_unordered_load:
8568 ; GFX10-CU: ; %bb.0: ; %entry
8569 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
8570 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
8571 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8572 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
8573 ; GFX10-CU-NEXT: ds_read_b32 v1, v0
8574 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
8575 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8576 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
8577 ; GFX10-CU-NEXT: s_endpgm
8579 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_unordered_load:
8580 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8581 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
8582 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
8583 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8584 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8585 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
8586 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v1, v0
8587 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8588 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8589 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8590 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
8591 ; SKIP-CACHE-INV-NEXT: s_endpgm
8593 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_unordered_load:
8594 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8595 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
8596 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
8597 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8598 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
8599 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
8600 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8601 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8602 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8603 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8605 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_unordered_load:
8606 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8607 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
8608 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
8609 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8610 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
8611 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v1, v0
8612 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8613 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8614 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
8615 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8617 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_unordered_load:
8618 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8619 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
8620 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
8621 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8622 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
8623 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
8624 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8625 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8626 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8627 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8629 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_unordered_load:
8630 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8631 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
8632 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
8633 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8634 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
8635 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v1, v0
8636 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8637 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8638 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
8639 ; GFX940-TGSPLIT-NEXT: s_endpgm
8641 ; GFX11-WGP-LABEL: local_singlethread_one_as_unordered_load:
8642 ; GFX11-WGP: ; %bb.0: ; %entry
8643 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
8644 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
8645 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8646 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
8647 ; GFX11-WGP-NEXT: ds_load_b32 v1, v0
8648 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
8649 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8650 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
8651 ; GFX11-WGP-NEXT: s_endpgm
8653 ; GFX11-CU-LABEL: local_singlethread_one_as_unordered_load:
8654 ; GFX11-CU: ; %bb.0: ; %entry
8655 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
8656 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
8657 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8658 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
8659 ; GFX11-CU-NEXT: ds_load_b32 v1, v0
8660 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
8661 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8662 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
8663 ; GFX11-CU-NEXT: s_endpgm
8665 ; GFX12-WGP-LABEL: local_singlethread_one_as_unordered_load:
8666 ; GFX12-WGP: ; %bb.0: ; %entry
8667 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
8668 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
8669 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
8670 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
8671 ; GFX12-WGP-NEXT: ds_load_b32 v1, v0
8672 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
8673 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
8674 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
8675 ; GFX12-WGP-NEXT: s_endpgm
8677 ; GFX12-CU-LABEL: local_singlethread_one_as_unordered_load:
8678 ; GFX12-CU: ; %bb.0: ; %entry
8679 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
8680 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
8681 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
8682 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
8683 ; GFX12-CU-NEXT: ds_load_b32 v1, v0
8684 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
8685 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
8686 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
8687 ; GFX12-CU-NEXT: s_endpgm
8688 ptr addrspace(3) %in, ptr addrspace(3) %out) {
8690 %val = load atomic i32, ptr addrspace(3) %in syncscope("singlethread-one-as") unordered, align 4
8691 store i32 %val, ptr addrspace(3) %out
8695 define amdgpu_kernel void @local_singlethread_one_as_monotonic_load(
8696 ; GFX6-LABEL: local_singlethread_one_as_monotonic_load:
8697 ; GFX6: ; %bb.0: ; %entry
8698 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
8699 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
8700 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr4
8701 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr5
8702 ; GFX6-NEXT: s_mov_b32 m0, -1
8703 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8704 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
8705 ; GFX6-NEXT: ds_read_b32 v1, v0
8706 ; GFX6-NEXT: s_mov_b32 m0, -1
8707 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
8708 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8709 ; GFX6-NEXT: ds_write_b32 v0, v1
8710 ; GFX6-NEXT: s_endpgm
8712 ; GFX7-LABEL: local_singlethread_one_as_monotonic_load:
8713 ; GFX7: ; %bb.0: ; %entry
8714 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
8715 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
8716 ; GFX7-NEXT: s_mov_b32 m0, -1
8717 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8718 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
8719 ; GFX7-NEXT: ds_read_b32 v1, v0
8720 ; GFX7-NEXT: s_mov_b32 m0, -1
8721 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8722 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8723 ; GFX7-NEXT: ds_write_b32 v0, v1
8724 ; GFX7-NEXT: s_endpgm
8726 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_load:
8727 ; GFX10-WGP: ; %bb.0: ; %entry
8728 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
8729 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
8730 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8731 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
8732 ; GFX10-WGP-NEXT: ds_read_b32 v1, v0
8733 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
8734 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8735 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
8736 ; GFX10-WGP-NEXT: s_endpgm
8738 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_load:
8739 ; GFX10-CU: ; %bb.0: ; %entry
8740 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
8741 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
8742 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8743 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
8744 ; GFX10-CU-NEXT: ds_read_b32 v1, v0
8745 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
8746 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8747 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
8748 ; GFX10-CU-NEXT: s_endpgm
8750 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_load:
8751 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8752 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
8753 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
8754 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8755 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8756 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
8757 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v1, v0
8758 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8759 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8760 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8761 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
8762 ; SKIP-CACHE-INV-NEXT: s_endpgm
8764 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_load:
8765 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8766 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
8767 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
8768 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8769 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
8770 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
8771 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8772 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8773 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8774 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8776 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_load:
8777 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8778 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
8779 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
8780 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8781 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
8782 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v1, v0
8783 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8784 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8785 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
8786 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8788 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_load:
8789 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8790 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
8791 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
8792 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8793 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
8794 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
8795 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8796 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8797 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8798 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8800 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_load:
8801 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8802 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
8803 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
8804 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8805 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
8806 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v1, v0
8807 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8808 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8809 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
8810 ; GFX940-TGSPLIT-NEXT: s_endpgm
8812 ; GFX11-WGP-LABEL: local_singlethread_one_as_monotonic_load:
8813 ; GFX11-WGP: ; %bb.0: ; %entry
8814 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
8815 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
8816 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8817 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
8818 ; GFX11-WGP-NEXT: ds_load_b32 v1, v0
8819 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
8820 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8821 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
8822 ; GFX11-WGP-NEXT: s_endpgm
8824 ; GFX11-CU-LABEL: local_singlethread_one_as_monotonic_load:
8825 ; GFX11-CU: ; %bb.0: ; %entry
8826 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
8827 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
8828 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8829 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
8830 ; GFX11-CU-NEXT: ds_load_b32 v1, v0
8831 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
8832 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
8833 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
8834 ; GFX11-CU-NEXT: s_endpgm
8836 ; GFX12-WGP-LABEL: local_singlethread_one_as_monotonic_load:
8837 ; GFX12-WGP: ; %bb.0: ; %entry
8838 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
8839 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
8840 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
8841 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
8842 ; GFX12-WGP-NEXT: ds_load_b32 v1, v0
8843 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
8844 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
8845 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
8846 ; GFX12-WGP-NEXT: s_endpgm
8848 ; GFX12-CU-LABEL: local_singlethread_one_as_monotonic_load:
8849 ; GFX12-CU: ; %bb.0: ; %entry
8850 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
8851 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
8852 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
8853 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
8854 ; GFX12-CU-NEXT: ds_load_b32 v1, v0
8855 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
8856 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
8857 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
8858 ; GFX12-CU-NEXT: s_endpgm
8859 ptr addrspace(3) %in, ptr addrspace(3) %out) {
8861 %val = load atomic i32, ptr addrspace(3) %in syncscope("singlethread-one-as") monotonic, align 4
8862 store i32 %val, ptr addrspace(3) %out
8866 define amdgpu_kernel void @local_singlethread_one_as_acquire_load(
8867 ; GFX6-LABEL: local_singlethread_one_as_acquire_load:
8868 ; GFX6: ; %bb.0: ; %entry
8869 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
8870 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
8871 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr4
8872 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr5
8873 ; GFX6-NEXT: s_mov_b32 m0, -1
8874 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8875 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
8876 ; GFX6-NEXT: ds_read_b32 v1, v0
8877 ; GFX6-NEXT: s_mov_b32 m0, -1
8878 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
8879 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
8880 ; GFX6-NEXT: ds_write_b32 v0, v1
8881 ; GFX6-NEXT: s_endpgm
8883 ; GFX7-LABEL: local_singlethread_one_as_acquire_load:
8884 ; GFX7: ; %bb.0: ; %entry
8885 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
8886 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
8887 ; GFX7-NEXT: s_mov_b32 m0, -1
8888 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8889 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
8890 ; GFX7-NEXT: ds_read_b32 v1, v0
8891 ; GFX7-NEXT: s_mov_b32 m0, -1
8892 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
8893 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
8894 ; GFX7-NEXT: ds_write_b32 v0, v1
8895 ; GFX7-NEXT: s_endpgm
8897 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_load:
8898 ; GFX10-WGP: ; %bb.0: ; %entry
8899 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
8900 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
8901 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8902 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
8903 ; GFX10-WGP-NEXT: ds_read_b32 v1, v0
8904 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
8905 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
8906 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
8907 ; GFX10-WGP-NEXT: s_endpgm
8909 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_load:
8910 ; GFX10-CU: ; %bb.0: ; %entry
8911 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
8912 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
8913 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8914 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
8915 ; GFX10-CU-NEXT: ds_read_b32 v1, v0
8916 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
8917 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
8918 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
8919 ; GFX10-CU-NEXT: s_endpgm
8921 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_load:
8922 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
8923 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
8924 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
8925 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8926 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8927 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
8928 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v1, v0
8929 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
8930 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
8931 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
8932 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
8933 ; SKIP-CACHE-INV-NEXT: s_endpgm
8935 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_load:
8936 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
8937 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
8938 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
8939 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8940 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
8941 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
8942 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8943 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8944 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8945 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
8947 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_load:
8948 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
8949 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
8950 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
8951 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8952 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
8953 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v1, v0
8954 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
8955 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8956 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
8957 ; GFX90A-TGSPLIT-NEXT: s_endpgm
8959 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_load:
8960 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
8961 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
8962 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
8963 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8964 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
8965 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
8966 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8967 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8968 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
8969 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
8971 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acquire_load:
8972 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
8973 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
8974 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
8975 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8976 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
8977 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v1, v0
8978 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
8979 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
8980 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
8981 ; GFX940-TGSPLIT-NEXT: s_endpgm
8983 ; GFX11-WGP-LABEL: local_singlethread_one_as_acquire_load:
8984 ; GFX11-WGP: ; %bb.0: ; %entry
8985 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
8986 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
8987 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8988 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
8989 ; GFX11-WGP-NEXT: ds_load_b32 v1, v0
8990 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
8991 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
8992 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
8993 ; GFX11-WGP-NEXT: s_endpgm
8995 ; GFX11-CU-LABEL: local_singlethread_one_as_acquire_load:
8996 ; GFX11-CU: ; %bb.0: ; %entry
8997 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
8998 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
8999 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9000 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
9001 ; GFX11-CU-NEXT: ds_load_b32 v1, v0
9002 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
9003 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9004 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
9005 ; GFX11-CU-NEXT: s_endpgm
9007 ; GFX12-WGP-LABEL: local_singlethread_one_as_acquire_load:
9008 ; GFX12-WGP: ; %bb.0: ; %entry
9009 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
9010 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
9011 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9012 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
9013 ; GFX12-WGP-NEXT: ds_load_b32 v1, v0
9014 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
9015 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
9016 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
9017 ; GFX12-WGP-NEXT: s_endpgm
9019 ; GFX12-CU-LABEL: local_singlethread_one_as_acquire_load:
9020 ; GFX12-CU: ; %bb.0: ; %entry
9021 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
9022 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
9023 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9024 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
9025 ; GFX12-CU-NEXT: ds_load_b32 v1, v0
9026 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
9027 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
9028 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
9029 ; GFX12-CU-NEXT: s_endpgm
9030 ptr addrspace(3) %in, ptr addrspace(3) %out) {
9032 %val = load atomic i32, ptr addrspace(3) %in syncscope("singlethread-one-as") acquire, align 4
9033 store i32 %val, ptr addrspace(3) %out
9037 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_load(
9038 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_load:
9039 ; GFX6: ; %bb.0: ; %entry
9040 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
9041 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
9042 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr4
9043 ; GFX6-NEXT: ; kill: def $sgpr6 killed $sgpr5
9044 ; GFX6-NEXT: s_mov_b32 m0, -1
9045 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9046 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
9047 ; GFX6-NEXT: ds_read_b32 v1, v0
9048 ; GFX6-NEXT: s_mov_b32 m0, -1
9049 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
9050 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9051 ; GFX6-NEXT: ds_write_b32 v0, v1
9052 ; GFX6-NEXT: s_endpgm
9054 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_load:
9055 ; GFX7: ; %bb.0: ; %entry
9056 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
9057 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
9058 ; GFX7-NEXT: s_mov_b32 m0, -1
9059 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9060 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
9061 ; GFX7-NEXT: ds_read_b32 v1, v0
9062 ; GFX7-NEXT: s_mov_b32 m0, -1
9063 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
9064 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9065 ; GFX7-NEXT: ds_write_b32 v0, v1
9066 ; GFX7-NEXT: s_endpgm
9068 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_load:
9069 ; GFX10-WGP: ; %bb.0: ; %entry
9070 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
9071 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
9072 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9073 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
9074 ; GFX10-WGP-NEXT: ds_read_b32 v1, v0
9075 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
9076 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9077 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
9078 ; GFX10-WGP-NEXT: s_endpgm
9080 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_load:
9081 ; GFX10-CU: ; %bb.0: ; %entry
9082 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
9083 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
9084 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9085 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
9086 ; GFX10-CU-NEXT: ds_read_b32 v1, v0
9087 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
9088 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9089 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
9090 ; GFX10-CU-NEXT: s_endpgm
9092 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_load:
9093 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9094 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
9095 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
9096 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9097 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9098 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
9099 ; SKIP-CACHE-INV-NEXT: ds_read_b32 v1, v0
9100 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9101 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
9102 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9103 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
9104 ; SKIP-CACHE-INV-NEXT: s_endpgm
9106 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_load:
9107 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9108 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
9109 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
9110 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9111 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9112 ; GFX90A-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
9113 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
9114 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9115 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9116 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9118 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_load:
9119 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9120 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
9121 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
9122 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9123 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9124 ; GFX90A-TGSPLIT-NEXT: ds_read_b32 v1, v0
9125 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
9126 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9127 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
9128 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9130 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_load:
9131 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9132 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
9133 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
9134 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9135 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9136 ; GFX940-NOTTGSPLIT-NEXT: ds_read_b32 v1, v0
9137 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9138 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9139 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9140 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9142 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_load:
9143 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9144 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
9145 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
9146 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9147 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9148 ; GFX940-TGSPLIT-NEXT: ds_read_b32 v1, v0
9149 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
9150 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9151 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
9152 ; GFX940-TGSPLIT-NEXT: s_endpgm
9154 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_load:
9155 ; GFX11-WGP: ; %bb.0: ; %entry
9156 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
9157 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
9158 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9159 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
9160 ; GFX11-WGP-NEXT: ds_load_b32 v1, v0
9161 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
9162 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9163 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
9164 ; GFX11-WGP-NEXT: s_endpgm
9166 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_load:
9167 ; GFX11-CU: ; %bb.0: ; %entry
9168 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
9169 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
9170 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9171 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
9172 ; GFX11-CU-NEXT: ds_load_b32 v1, v0
9173 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
9174 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9175 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
9176 ; GFX11-CU-NEXT: s_endpgm
9178 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_load:
9179 ; GFX12-WGP: ; %bb.0: ; %entry
9180 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
9181 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
9182 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9183 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
9184 ; GFX12-WGP-NEXT: ds_load_b32 v1, v0
9185 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
9186 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
9187 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
9188 ; GFX12-WGP-NEXT: s_endpgm
9190 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_load:
9191 ; GFX12-CU: ; %bb.0: ; %entry
9192 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
9193 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
9194 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9195 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
9196 ; GFX12-CU-NEXT: ds_load_b32 v1, v0
9197 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
9198 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
9199 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
9200 ; GFX12-CU-NEXT: s_endpgm
9201 ptr addrspace(3) %in, ptr addrspace(3) %out) {
9203 %val = load atomic i32, ptr addrspace(3) %in syncscope("singlethread-one-as") seq_cst, align 4
9204 store i32 %val, ptr addrspace(3) %out
9208 define amdgpu_kernel void @local_singlethread_one_as_unordered_store(
9209 ; GFX6-LABEL: local_singlethread_one_as_unordered_store:
9210 ; GFX6: ; %bb.0: ; %entry
9211 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
9212 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
9213 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
9214 ; GFX6-NEXT: s_mov_b32 m0, -1
9215 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9216 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
9217 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
9218 ; GFX6-NEXT: ds_write_b32 v0, v1
9219 ; GFX6-NEXT: s_endpgm
9221 ; GFX7-LABEL: local_singlethread_one_as_unordered_store:
9222 ; GFX7: ; %bb.0: ; %entry
9223 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
9224 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
9225 ; GFX7-NEXT: s_mov_b32 m0, -1
9226 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9227 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
9228 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
9229 ; GFX7-NEXT: ds_write_b32 v0, v1
9230 ; GFX7-NEXT: s_endpgm
9232 ; GFX10-WGP-LABEL: local_singlethread_one_as_unordered_store:
9233 ; GFX10-WGP: ; %bb.0: ; %entry
9234 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
9235 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
9236 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9237 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
9238 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
9239 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
9240 ; GFX10-WGP-NEXT: s_endpgm
9242 ; GFX10-CU-LABEL: local_singlethread_one_as_unordered_store:
9243 ; GFX10-CU: ; %bb.0: ; %entry
9244 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
9245 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
9246 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9247 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
9248 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
9249 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
9250 ; GFX10-CU-NEXT: s_endpgm
9252 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_unordered_store:
9253 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9254 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
9255 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
9256 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9257 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9258 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
9259 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
9260 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
9261 ; SKIP-CACHE-INV-NEXT: s_endpgm
9263 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_unordered_store:
9264 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9265 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
9266 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
9267 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9268 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9269 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9270 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9271 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9273 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_unordered_store:
9274 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9275 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
9276 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
9277 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9278 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9279 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9280 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
9281 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9283 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_unordered_store:
9284 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9285 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
9286 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
9287 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9288 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9289 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9290 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9291 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9293 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_unordered_store:
9294 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9295 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
9296 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
9297 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9298 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9299 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9300 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
9301 ; GFX940-TGSPLIT-NEXT: s_endpgm
9303 ; GFX11-WGP-LABEL: local_singlethread_one_as_unordered_store:
9304 ; GFX11-WGP: ; %bb.0: ; %entry
9305 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
9306 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
9307 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9308 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
9309 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
9310 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
9311 ; GFX11-WGP-NEXT: s_endpgm
9313 ; GFX11-CU-LABEL: local_singlethread_one_as_unordered_store:
9314 ; GFX11-CU: ; %bb.0: ; %entry
9315 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
9316 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
9317 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9318 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
9319 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
9320 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
9321 ; GFX11-CU-NEXT: s_endpgm
9323 ; GFX12-WGP-LABEL: local_singlethread_one_as_unordered_store:
9324 ; GFX12-WGP: ; %bb.0: ; %entry
9325 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
9326 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
9327 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9328 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
9329 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
9330 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
9331 ; GFX12-WGP-NEXT: s_endpgm
9333 ; GFX12-CU-LABEL: local_singlethread_one_as_unordered_store:
9334 ; GFX12-CU: ; %bb.0: ; %entry
9335 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
9336 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
9337 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9338 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
9339 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
9340 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
9341 ; GFX12-CU-NEXT: s_endpgm
9342 i32 %in, ptr addrspace(3) %out) {
9344 store atomic i32 %in, ptr addrspace(3) %out syncscope("singlethread-one-as") unordered, align 4
9348 define amdgpu_kernel void @local_singlethread_one_as_monotonic_store(
9349 ; GFX6-LABEL: local_singlethread_one_as_monotonic_store:
9350 ; GFX6: ; %bb.0: ; %entry
9351 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
9352 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
9353 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
9354 ; GFX6-NEXT: s_mov_b32 m0, -1
9355 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9356 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
9357 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
9358 ; GFX6-NEXT: ds_write_b32 v0, v1
9359 ; GFX6-NEXT: s_endpgm
9361 ; GFX7-LABEL: local_singlethread_one_as_monotonic_store:
9362 ; GFX7: ; %bb.0: ; %entry
9363 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
9364 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
9365 ; GFX7-NEXT: s_mov_b32 m0, -1
9366 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9367 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
9368 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
9369 ; GFX7-NEXT: ds_write_b32 v0, v1
9370 ; GFX7-NEXT: s_endpgm
9372 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_store:
9373 ; GFX10-WGP: ; %bb.0: ; %entry
9374 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
9375 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
9376 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9377 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
9378 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
9379 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
9380 ; GFX10-WGP-NEXT: s_endpgm
9382 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_store:
9383 ; GFX10-CU: ; %bb.0: ; %entry
9384 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
9385 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
9386 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9387 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
9388 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
9389 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
9390 ; GFX10-CU-NEXT: s_endpgm
9392 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_store:
9393 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9394 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
9395 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
9396 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9397 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9398 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
9399 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
9400 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
9401 ; SKIP-CACHE-INV-NEXT: s_endpgm
9403 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_store:
9404 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9405 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
9406 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
9407 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9408 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9409 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9410 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9411 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9413 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_store:
9414 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9415 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
9416 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
9417 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9418 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9419 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9420 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
9421 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9423 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_store:
9424 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9425 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
9426 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
9427 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9428 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9429 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9430 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9431 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9433 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_store:
9434 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9435 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
9436 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
9437 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9438 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9439 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9440 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
9441 ; GFX940-TGSPLIT-NEXT: s_endpgm
9443 ; GFX11-WGP-LABEL: local_singlethread_one_as_monotonic_store:
9444 ; GFX11-WGP: ; %bb.0: ; %entry
9445 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
9446 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
9447 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9448 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
9449 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
9450 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
9451 ; GFX11-WGP-NEXT: s_endpgm
9453 ; GFX11-CU-LABEL: local_singlethread_one_as_monotonic_store:
9454 ; GFX11-CU: ; %bb.0: ; %entry
9455 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
9456 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
9457 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9458 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
9459 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
9460 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
9461 ; GFX11-CU-NEXT: s_endpgm
9463 ; GFX12-WGP-LABEL: local_singlethread_one_as_monotonic_store:
9464 ; GFX12-WGP: ; %bb.0: ; %entry
9465 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
9466 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
9467 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9468 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
9469 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
9470 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
9471 ; GFX12-WGP-NEXT: s_endpgm
9473 ; GFX12-CU-LABEL: local_singlethread_one_as_monotonic_store:
9474 ; GFX12-CU: ; %bb.0: ; %entry
9475 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
9476 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
9477 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9478 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
9479 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
9480 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
9481 ; GFX12-CU-NEXT: s_endpgm
9482 i32 %in, ptr addrspace(3) %out) {
9484 store atomic i32 %in, ptr addrspace(3) %out syncscope("singlethread-one-as") monotonic, align 4
9488 define amdgpu_kernel void @local_singlethread_one_as_release_store(
9489 ; GFX6-LABEL: local_singlethread_one_as_release_store:
9490 ; GFX6: ; %bb.0: ; %entry
9491 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
9492 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
9493 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
9494 ; GFX6-NEXT: s_mov_b32 m0, -1
9495 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9496 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
9497 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
9498 ; GFX6-NEXT: ds_write_b32 v0, v1
9499 ; GFX6-NEXT: s_endpgm
9501 ; GFX7-LABEL: local_singlethread_one_as_release_store:
9502 ; GFX7: ; %bb.0: ; %entry
9503 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
9504 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
9505 ; GFX7-NEXT: s_mov_b32 m0, -1
9506 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9507 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
9508 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
9509 ; GFX7-NEXT: ds_write_b32 v0, v1
9510 ; GFX7-NEXT: s_endpgm
9512 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_store:
9513 ; GFX10-WGP: ; %bb.0: ; %entry
9514 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
9515 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
9516 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9517 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
9518 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
9519 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
9520 ; GFX10-WGP-NEXT: s_endpgm
9522 ; GFX10-CU-LABEL: local_singlethread_one_as_release_store:
9523 ; GFX10-CU: ; %bb.0: ; %entry
9524 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
9525 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
9526 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9527 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
9528 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
9529 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
9530 ; GFX10-CU-NEXT: s_endpgm
9532 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_store:
9533 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9534 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
9535 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
9536 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9537 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9538 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
9539 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
9540 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
9541 ; SKIP-CACHE-INV-NEXT: s_endpgm
9543 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_store:
9544 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9545 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
9546 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
9547 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9548 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9549 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9550 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9551 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9553 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_store:
9554 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9555 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
9556 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
9557 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9558 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9559 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9560 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
9561 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9563 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_store:
9564 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9565 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
9566 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
9567 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9568 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9569 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9570 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9571 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9573 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_release_store:
9574 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9575 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
9576 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
9577 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9578 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9579 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9580 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
9581 ; GFX940-TGSPLIT-NEXT: s_endpgm
9583 ; GFX11-WGP-LABEL: local_singlethread_one_as_release_store:
9584 ; GFX11-WGP: ; %bb.0: ; %entry
9585 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
9586 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
9587 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9588 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
9589 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
9590 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
9591 ; GFX11-WGP-NEXT: s_endpgm
9593 ; GFX11-CU-LABEL: local_singlethread_one_as_release_store:
9594 ; GFX11-CU: ; %bb.0: ; %entry
9595 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
9596 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
9597 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9598 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
9599 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
9600 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
9601 ; GFX11-CU-NEXT: s_endpgm
9603 ; GFX12-WGP-LABEL: local_singlethread_one_as_release_store:
9604 ; GFX12-WGP: ; %bb.0: ; %entry
9605 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
9606 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
9607 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9608 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
9609 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
9610 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
9611 ; GFX12-WGP-NEXT: s_endpgm
9613 ; GFX12-CU-LABEL: local_singlethread_one_as_release_store:
9614 ; GFX12-CU: ; %bb.0: ; %entry
9615 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
9616 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
9617 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9618 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
9619 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
9620 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
9621 ; GFX12-CU-NEXT: s_endpgm
9622 i32 %in, ptr addrspace(3) %out) {
9624 store atomic i32 %in, ptr addrspace(3) %out syncscope("singlethread-one-as") release, align 4
9628 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_store(
9629 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_store:
9630 ; GFX6: ; %bb.0: ; %entry
9631 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
9632 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
9633 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
9634 ; GFX6-NEXT: s_mov_b32 m0, -1
9635 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9636 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
9637 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
9638 ; GFX6-NEXT: ds_write_b32 v0, v1
9639 ; GFX6-NEXT: s_endpgm
9641 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_store:
9642 ; GFX7: ; %bb.0: ; %entry
9643 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
9644 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
9645 ; GFX7-NEXT: s_mov_b32 m0, -1
9646 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9647 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
9648 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
9649 ; GFX7-NEXT: ds_write_b32 v0, v1
9650 ; GFX7-NEXT: s_endpgm
9652 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_store:
9653 ; GFX10-WGP: ; %bb.0: ; %entry
9654 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
9655 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
9656 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9657 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
9658 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
9659 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
9660 ; GFX10-WGP-NEXT: s_endpgm
9662 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_store:
9663 ; GFX10-CU: ; %bb.0: ; %entry
9664 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
9665 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
9666 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9667 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
9668 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
9669 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
9670 ; GFX10-CU-NEXT: s_endpgm
9672 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_store:
9673 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9674 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
9675 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
9676 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9677 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9678 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
9679 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
9680 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
9681 ; SKIP-CACHE-INV-NEXT: s_endpgm
9683 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_store:
9684 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9685 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
9686 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
9687 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9688 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9689 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9690 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9691 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9693 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_store:
9694 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9695 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
9696 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
9697 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9698 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9699 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9700 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
9701 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9703 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_store:
9704 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9705 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
9706 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
9707 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9708 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9709 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9710 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
9711 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9713 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_store:
9714 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9715 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
9716 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
9717 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9718 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9719 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9720 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
9721 ; GFX940-TGSPLIT-NEXT: s_endpgm
9723 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_store:
9724 ; GFX11-WGP: ; %bb.0: ; %entry
9725 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
9726 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
9727 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9728 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
9729 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
9730 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
9731 ; GFX11-WGP-NEXT: s_endpgm
9733 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_store:
9734 ; GFX11-CU: ; %bb.0: ; %entry
9735 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
9736 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
9737 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9738 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
9739 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
9740 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
9741 ; GFX11-CU-NEXT: s_endpgm
9743 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_store:
9744 ; GFX12-WGP: ; %bb.0: ; %entry
9745 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
9746 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
9747 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9748 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
9749 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
9750 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
9751 ; GFX12-WGP-NEXT: s_endpgm
9753 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_store:
9754 ; GFX12-CU: ; %bb.0: ; %entry
9755 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
9756 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
9757 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9758 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
9759 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
9760 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
9761 ; GFX12-CU-NEXT: s_endpgm
9762 i32 %in, ptr addrspace(3) %out) {
9764 store atomic i32 %in, ptr addrspace(3) %out syncscope("singlethread-one-as") seq_cst, align 4
9768 define amdgpu_kernel void @local_singlethread_one_as_monotonic_atomicrmw(
9769 ; GFX6-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9770 ; GFX6: ; %bb.0: ; %entry
9771 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
9772 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
9773 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
9774 ; GFX6-NEXT: s_mov_b32 m0, -1
9775 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9776 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
9777 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
9778 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9779 ; GFX6-NEXT: s_endpgm
9781 ; GFX7-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9782 ; GFX7: ; %bb.0: ; %entry
9783 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
9784 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
9785 ; GFX7-NEXT: s_mov_b32 m0, -1
9786 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9787 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
9788 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
9789 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9790 ; GFX7-NEXT: s_endpgm
9792 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9793 ; GFX10-WGP: ; %bb.0: ; %entry
9794 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
9795 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
9796 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9797 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
9798 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
9799 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9800 ; GFX10-WGP-NEXT: s_endpgm
9802 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9803 ; GFX10-CU: ; %bb.0: ; %entry
9804 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
9805 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
9806 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9807 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
9808 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
9809 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9810 ; GFX10-CU-NEXT: s_endpgm
9812 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9813 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9814 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
9815 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
9816 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9817 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9818 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
9819 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
9820 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9821 ; SKIP-CACHE-INV-NEXT: s_endpgm
9823 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9824 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9825 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
9826 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
9827 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9828 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9829 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9830 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9831 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9833 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9834 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9835 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
9836 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
9837 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9838 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9839 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9840 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9841 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9843 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9844 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9845 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
9846 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
9847 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9848 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9849 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9850 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9851 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9853 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9854 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9855 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
9856 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
9857 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9858 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9859 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9860 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9861 ; GFX940-TGSPLIT-NEXT: s_endpgm
9863 ; GFX11-WGP-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9864 ; GFX11-WGP: ; %bb.0: ; %entry
9865 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
9866 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
9867 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
9868 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
9869 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
9870 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
9871 ; GFX11-WGP-NEXT: s_endpgm
9873 ; GFX11-CU-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9874 ; GFX11-CU: ; %bb.0: ; %entry
9875 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
9876 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
9877 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
9878 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
9879 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
9880 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
9881 ; GFX11-CU-NEXT: s_endpgm
9883 ; GFX12-WGP-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9884 ; GFX12-WGP: ; %bb.0: ; %entry
9885 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
9886 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
9887 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
9888 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
9889 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
9890 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
9891 ; GFX12-WGP-NEXT: s_endpgm
9893 ; GFX12-CU-LABEL: local_singlethread_one_as_monotonic_atomicrmw:
9894 ; GFX12-CU: ; %bb.0: ; %entry
9895 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
9896 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
9897 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
9898 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
9899 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
9900 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
9901 ; GFX12-CU-NEXT: s_endpgm
9902 ptr addrspace(3) %out, i32 %in) {
9904 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread-one-as") monotonic
9908 define amdgpu_kernel void @local_singlethread_one_as_acquire_atomicrmw(
9909 ; GFX6-LABEL: local_singlethread_one_as_acquire_atomicrmw:
9910 ; GFX6: ; %bb.0: ; %entry
9911 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
9912 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
9913 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
9914 ; GFX6-NEXT: s_mov_b32 m0, -1
9915 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
9916 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
9917 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
9918 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9919 ; GFX6-NEXT: s_endpgm
9921 ; GFX7-LABEL: local_singlethread_one_as_acquire_atomicrmw:
9922 ; GFX7: ; %bb.0: ; %entry
9923 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
9924 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
9925 ; GFX7-NEXT: s_mov_b32 m0, -1
9926 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
9927 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
9928 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
9929 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9930 ; GFX7-NEXT: s_endpgm
9932 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_atomicrmw:
9933 ; GFX10-WGP: ; %bb.0: ; %entry
9934 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
9935 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
9936 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
9937 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
9938 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
9939 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9940 ; GFX10-WGP-NEXT: s_endpgm
9942 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_atomicrmw:
9943 ; GFX10-CU: ; %bb.0: ; %entry
9944 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
9945 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
9946 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
9947 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
9948 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
9949 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9950 ; GFX10-CU-NEXT: s_endpgm
9952 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_atomicrmw:
9953 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
9954 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
9955 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
9956 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
9957 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
9958 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
9959 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
9960 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9961 ; SKIP-CACHE-INV-NEXT: s_endpgm
9963 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_atomicrmw:
9964 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
9965 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
9966 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
9967 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9968 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9969 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9970 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9971 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
9973 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_atomicrmw:
9974 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
9975 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
9976 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
9977 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9978 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
9979 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
9980 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9981 ; GFX90A-TGSPLIT-NEXT: s_endpgm
9983 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_atomicrmw:
9984 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
9985 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
9986 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
9987 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9988 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9989 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
9990 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
9991 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
9993 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acquire_atomicrmw:
9994 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
9995 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
9996 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
9997 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
9998 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
9999 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
10000 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10001 ; GFX940-TGSPLIT-NEXT: s_endpgm
10003 ; GFX11-WGP-LABEL: local_singlethread_one_as_acquire_atomicrmw:
10004 ; GFX11-WGP: ; %bb.0: ; %entry
10005 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
10006 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
10007 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10008 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
10009 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
10010 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10011 ; GFX11-WGP-NEXT: s_endpgm
10013 ; GFX11-CU-LABEL: local_singlethread_one_as_acquire_atomicrmw:
10014 ; GFX11-CU: ; %bb.0: ; %entry
10015 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
10016 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
10017 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10018 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
10019 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
10020 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10021 ; GFX11-CU-NEXT: s_endpgm
10023 ; GFX12-WGP-LABEL: local_singlethread_one_as_acquire_atomicrmw:
10024 ; GFX12-WGP: ; %bb.0: ; %entry
10025 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
10026 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
10027 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10028 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
10029 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
10030 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10031 ; GFX12-WGP-NEXT: s_endpgm
10033 ; GFX12-CU-LABEL: local_singlethread_one_as_acquire_atomicrmw:
10034 ; GFX12-CU: ; %bb.0: ; %entry
10035 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
10036 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
10037 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10038 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
10039 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
10040 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10041 ; GFX12-CU-NEXT: s_endpgm
10042 ptr addrspace(3) %out, i32 %in) {
10044 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread-one-as") acquire
10048 define amdgpu_kernel void @local_singlethread_one_as_release_atomicrmw(
10049 ; GFX6-LABEL: local_singlethread_one_as_release_atomicrmw:
10050 ; GFX6: ; %bb.0: ; %entry
10051 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
10052 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
10053 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
10054 ; GFX6-NEXT: s_mov_b32 m0, -1
10055 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10056 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
10057 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
10058 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10059 ; GFX6-NEXT: s_endpgm
10061 ; GFX7-LABEL: local_singlethread_one_as_release_atomicrmw:
10062 ; GFX7: ; %bb.0: ; %entry
10063 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
10064 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
10065 ; GFX7-NEXT: s_mov_b32 m0, -1
10066 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10067 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
10068 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
10069 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10070 ; GFX7-NEXT: s_endpgm
10072 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_atomicrmw:
10073 ; GFX10-WGP: ; %bb.0: ; %entry
10074 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
10075 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
10076 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10077 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
10078 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
10079 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10080 ; GFX10-WGP-NEXT: s_endpgm
10082 ; GFX10-CU-LABEL: local_singlethread_one_as_release_atomicrmw:
10083 ; GFX10-CU: ; %bb.0: ; %entry
10084 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
10085 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
10086 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10087 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
10088 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
10089 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10090 ; GFX10-CU-NEXT: s_endpgm
10092 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_atomicrmw:
10093 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10094 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
10095 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
10096 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10097 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10098 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
10099 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
10100 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10101 ; SKIP-CACHE-INV-NEXT: s_endpgm
10103 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_atomicrmw:
10104 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10105 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
10106 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
10107 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10108 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
10109 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
10110 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10111 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10113 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_atomicrmw:
10114 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10115 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
10116 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
10117 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10118 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
10119 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
10120 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10121 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10123 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_atomicrmw:
10124 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10125 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
10126 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
10127 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10128 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
10129 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
10130 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10131 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10133 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_release_atomicrmw:
10134 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10135 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
10136 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
10137 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10138 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
10139 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
10140 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10141 ; GFX940-TGSPLIT-NEXT: s_endpgm
10143 ; GFX11-WGP-LABEL: local_singlethread_one_as_release_atomicrmw:
10144 ; GFX11-WGP: ; %bb.0: ; %entry
10145 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
10146 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
10147 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10148 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
10149 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
10150 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10151 ; GFX11-WGP-NEXT: s_endpgm
10153 ; GFX11-CU-LABEL: local_singlethread_one_as_release_atomicrmw:
10154 ; GFX11-CU: ; %bb.0: ; %entry
10155 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
10156 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
10157 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10158 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
10159 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
10160 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10161 ; GFX11-CU-NEXT: s_endpgm
10163 ; GFX12-WGP-LABEL: local_singlethread_one_as_release_atomicrmw:
10164 ; GFX12-WGP: ; %bb.0: ; %entry
10165 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
10166 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
10167 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10168 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
10169 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
10170 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10171 ; GFX12-WGP-NEXT: s_endpgm
10173 ; GFX12-CU-LABEL: local_singlethread_one_as_release_atomicrmw:
10174 ; GFX12-CU: ; %bb.0: ; %entry
10175 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
10176 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
10177 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10178 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
10179 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
10180 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10181 ; GFX12-CU-NEXT: s_endpgm
10182 ptr addrspace(3) %out, i32 %in) {
10184 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread-one-as") release
10188 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_atomicrmw(
10189 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10190 ; GFX6: ; %bb.0: ; %entry
10191 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
10192 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
10193 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
10194 ; GFX6-NEXT: s_mov_b32 m0, -1
10195 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10196 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
10197 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
10198 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10199 ; GFX6-NEXT: s_endpgm
10201 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10202 ; GFX7: ; %bb.0: ; %entry
10203 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
10204 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
10205 ; GFX7-NEXT: s_mov_b32 m0, -1
10206 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10207 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
10208 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
10209 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10210 ; GFX7-NEXT: s_endpgm
10212 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10213 ; GFX10-WGP: ; %bb.0: ; %entry
10214 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
10215 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
10216 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10217 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
10218 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
10219 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10220 ; GFX10-WGP-NEXT: s_endpgm
10222 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10223 ; GFX10-CU: ; %bb.0: ; %entry
10224 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
10225 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
10226 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10227 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
10228 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
10229 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10230 ; GFX10-CU-NEXT: s_endpgm
10232 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10233 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10234 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
10235 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
10236 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10237 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10238 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
10239 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
10240 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10241 ; SKIP-CACHE-INV-NEXT: s_endpgm
10243 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10244 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10245 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
10246 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
10247 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10248 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
10249 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
10250 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10251 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10253 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10254 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10255 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
10256 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
10257 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10258 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
10259 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
10260 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10261 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10263 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10264 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10265 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
10266 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
10267 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10268 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
10269 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
10270 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10271 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10273 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10274 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10275 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
10276 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
10277 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10278 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
10279 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
10280 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10281 ; GFX940-TGSPLIT-NEXT: s_endpgm
10283 ; GFX11-WGP-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10284 ; GFX11-WGP: ; %bb.0: ; %entry
10285 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
10286 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
10287 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10288 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
10289 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
10290 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10291 ; GFX11-WGP-NEXT: s_endpgm
10293 ; GFX11-CU-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10294 ; GFX11-CU: ; %bb.0: ; %entry
10295 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
10296 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
10297 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10298 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
10299 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
10300 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10301 ; GFX11-CU-NEXT: s_endpgm
10303 ; GFX12-WGP-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10304 ; GFX12-WGP: ; %bb.0: ; %entry
10305 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
10306 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
10307 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10308 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
10309 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
10310 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10311 ; GFX12-WGP-NEXT: s_endpgm
10313 ; GFX12-CU-LABEL: local_singlethread_one_as_acq_rel_atomicrmw:
10314 ; GFX12-CU: ; %bb.0: ; %entry
10315 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
10316 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
10317 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10318 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
10319 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
10320 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10321 ; GFX12-CU-NEXT: s_endpgm
10322 ptr addrspace(3) %out, i32 %in) {
10324 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread-one-as") acq_rel
10328 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_atomicrmw(
10329 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10330 ; GFX6: ; %bb.0: ; %entry
10331 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x0
10332 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr5
10333 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x1
10334 ; GFX6-NEXT: s_mov_b32 m0, -1
10335 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10336 ; GFX6-NEXT: v_mov_b32_e32 v0, s5
10337 ; GFX6-NEXT: v_mov_b32_e32 v1, s4
10338 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10339 ; GFX6-NEXT: s_endpgm
10341 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10342 ; GFX7: ; %bb.0: ; %entry
10343 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x0
10344 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x1
10345 ; GFX7-NEXT: s_mov_b32 m0, -1
10346 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10347 ; GFX7-NEXT: v_mov_b32_e32 v0, s5
10348 ; GFX7-NEXT: v_mov_b32_e32 v1, s4
10349 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10350 ; GFX7-NEXT: s_endpgm
10352 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10353 ; GFX10-WGP: ; %bb.0: ; %entry
10354 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x0
10355 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x4
10356 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10357 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s5
10358 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s4
10359 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10360 ; GFX10-WGP-NEXT: s_endpgm
10362 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10363 ; GFX10-CU: ; %bb.0: ; %entry
10364 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x0
10365 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x4
10366 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10367 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s5
10368 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s4
10369 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10370 ; GFX10-CU-NEXT: s_endpgm
10372 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10373 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10374 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x0
10375 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x1
10376 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10377 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10378 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s1
10379 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s0
10380 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10381 ; SKIP-CACHE-INV-NEXT: s_endpgm
10383 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10384 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10385 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
10386 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
10387 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10388 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s5
10389 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s4
10390 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10391 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10393 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10394 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10395 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x0
10396 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x4
10397 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10398 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s5
10399 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s4
10400 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10401 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10403 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10404 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10405 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
10406 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
10407 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10408 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s1
10409 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s0
10410 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10411 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10413 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10414 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10415 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x0
10416 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x4
10417 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10418 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s1
10419 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s0
10420 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v0, v0, v1
10421 ; GFX940-TGSPLIT-NEXT: s_endpgm
10423 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10424 ; GFX11-WGP: ; %bb.0: ; %entry
10425 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
10426 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
10427 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10428 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s1
10429 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s0
10430 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10431 ; GFX11-WGP-NEXT: s_endpgm
10433 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10434 ; GFX11-CU: ; %bb.0: ; %entry
10435 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
10436 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
10437 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10438 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s1
10439 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s0
10440 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10441 ; GFX11-CU-NEXT: s_endpgm
10443 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10444 ; GFX12-WGP: ; %bb.0: ; %entry
10445 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x0
10446 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x4
10447 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10448 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s1
10449 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s0
10450 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10451 ; GFX12-WGP-NEXT: s_endpgm
10453 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_atomicrmw:
10454 ; GFX12-CU: ; %bb.0: ; %entry
10455 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x0
10456 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x4
10457 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10458 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s1
10459 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s0
10460 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v0, v0, v1
10461 ; GFX12-CU-NEXT: s_endpgm
10462 ptr addrspace(3) %out, i32 %in) {
10464 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread-one-as") seq_cst
10468 define amdgpu_kernel void @local_singlethread_one_as_acquire_ret_atomicrmw(
10469 ; GFX6-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10470 ; GFX6: ; %bb.0: ; %entry
10471 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
10472 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
10473 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
10474 ; GFX6-NEXT: s_mov_b32 m0, -1
10475 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10476 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
10477 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
10478 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10479 ; GFX6-NEXT: s_mov_b32 m0, -1
10480 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
10481 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10482 ; GFX6-NEXT: ds_write_b32 v0, v1
10483 ; GFX6-NEXT: s_endpgm
10485 ; GFX7-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10486 ; GFX7: ; %bb.0: ; %entry
10487 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
10488 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
10489 ; GFX7-NEXT: s_mov_b32 m0, -1
10490 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10491 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10492 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10493 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10494 ; GFX7-NEXT: s_mov_b32 m0, -1
10495 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10496 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10497 ; GFX7-NEXT: ds_write_b32 v0, v1
10498 ; GFX7-NEXT: s_endpgm
10500 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10501 ; GFX10-WGP: ; %bb.0: ; %entry
10502 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
10503 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
10504 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10505 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
10506 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
10507 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10508 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
10509 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10510 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10511 ; GFX10-WGP-NEXT: s_endpgm
10513 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10514 ; GFX10-CU: ; %bb.0: ; %entry
10515 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
10516 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
10517 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10518 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
10519 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
10520 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10521 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
10522 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10523 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10524 ; GFX10-CU-NEXT: s_endpgm
10526 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10527 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10528 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
10529 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
10530 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10531 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10532 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10533 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10534 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10535 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10536 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10537 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10538 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10539 ; SKIP-CACHE-INV-NEXT: s_endpgm
10541 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10542 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10543 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
10544 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
10545 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10546 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10547 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
10548 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10549 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10550 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10551 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10552 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10554 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10555 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10556 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
10557 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
10558 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10559 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10560 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
10561 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10562 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10563 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10564 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10565 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10567 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10568 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10569 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
10570 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
10571 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10572 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10573 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
10574 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10575 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10576 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10577 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10578 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10580 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10581 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10582 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
10583 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
10584 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10585 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10586 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
10587 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10588 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10589 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10590 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10591 ; GFX940-TGSPLIT-NEXT: s_endpgm
10593 ; GFX11-WGP-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10594 ; GFX11-WGP: ; %bb.0: ; %entry
10595 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
10596 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
10597 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10598 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
10599 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
10600 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10601 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
10602 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10603 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10604 ; GFX11-WGP-NEXT: s_endpgm
10606 ; GFX11-CU-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10607 ; GFX11-CU: ; %bb.0: ; %entry
10608 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
10609 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
10610 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10611 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
10612 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
10613 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10614 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
10615 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10616 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10617 ; GFX11-CU-NEXT: s_endpgm
10619 ; GFX12-WGP-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10620 ; GFX12-WGP: ; %bb.0: ; %entry
10621 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
10622 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
10623 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10624 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
10625 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
10626 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10627 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
10628 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
10629 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
10630 ; GFX12-WGP-NEXT: s_endpgm
10632 ; GFX12-CU-LABEL: local_singlethread_one_as_acquire_ret_atomicrmw:
10633 ; GFX12-CU: ; %bb.0: ; %entry
10634 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
10635 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
10636 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10637 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
10638 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
10639 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10640 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
10641 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
10642 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
10643 ; GFX12-CU-NEXT: s_endpgm
10644 ptr addrspace(3) %out, i32 %in) {
10646 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread-one-as") acquire
10647 store i32 %val, ptr addrspace(3) %out, align 4
10651 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_ret_atomicrmw(
10652 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10653 ; GFX6: ; %bb.0: ; %entry
10654 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
10655 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
10656 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
10657 ; GFX6-NEXT: s_mov_b32 m0, -1
10658 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10659 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
10660 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
10661 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10662 ; GFX6-NEXT: s_mov_b32 m0, -1
10663 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
10664 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10665 ; GFX6-NEXT: ds_write_b32 v0, v1
10666 ; GFX6-NEXT: s_endpgm
10668 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10669 ; GFX7: ; %bb.0: ; %entry
10670 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
10671 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
10672 ; GFX7-NEXT: s_mov_b32 m0, -1
10673 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10674 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10675 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10676 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10677 ; GFX7-NEXT: s_mov_b32 m0, -1
10678 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10679 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10680 ; GFX7-NEXT: ds_write_b32 v0, v1
10681 ; GFX7-NEXT: s_endpgm
10683 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10684 ; GFX10-WGP: ; %bb.0: ; %entry
10685 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
10686 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
10687 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10688 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
10689 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
10690 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10691 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
10692 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10693 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10694 ; GFX10-WGP-NEXT: s_endpgm
10696 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10697 ; GFX10-CU: ; %bb.0: ; %entry
10698 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
10699 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
10700 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10701 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
10702 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
10703 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10704 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
10705 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10706 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10707 ; GFX10-CU-NEXT: s_endpgm
10709 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10710 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10711 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
10712 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
10713 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10714 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10715 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10716 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10717 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10718 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10719 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10720 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10721 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10722 ; SKIP-CACHE-INV-NEXT: s_endpgm
10724 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10725 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10726 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
10727 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
10728 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10729 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10730 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
10731 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10732 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10733 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10734 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10735 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10737 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10738 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10739 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
10740 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
10741 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10742 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10743 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
10744 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10745 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10746 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10747 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10748 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10750 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10751 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10752 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
10753 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
10754 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10755 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10756 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
10757 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10758 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10759 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10760 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10761 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10763 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10764 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10765 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
10766 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
10767 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10768 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10769 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
10770 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10771 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10772 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10773 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10774 ; GFX940-TGSPLIT-NEXT: s_endpgm
10776 ; GFX11-WGP-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10777 ; GFX11-WGP: ; %bb.0: ; %entry
10778 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
10779 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
10780 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10781 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
10782 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
10783 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10784 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
10785 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10786 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10787 ; GFX11-WGP-NEXT: s_endpgm
10789 ; GFX11-CU-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10790 ; GFX11-CU: ; %bb.0: ; %entry
10791 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
10792 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
10793 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10794 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
10795 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
10796 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10797 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
10798 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10799 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10800 ; GFX11-CU-NEXT: s_endpgm
10802 ; GFX12-WGP-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10803 ; GFX12-WGP: ; %bb.0: ; %entry
10804 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
10805 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
10806 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10807 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
10808 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
10809 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10810 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
10811 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
10812 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
10813 ; GFX12-WGP-NEXT: s_endpgm
10815 ; GFX12-CU-LABEL: local_singlethread_one_as_acq_rel_ret_atomicrmw:
10816 ; GFX12-CU: ; %bb.0: ; %entry
10817 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
10818 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
10819 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
10820 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
10821 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
10822 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10823 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
10824 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
10825 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
10826 ; GFX12-CU-NEXT: s_endpgm
10827 ptr addrspace(3) %out, i32 %in) {
10829 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread-one-as") acq_rel
10830 store i32 %val, ptr addrspace(3) %out, align 4
10834 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_ret_atomicrmw(
10835 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10836 ; GFX6: ; %bb.0: ; %entry
10837 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
10838 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
10839 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
10840 ; GFX6-NEXT: s_mov_b32 m0, -1
10841 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10842 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
10843 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
10844 ; GFX6-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10845 ; GFX6-NEXT: s_mov_b32 m0, -1
10846 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
10847 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
10848 ; GFX6-NEXT: ds_write_b32 v0, v1
10849 ; GFX6-NEXT: s_endpgm
10851 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10852 ; GFX7: ; %bb.0: ; %entry
10853 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
10854 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
10855 ; GFX7-NEXT: s_mov_b32 m0, -1
10856 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10857 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10858 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
10859 ; GFX7-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10860 ; GFX7-NEXT: s_mov_b32 m0, -1
10861 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
10862 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
10863 ; GFX7-NEXT: ds_write_b32 v0, v1
10864 ; GFX7-NEXT: s_endpgm
10866 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10867 ; GFX10-WGP: ; %bb.0: ; %entry
10868 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
10869 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
10870 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10871 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
10872 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
10873 ; GFX10-WGP-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10874 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
10875 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
10876 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
10877 ; GFX10-WGP-NEXT: s_endpgm
10879 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10880 ; GFX10-CU: ; %bb.0: ; %entry
10881 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
10882 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
10883 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10884 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
10885 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
10886 ; GFX10-CU-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10887 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
10888 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
10889 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
10890 ; GFX10-CU-NEXT: s_endpgm
10892 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10893 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
10894 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
10895 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
10896 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10897 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10898 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10899 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
10900 ; SKIP-CACHE-INV-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10901 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
10902 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
10903 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
10904 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
10905 ; SKIP-CACHE-INV-NEXT: s_endpgm
10907 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10908 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
10909 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
10910 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
10911 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10912 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10913 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
10914 ; GFX90A-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10915 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10916 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10917 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10918 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
10920 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10921 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
10922 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
10923 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
10924 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10925 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10926 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
10927 ; GFX90A-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10928 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
10929 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10930 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
10931 ; GFX90A-TGSPLIT-NEXT: s_endpgm
10933 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10934 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
10935 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
10936 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
10937 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10938 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10939 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
10940 ; GFX940-NOTTGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10941 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10942 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10943 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
10944 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
10946 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10947 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
10948 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
10949 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
10950 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10951 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10952 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
10953 ; GFX940-TGSPLIT-NEXT: ds_wrxchg_rtn_b32 v1, v0, v1
10954 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
10955 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
10956 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
10957 ; GFX940-TGSPLIT-NEXT: s_endpgm
10959 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10960 ; GFX11-WGP: ; %bb.0: ; %entry
10961 ; GFX11-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
10962 ; GFX11-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
10963 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10964 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
10965 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
10966 ; GFX11-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10967 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
10968 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
10969 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
10970 ; GFX11-WGP-NEXT: s_endpgm
10972 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10973 ; GFX11-CU: ; %bb.0: ; %entry
10974 ; GFX11-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
10975 ; GFX11-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
10976 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10977 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
10978 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
10979 ; GFX11-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10980 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
10981 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
10982 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
10983 ; GFX11-CU-NEXT: s_endpgm
10985 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10986 ; GFX12-WGP: ; %bb.0: ; %entry
10987 ; GFX12-WGP-NEXT: s_load_b32 s0, s[2:3], 0x0
10988 ; GFX12-WGP-NEXT: s_load_b32 s1, s[2:3], 0x4
10989 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
10990 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
10991 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
10992 ; GFX12-WGP-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
10993 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
10994 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
10995 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
10996 ; GFX12-WGP-NEXT: s_endpgm
10998 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_ret_atomicrmw:
10999 ; GFX12-CU: ; %bb.0: ; %entry
11000 ; GFX12-CU-NEXT: s_load_b32 s0, s[2:3], 0x0
11001 ; GFX12-CU-NEXT: s_load_b32 s1, s[2:3], 0x4
11002 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11003 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
11004 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
11005 ; GFX12-CU-NEXT: ds_storexchg_rtn_b32 v1, v0, v1
11006 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
11007 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
11008 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
11009 ; GFX12-CU-NEXT: s_endpgm
11010 ptr addrspace(3) %out, i32 %in) {
11012 %val = atomicrmw volatile xchg ptr addrspace(3) %out, i32 %in syncscope("singlethread-one-as") seq_cst
11013 store i32 %val, ptr addrspace(3) %out, align 4
11017 define amdgpu_kernel void @local_singlethread_one_as_monotonic_monotonic_cmpxchg(
11018 ; GFX6-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11019 ; GFX6: ; %bb.0: ; %entry
11020 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
11021 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
11022 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
11023 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
11024 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
11025 ; GFX6-NEXT: s_mov_b32 m0, -1
11026 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11027 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
11028 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
11029 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
11030 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11031 ; GFX6-NEXT: s_endpgm
11033 ; GFX7-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11034 ; GFX7: ; %bb.0: ; %entry
11035 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
11036 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
11037 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
11038 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
11039 ; GFX7-NEXT: s_mov_b32 m0, -1
11040 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11041 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11042 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11043 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11044 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11045 ; GFX7-NEXT: s_endpgm
11047 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11048 ; GFX10-WGP: ; %bb.0: ; %entry
11049 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
11050 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
11051 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
11052 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
11053 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11054 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
11055 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11056 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
11057 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11058 ; GFX10-WGP-NEXT: s_endpgm
11060 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11061 ; GFX10-CU: ; %bb.0: ; %entry
11062 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
11063 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
11064 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
11065 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
11066 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11067 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
11068 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11069 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
11070 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11071 ; GFX10-CU-NEXT: s_endpgm
11073 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11074 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11075 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
11076 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
11077 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
11078 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
11079 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11080 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11081 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11082 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11083 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
11084 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11085 ; SKIP-CACHE-INV-NEXT: s_endpgm
11087 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11088 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11089 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11090 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11091 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11092 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11093 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11094 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11095 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11096 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11097 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11098 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11100 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11101 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11102 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11103 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11104 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11105 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11106 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11107 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11108 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11109 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11110 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11111 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11113 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11114 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11115 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11116 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11117 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11118 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11119 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11120 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11121 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11122 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11123 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11124 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11126 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11127 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11128 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11129 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11130 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11131 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11132 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11133 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11134 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11135 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11136 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11137 ; GFX940-TGSPLIT-NEXT: s_endpgm
11139 ; GFX11-WGP-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11140 ; GFX11-WGP: ; %bb.0: ; %entry
11141 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11142 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11143 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11144 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11145 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11146 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
11147 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
11148 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
11149 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11150 ; GFX11-WGP-NEXT: s_endpgm
11152 ; GFX11-CU-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11153 ; GFX11-CU: ; %bb.0: ; %entry
11154 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11155 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11156 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11157 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11158 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11159 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
11160 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
11161 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
11162 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11163 ; GFX11-CU-NEXT: s_endpgm
11165 ; GFX12-WGP-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11166 ; GFX12-WGP: ; %bb.0: ; %entry
11167 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11168 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11169 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11170 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11171 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11172 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
11173 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
11174 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
11175 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11176 ; GFX12-WGP-NEXT: s_endpgm
11178 ; GFX12-CU-LABEL: local_singlethread_one_as_monotonic_monotonic_cmpxchg:
11179 ; GFX12-CU: ; %bb.0: ; %entry
11180 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11181 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11182 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11183 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11184 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11185 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
11186 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
11187 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
11188 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11189 ; GFX12-CU-NEXT: s_endpgm
11190 ptr addrspace(3) %out, i32 %in, i32 %old) {
11192 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11193 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic monotonic
11197 define amdgpu_kernel void @local_singlethread_one_as_acquire_monotonic_cmpxchg(
11198 ; GFX6-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11199 ; GFX6: ; %bb.0: ; %entry
11200 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
11201 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
11202 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
11203 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
11204 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
11205 ; GFX6-NEXT: s_mov_b32 m0, -1
11206 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11207 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
11208 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
11209 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
11210 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11211 ; GFX6-NEXT: s_endpgm
11213 ; GFX7-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11214 ; GFX7: ; %bb.0: ; %entry
11215 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
11216 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
11217 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
11218 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
11219 ; GFX7-NEXT: s_mov_b32 m0, -1
11220 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11221 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11222 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11223 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11224 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11225 ; GFX7-NEXT: s_endpgm
11227 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11228 ; GFX10-WGP: ; %bb.0: ; %entry
11229 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
11230 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
11231 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
11232 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
11233 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11234 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
11235 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11236 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
11237 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11238 ; GFX10-WGP-NEXT: s_endpgm
11240 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11241 ; GFX10-CU: ; %bb.0: ; %entry
11242 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
11243 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
11244 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
11245 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
11246 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11247 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
11248 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11249 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
11250 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11251 ; GFX10-CU-NEXT: s_endpgm
11253 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11254 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11255 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
11256 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
11257 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
11258 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
11259 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11260 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11261 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11262 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11263 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
11264 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11265 ; SKIP-CACHE-INV-NEXT: s_endpgm
11267 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11268 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11269 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11270 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11271 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11272 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11273 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11274 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11275 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11276 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11277 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11278 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11280 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11281 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11282 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11283 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11284 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11285 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11286 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11287 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11288 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11289 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11290 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11291 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11293 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11294 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11295 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11296 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11297 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11298 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11299 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11300 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11301 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11302 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11303 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11304 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11306 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11307 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11308 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11309 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11310 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11311 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11312 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11313 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11314 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11315 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11316 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11317 ; GFX940-TGSPLIT-NEXT: s_endpgm
11319 ; GFX11-WGP-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11320 ; GFX11-WGP: ; %bb.0: ; %entry
11321 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11322 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11323 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11324 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11325 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11326 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
11327 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
11328 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
11329 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11330 ; GFX11-WGP-NEXT: s_endpgm
11332 ; GFX11-CU-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11333 ; GFX11-CU: ; %bb.0: ; %entry
11334 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11335 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11336 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11337 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11338 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11339 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
11340 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
11341 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
11342 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11343 ; GFX11-CU-NEXT: s_endpgm
11345 ; GFX12-WGP-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11346 ; GFX12-WGP: ; %bb.0: ; %entry
11347 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11348 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11349 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11350 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11351 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11352 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
11353 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
11354 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
11355 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11356 ; GFX12-WGP-NEXT: s_endpgm
11358 ; GFX12-CU-LABEL: local_singlethread_one_as_acquire_monotonic_cmpxchg:
11359 ; GFX12-CU: ; %bb.0: ; %entry
11360 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11361 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11362 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11363 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11364 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11365 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
11366 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
11367 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
11368 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11369 ; GFX12-CU-NEXT: s_endpgm
11370 ptr addrspace(3) %out, i32 %in, i32 %old) {
11372 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11373 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire monotonic
11377 define amdgpu_kernel void @local_singlethread_one_as_release_monotonic_cmpxchg(
11378 ; GFX6-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11379 ; GFX6: ; %bb.0: ; %entry
11380 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
11381 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
11382 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
11383 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
11384 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
11385 ; GFX6-NEXT: s_mov_b32 m0, -1
11386 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11387 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
11388 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
11389 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
11390 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11391 ; GFX6-NEXT: s_endpgm
11393 ; GFX7-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11394 ; GFX7: ; %bb.0: ; %entry
11395 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
11396 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
11397 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
11398 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
11399 ; GFX7-NEXT: s_mov_b32 m0, -1
11400 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11401 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11402 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11403 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11404 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11405 ; GFX7-NEXT: s_endpgm
11407 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11408 ; GFX10-WGP: ; %bb.0: ; %entry
11409 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
11410 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
11411 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
11412 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
11413 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11414 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
11415 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11416 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
11417 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11418 ; GFX10-WGP-NEXT: s_endpgm
11420 ; GFX10-CU-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11421 ; GFX10-CU: ; %bb.0: ; %entry
11422 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
11423 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
11424 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
11425 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
11426 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11427 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
11428 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11429 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
11430 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11431 ; GFX10-CU-NEXT: s_endpgm
11433 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11434 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11435 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
11436 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
11437 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
11438 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
11439 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11440 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11441 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11442 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11443 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
11444 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11445 ; SKIP-CACHE-INV-NEXT: s_endpgm
11447 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11448 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11449 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11450 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11451 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11452 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11453 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11454 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11455 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11456 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11457 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11458 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11460 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11461 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11462 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11463 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11464 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11465 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11466 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11467 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11468 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11469 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11470 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11471 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11473 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11474 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11475 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11476 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11477 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11478 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11479 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11480 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11481 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11482 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11483 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11484 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11486 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11487 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11488 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11489 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11490 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11491 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11492 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11493 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11494 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11495 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11496 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11497 ; GFX940-TGSPLIT-NEXT: s_endpgm
11499 ; GFX11-WGP-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11500 ; GFX11-WGP: ; %bb.0: ; %entry
11501 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11502 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11503 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11504 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11505 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11506 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
11507 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
11508 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
11509 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11510 ; GFX11-WGP-NEXT: s_endpgm
11512 ; GFX11-CU-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11513 ; GFX11-CU: ; %bb.0: ; %entry
11514 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11515 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11516 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11517 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11518 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11519 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
11520 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
11521 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
11522 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11523 ; GFX11-CU-NEXT: s_endpgm
11525 ; GFX12-WGP-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11526 ; GFX12-WGP: ; %bb.0: ; %entry
11527 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11528 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11529 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11530 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11531 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11532 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
11533 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
11534 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
11535 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11536 ; GFX12-WGP-NEXT: s_endpgm
11538 ; GFX12-CU-LABEL: local_singlethread_one_as_release_monotonic_cmpxchg:
11539 ; GFX12-CU: ; %bb.0: ; %entry
11540 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11541 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11542 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11543 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11544 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11545 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
11546 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
11547 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
11548 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11549 ; GFX12-CU-NEXT: s_endpgm
11550 ptr addrspace(3) %out, i32 %in, i32 %old) {
11552 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11553 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release monotonic
11557 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_monotonic_cmpxchg(
11558 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11559 ; GFX6: ; %bb.0: ; %entry
11560 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
11561 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
11562 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
11563 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
11564 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
11565 ; GFX6-NEXT: s_mov_b32 m0, -1
11566 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11567 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
11568 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
11569 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
11570 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11571 ; GFX6-NEXT: s_endpgm
11573 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11574 ; GFX7: ; %bb.0: ; %entry
11575 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
11576 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
11577 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
11578 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
11579 ; GFX7-NEXT: s_mov_b32 m0, -1
11580 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11581 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11582 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11583 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11584 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11585 ; GFX7-NEXT: s_endpgm
11587 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11588 ; GFX10-WGP: ; %bb.0: ; %entry
11589 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
11590 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
11591 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
11592 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
11593 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11594 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
11595 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11596 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
11597 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11598 ; GFX10-WGP-NEXT: s_endpgm
11600 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11601 ; GFX10-CU: ; %bb.0: ; %entry
11602 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
11603 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
11604 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
11605 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
11606 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11607 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
11608 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11609 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
11610 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11611 ; GFX10-CU-NEXT: s_endpgm
11613 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11614 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11615 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
11616 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
11617 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
11618 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
11619 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11620 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11621 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11622 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11623 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
11624 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11625 ; SKIP-CACHE-INV-NEXT: s_endpgm
11627 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11628 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11629 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11630 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11631 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11632 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11633 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11634 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11635 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11636 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11637 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11638 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11640 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11641 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11642 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11643 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11644 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11645 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11646 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11647 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11648 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11649 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11650 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11651 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11653 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11654 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11655 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11656 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11657 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11658 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11659 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11660 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11661 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11662 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11663 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11664 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11666 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11667 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11668 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11669 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11670 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11671 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11672 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11673 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11674 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11675 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11676 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11677 ; GFX940-TGSPLIT-NEXT: s_endpgm
11679 ; GFX11-WGP-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11680 ; GFX11-WGP: ; %bb.0: ; %entry
11681 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11682 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11683 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11684 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11685 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11686 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
11687 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
11688 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
11689 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11690 ; GFX11-WGP-NEXT: s_endpgm
11692 ; GFX11-CU-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11693 ; GFX11-CU: ; %bb.0: ; %entry
11694 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11695 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11696 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11697 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11698 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11699 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
11700 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
11701 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
11702 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11703 ; GFX11-CU-NEXT: s_endpgm
11705 ; GFX12-WGP-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11706 ; GFX12-WGP: ; %bb.0: ; %entry
11707 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11708 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11709 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11710 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11711 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11712 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
11713 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
11714 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
11715 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11716 ; GFX12-WGP-NEXT: s_endpgm
11718 ; GFX12-CU-LABEL: local_singlethread_one_as_acq_rel_monotonic_cmpxchg:
11719 ; GFX12-CU: ; %bb.0: ; %entry
11720 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11721 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11722 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11723 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11724 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11725 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
11726 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
11727 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
11728 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11729 ; GFX12-CU-NEXT: s_endpgm
11730 ptr addrspace(3) %out, i32 %in, i32 %old) {
11732 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11733 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel monotonic
11737 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_monotonic_cmpxchg(
11738 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11739 ; GFX6: ; %bb.0: ; %entry
11740 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
11741 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
11742 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
11743 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
11744 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
11745 ; GFX6-NEXT: s_mov_b32 m0, -1
11746 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11747 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
11748 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
11749 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
11750 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11751 ; GFX6-NEXT: s_endpgm
11753 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11754 ; GFX7: ; %bb.0: ; %entry
11755 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
11756 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
11757 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
11758 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
11759 ; GFX7-NEXT: s_mov_b32 m0, -1
11760 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11761 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11762 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11763 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11764 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11765 ; GFX7-NEXT: s_endpgm
11767 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11768 ; GFX10-WGP: ; %bb.0: ; %entry
11769 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
11770 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
11771 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
11772 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
11773 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11774 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
11775 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11776 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
11777 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11778 ; GFX10-WGP-NEXT: s_endpgm
11780 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11781 ; GFX10-CU: ; %bb.0: ; %entry
11782 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
11783 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
11784 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
11785 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
11786 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11787 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
11788 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11789 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
11790 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11791 ; GFX10-CU-NEXT: s_endpgm
11793 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11794 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11795 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
11796 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
11797 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
11798 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
11799 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11800 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11801 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11802 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11803 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
11804 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11805 ; SKIP-CACHE-INV-NEXT: s_endpgm
11807 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11808 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11809 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11810 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11811 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11812 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11813 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11814 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11815 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11816 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11817 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11818 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
11820 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11821 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
11822 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11823 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11824 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11825 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11826 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11827 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11828 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11829 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11830 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11831 ; GFX90A-TGSPLIT-NEXT: s_endpgm
11833 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11834 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
11835 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11836 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11837 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11838 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11839 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11840 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11841 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11842 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11843 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11844 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
11846 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11847 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
11848 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
11849 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
11850 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
11851 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
11852 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11853 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
11854 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
11855 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
11856 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11857 ; GFX940-TGSPLIT-NEXT: s_endpgm
11859 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11860 ; GFX11-WGP: ; %bb.0: ; %entry
11861 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11862 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11863 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11864 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11865 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
11866 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
11867 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
11868 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
11869 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11870 ; GFX11-WGP-NEXT: s_endpgm
11872 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11873 ; GFX11-CU: ; %bb.0: ; %entry
11874 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11875 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11876 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11877 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11878 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
11879 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
11880 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
11881 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
11882 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11883 ; GFX11-CU-NEXT: s_endpgm
11885 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11886 ; GFX12-WGP: ; %bb.0: ; %entry
11887 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
11888 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
11889 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
11890 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
11891 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
11892 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
11893 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
11894 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
11895 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11896 ; GFX12-WGP-NEXT: s_endpgm
11898 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_monotonic_cmpxchg:
11899 ; GFX12-CU: ; %bb.0: ; %entry
11900 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
11901 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
11902 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
11903 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
11904 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
11905 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
11906 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
11907 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
11908 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
11909 ; GFX12-CU-NEXT: s_endpgm
11910 ptr addrspace(3) %out, i32 %in, i32 %old) {
11912 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
11913 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst monotonic
11917 define amdgpu_kernel void @local_singlethread_one_as_monotonic_acquire_cmpxchg(
11918 ; GFX6-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
11919 ; GFX6: ; %bb.0: ; %entry
11920 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
11921 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
11922 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
11923 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
11924 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
11925 ; GFX6-NEXT: s_mov_b32 m0, -1
11926 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
11927 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
11928 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
11929 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
11930 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11931 ; GFX6-NEXT: s_endpgm
11933 ; GFX7-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
11934 ; GFX7: ; %bb.0: ; %entry
11935 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
11936 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
11937 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
11938 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
11939 ; GFX7-NEXT: s_mov_b32 m0, -1
11940 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
11941 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
11942 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
11943 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
11944 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11945 ; GFX7-NEXT: s_endpgm
11947 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
11948 ; GFX10-WGP: ; %bb.0: ; %entry
11949 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
11950 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
11951 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
11952 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
11953 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
11954 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
11955 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
11956 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
11957 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11958 ; GFX10-WGP-NEXT: s_endpgm
11960 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
11961 ; GFX10-CU: ; %bb.0: ; %entry
11962 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
11963 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
11964 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
11965 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
11966 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
11967 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
11968 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
11969 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
11970 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11971 ; GFX10-CU-NEXT: s_endpgm
11973 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
11974 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
11975 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
11976 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
11977 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
11978 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
11979 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
11980 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
11981 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
11982 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
11983 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
11984 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11985 ; SKIP-CACHE-INV-NEXT: s_endpgm
11987 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
11988 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
11989 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
11990 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
11991 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
11992 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
11993 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
11994 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
11995 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
11996 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
11997 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
11998 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12000 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
12001 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12002 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12003 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12004 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12005 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12006 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12007 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12008 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12009 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12010 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12011 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12013 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
12014 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12015 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12016 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12017 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12018 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12019 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12020 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12021 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12022 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12023 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12024 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12026 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
12027 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12028 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12029 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12030 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12031 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12032 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12033 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12034 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12035 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12036 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12037 ; GFX940-TGSPLIT-NEXT: s_endpgm
12039 ; GFX11-WGP-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
12040 ; GFX11-WGP: ; %bb.0: ; %entry
12041 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12042 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12043 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12044 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12045 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12046 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
12047 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
12048 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
12049 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12050 ; GFX11-WGP-NEXT: s_endpgm
12052 ; GFX11-CU-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
12053 ; GFX11-CU: ; %bb.0: ; %entry
12054 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12055 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12056 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12057 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12058 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12059 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
12060 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
12061 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
12062 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12063 ; GFX11-CU-NEXT: s_endpgm
12065 ; GFX12-WGP-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
12066 ; GFX12-WGP: ; %bb.0: ; %entry
12067 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12068 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12069 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12070 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12071 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12072 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
12073 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
12074 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
12075 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12076 ; GFX12-WGP-NEXT: s_endpgm
12078 ; GFX12-CU-LABEL: local_singlethread_one_as_monotonic_acquire_cmpxchg:
12079 ; GFX12-CU: ; %bb.0: ; %entry
12080 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12081 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12082 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12083 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12084 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12085 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
12086 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
12087 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
12088 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12089 ; GFX12-CU-NEXT: s_endpgm
12090 ptr addrspace(3) %out, i32 %in, i32 %old) {
12092 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
12093 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic acquire
12097 define amdgpu_kernel void @local_singlethread_one_as_acquire_acquire_cmpxchg(
12098 ; GFX6-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12099 ; GFX6: ; %bb.0: ; %entry
12100 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
12101 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
12102 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
12103 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
12104 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
12105 ; GFX6-NEXT: s_mov_b32 m0, -1
12106 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12107 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
12108 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
12109 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
12110 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12111 ; GFX6-NEXT: s_endpgm
12113 ; GFX7-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12114 ; GFX7: ; %bb.0: ; %entry
12115 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
12116 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
12117 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
12118 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
12119 ; GFX7-NEXT: s_mov_b32 m0, -1
12120 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12121 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
12122 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12123 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
12124 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12125 ; GFX7-NEXT: s_endpgm
12127 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12128 ; GFX10-WGP: ; %bb.0: ; %entry
12129 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
12130 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
12131 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
12132 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
12133 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12134 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
12135 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12136 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
12137 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12138 ; GFX10-WGP-NEXT: s_endpgm
12140 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12141 ; GFX10-CU: ; %bb.0: ; %entry
12142 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
12143 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
12144 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
12145 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
12146 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12147 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
12148 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12149 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
12150 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12151 ; GFX10-CU-NEXT: s_endpgm
12153 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12154 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12155 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
12156 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
12157 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
12158 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
12159 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
12160 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12161 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12162 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12163 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
12164 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12165 ; SKIP-CACHE-INV-NEXT: s_endpgm
12167 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12168 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12169 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12170 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12171 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12172 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12173 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12174 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12175 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12176 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12177 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12178 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12180 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12181 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12182 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12183 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12184 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12185 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12186 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12187 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12188 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12189 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12190 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12191 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12193 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12194 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12195 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12196 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12197 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12198 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12199 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12200 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12201 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12202 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12203 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12204 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12206 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12207 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12208 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12209 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12210 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12211 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12212 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12213 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12214 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12215 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12216 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12217 ; GFX940-TGSPLIT-NEXT: s_endpgm
12219 ; GFX11-WGP-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12220 ; GFX11-WGP: ; %bb.0: ; %entry
12221 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12222 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12223 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12224 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12225 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12226 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
12227 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
12228 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
12229 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12230 ; GFX11-WGP-NEXT: s_endpgm
12232 ; GFX11-CU-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12233 ; GFX11-CU: ; %bb.0: ; %entry
12234 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12235 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12236 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12237 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12238 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12239 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
12240 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
12241 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
12242 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12243 ; GFX11-CU-NEXT: s_endpgm
12245 ; GFX12-WGP-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12246 ; GFX12-WGP: ; %bb.0: ; %entry
12247 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12248 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12249 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12250 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12251 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12252 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
12253 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
12254 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
12255 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12256 ; GFX12-WGP-NEXT: s_endpgm
12258 ; GFX12-CU-LABEL: local_singlethread_one_as_acquire_acquire_cmpxchg:
12259 ; GFX12-CU: ; %bb.0: ; %entry
12260 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12261 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12262 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12263 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12264 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12265 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
12266 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
12267 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
12268 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12269 ; GFX12-CU-NEXT: s_endpgm
12270 ptr addrspace(3) %out, i32 %in, i32 %old) {
12272 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
12273 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire acquire
12277 define amdgpu_kernel void @local_singlethread_one_as_release_acquire_cmpxchg(
12278 ; GFX6-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12279 ; GFX6: ; %bb.0: ; %entry
12280 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
12281 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
12282 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
12283 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
12284 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
12285 ; GFX6-NEXT: s_mov_b32 m0, -1
12286 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12287 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
12288 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
12289 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
12290 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12291 ; GFX6-NEXT: s_endpgm
12293 ; GFX7-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12294 ; GFX7: ; %bb.0: ; %entry
12295 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
12296 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
12297 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
12298 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
12299 ; GFX7-NEXT: s_mov_b32 m0, -1
12300 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12301 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
12302 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12303 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
12304 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12305 ; GFX7-NEXT: s_endpgm
12307 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12308 ; GFX10-WGP: ; %bb.0: ; %entry
12309 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
12310 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
12311 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
12312 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
12313 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12314 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
12315 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12316 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
12317 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12318 ; GFX10-WGP-NEXT: s_endpgm
12320 ; GFX10-CU-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12321 ; GFX10-CU: ; %bb.0: ; %entry
12322 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
12323 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
12324 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
12325 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
12326 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12327 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
12328 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12329 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
12330 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12331 ; GFX10-CU-NEXT: s_endpgm
12333 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12334 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12335 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
12336 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
12337 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
12338 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
12339 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
12340 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12341 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12342 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12343 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
12344 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12345 ; SKIP-CACHE-INV-NEXT: s_endpgm
12347 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12348 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12349 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12350 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12351 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12352 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12353 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12354 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12355 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12356 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12357 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12358 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12360 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12361 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12362 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12363 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12364 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12365 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12366 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12367 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12368 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12369 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12370 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12371 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12373 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12374 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12375 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12376 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12377 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12378 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12379 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12380 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12381 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12382 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12383 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12384 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12386 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12387 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12388 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12389 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12390 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12391 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12392 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12393 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12394 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12395 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12396 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12397 ; GFX940-TGSPLIT-NEXT: s_endpgm
12399 ; GFX11-WGP-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12400 ; GFX11-WGP: ; %bb.0: ; %entry
12401 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12402 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12403 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12404 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12405 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12406 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
12407 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
12408 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
12409 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12410 ; GFX11-WGP-NEXT: s_endpgm
12412 ; GFX11-CU-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12413 ; GFX11-CU: ; %bb.0: ; %entry
12414 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12415 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12416 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12417 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12418 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12419 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
12420 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
12421 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
12422 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12423 ; GFX11-CU-NEXT: s_endpgm
12425 ; GFX12-WGP-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12426 ; GFX12-WGP: ; %bb.0: ; %entry
12427 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12428 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12429 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12430 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12431 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12432 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
12433 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
12434 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
12435 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12436 ; GFX12-WGP-NEXT: s_endpgm
12438 ; GFX12-CU-LABEL: local_singlethread_one_as_release_acquire_cmpxchg:
12439 ; GFX12-CU: ; %bb.0: ; %entry
12440 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12441 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12442 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12443 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12444 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12445 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
12446 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
12447 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
12448 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12449 ; GFX12-CU-NEXT: s_endpgm
12450 ptr addrspace(3) %out, i32 %in, i32 %old) {
12452 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
12453 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release acquire
12457 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_acquire_cmpxchg(
12458 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12459 ; GFX6: ; %bb.0: ; %entry
12460 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
12461 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
12462 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
12463 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
12464 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
12465 ; GFX6-NEXT: s_mov_b32 m0, -1
12466 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12467 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
12468 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
12469 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
12470 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12471 ; GFX6-NEXT: s_endpgm
12473 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12474 ; GFX7: ; %bb.0: ; %entry
12475 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
12476 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
12477 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
12478 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
12479 ; GFX7-NEXT: s_mov_b32 m0, -1
12480 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12481 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
12482 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12483 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
12484 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12485 ; GFX7-NEXT: s_endpgm
12487 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12488 ; GFX10-WGP: ; %bb.0: ; %entry
12489 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
12490 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
12491 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
12492 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
12493 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12494 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
12495 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12496 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
12497 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12498 ; GFX10-WGP-NEXT: s_endpgm
12500 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12501 ; GFX10-CU: ; %bb.0: ; %entry
12502 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
12503 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
12504 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
12505 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
12506 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12507 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
12508 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12509 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
12510 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12511 ; GFX10-CU-NEXT: s_endpgm
12513 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12514 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12515 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
12516 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
12517 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
12518 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
12519 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
12520 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12521 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12522 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12523 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
12524 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12525 ; SKIP-CACHE-INV-NEXT: s_endpgm
12527 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12528 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12529 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12530 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12531 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12532 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12533 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12534 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12535 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12536 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12537 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12538 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12540 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12541 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12542 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12543 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12544 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12545 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12546 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12547 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12548 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12549 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12550 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12551 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12553 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12554 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12555 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12556 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12557 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12558 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12559 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12560 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12561 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12562 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12563 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12564 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12566 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12567 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12568 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12569 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12570 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12571 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12572 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12573 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12574 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12575 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12576 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12577 ; GFX940-TGSPLIT-NEXT: s_endpgm
12579 ; GFX11-WGP-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12580 ; GFX11-WGP: ; %bb.0: ; %entry
12581 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12582 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12583 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12584 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12585 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12586 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
12587 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
12588 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
12589 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12590 ; GFX11-WGP-NEXT: s_endpgm
12592 ; GFX11-CU-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12593 ; GFX11-CU: ; %bb.0: ; %entry
12594 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12595 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12596 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12597 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12598 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12599 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
12600 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
12601 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
12602 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12603 ; GFX11-CU-NEXT: s_endpgm
12605 ; GFX12-WGP-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12606 ; GFX12-WGP: ; %bb.0: ; %entry
12607 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12608 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12609 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12610 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12611 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12612 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
12613 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
12614 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
12615 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12616 ; GFX12-WGP-NEXT: s_endpgm
12618 ; GFX12-CU-LABEL: local_singlethread_one_as_acq_rel_acquire_cmpxchg:
12619 ; GFX12-CU: ; %bb.0: ; %entry
12620 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12621 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12622 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12623 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12624 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12625 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
12626 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
12627 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
12628 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12629 ; GFX12-CU-NEXT: s_endpgm
12630 ptr addrspace(3) %out, i32 %in, i32 %old) {
12632 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
12633 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel acquire
12637 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_acquire_cmpxchg(
12638 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12639 ; GFX6: ; %bb.0: ; %entry
12640 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
12641 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
12642 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
12643 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
12644 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
12645 ; GFX6-NEXT: s_mov_b32 m0, -1
12646 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12647 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
12648 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
12649 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
12650 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12651 ; GFX6-NEXT: s_endpgm
12653 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12654 ; GFX7: ; %bb.0: ; %entry
12655 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
12656 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
12657 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
12658 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
12659 ; GFX7-NEXT: s_mov_b32 m0, -1
12660 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12661 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
12662 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12663 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
12664 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12665 ; GFX7-NEXT: s_endpgm
12667 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12668 ; GFX10-WGP: ; %bb.0: ; %entry
12669 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
12670 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
12671 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
12672 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
12673 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12674 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
12675 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12676 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
12677 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12678 ; GFX10-WGP-NEXT: s_endpgm
12680 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12681 ; GFX10-CU: ; %bb.0: ; %entry
12682 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
12683 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
12684 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
12685 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
12686 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12687 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
12688 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12689 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
12690 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12691 ; GFX10-CU-NEXT: s_endpgm
12693 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12694 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12695 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
12696 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
12697 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
12698 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
12699 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
12700 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12701 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12702 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12703 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
12704 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12705 ; SKIP-CACHE-INV-NEXT: s_endpgm
12707 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12708 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12709 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12710 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12711 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12712 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12713 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12714 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12715 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12716 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12717 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12718 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12720 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12721 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12722 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12723 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12724 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12725 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12726 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12727 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12728 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12729 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12730 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12731 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12733 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12734 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12735 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12736 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12737 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12738 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12739 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12740 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12741 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12742 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12743 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12744 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12746 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12747 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12748 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12749 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12750 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12751 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12752 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12753 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12754 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12755 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12756 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12757 ; GFX940-TGSPLIT-NEXT: s_endpgm
12759 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12760 ; GFX11-WGP: ; %bb.0: ; %entry
12761 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12762 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12763 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12764 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12765 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12766 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
12767 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
12768 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
12769 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12770 ; GFX11-WGP-NEXT: s_endpgm
12772 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12773 ; GFX11-CU: ; %bb.0: ; %entry
12774 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12775 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12776 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12777 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12778 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12779 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
12780 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
12781 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
12782 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12783 ; GFX11-CU-NEXT: s_endpgm
12785 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12786 ; GFX12-WGP: ; %bb.0: ; %entry
12787 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12788 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12789 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12790 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12791 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12792 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
12793 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
12794 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
12795 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12796 ; GFX12-WGP-NEXT: s_endpgm
12798 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_acquire_cmpxchg:
12799 ; GFX12-CU: ; %bb.0: ; %entry
12800 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12801 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12802 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12803 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12804 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12805 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
12806 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
12807 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
12808 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12809 ; GFX12-CU-NEXT: s_endpgm
12810 ptr addrspace(3) %out, i32 %in, i32 %old) {
12812 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
12813 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst acquire
12817 define amdgpu_kernel void @local_singlethread_one_as_monotonic_seq_cst_cmpxchg(
12818 ; GFX6-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12819 ; GFX6: ; %bb.0: ; %entry
12820 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
12821 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
12822 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
12823 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
12824 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
12825 ; GFX6-NEXT: s_mov_b32 m0, -1
12826 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
12827 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
12828 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
12829 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
12830 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12831 ; GFX6-NEXT: s_endpgm
12833 ; GFX7-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12834 ; GFX7: ; %bb.0: ; %entry
12835 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
12836 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
12837 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
12838 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
12839 ; GFX7-NEXT: s_mov_b32 m0, -1
12840 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
12841 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
12842 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
12843 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
12844 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12845 ; GFX7-NEXT: s_endpgm
12847 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12848 ; GFX10-WGP: ; %bb.0: ; %entry
12849 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
12850 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
12851 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
12852 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
12853 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
12854 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
12855 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
12856 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
12857 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12858 ; GFX10-WGP-NEXT: s_endpgm
12860 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12861 ; GFX10-CU: ; %bb.0: ; %entry
12862 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
12863 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
12864 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
12865 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
12866 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
12867 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
12868 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
12869 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
12870 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12871 ; GFX10-CU-NEXT: s_endpgm
12873 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12874 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
12875 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
12876 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
12877 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
12878 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
12879 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
12880 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
12881 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
12882 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
12883 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
12884 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12885 ; SKIP-CACHE-INV-NEXT: s_endpgm
12887 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12888 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
12889 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12890 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12891 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12892 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12893 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12894 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12895 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12896 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12897 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12898 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
12900 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12901 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
12902 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
12903 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
12904 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
12905 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
12906 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12907 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
12908 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
12909 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
12910 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12911 ; GFX90A-TGSPLIT-NEXT: s_endpgm
12913 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12914 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
12915 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12916 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12917 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12918 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12919 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12920 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12921 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12922 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12923 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12924 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
12926 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12927 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
12928 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
12929 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
12930 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
12931 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
12932 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
12933 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
12934 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
12935 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
12936 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
12937 ; GFX940-TGSPLIT-NEXT: s_endpgm
12939 ; GFX11-WGP-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12940 ; GFX11-WGP: ; %bb.0: ; %entry
12941 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12942 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12943 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12944 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12945 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
12946 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
12947 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
12948 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
12949 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12950 ; GFX11-WGP-NEXT: s_endpgm
12952 ; GFX11-CU-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12953 ; GFX11-CU: ; %bb.0: ; %entry
12954 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12955 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12956 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12957 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12958 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
12959 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
12960 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
12961 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
12962 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12963 ; GFX11-CU-NEXT: s_endpgm
12965 ; GFX12-WGP-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12966 ; GFX12-WGP: ; %bb.0: ; %entry
12967 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
12968 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
12969 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
12970 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
12971 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
12972 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
12973 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
12974 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
12975 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12976 ; GFX12-WGP-NEXT: s_endpgm
12978 ; GFX12-CU-LABEL: local_singlethread_one_as_monotonic_seq_cst_cmpxchg:
12979 ; GFX12-CU: ; %bb.0: ; %entry
12980 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
12981 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
12982 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
12983 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
12984 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
12985 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
12986 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
12987 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
12988 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
12989 ; GFX12-CU-NEXT: s_endpgm
12990 ptr addrspace(3) %out, i32 %in, i32 %old) {
12992 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
12993 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic seq_cst
12997 define amdgpu_kernel void @local_singlethread_one_as_acquire_seq_cst_cmpxchg(
12998 ; GFX6-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
12999 ; GFX6: ; %bb.0: ; %entry
13000 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
13001 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
13002 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
13003 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
13004 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
13005 ; GFX6-NEXT: s_mov_b32 m0, -1
13006 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13007 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
13008 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
13009 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
13010 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13011 ; GFX6-NEXT: s_endpgm
13013 ; GFX7-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13014 ; GFX7: ; %bb.0: ; %entry
13015 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
13016 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
13017 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
13018 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
13019 ; GFX7-NEXT: s_mov_b32 m0, -1
13020 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13021 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
13022 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13023 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
13024 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13025 ; GFX7-NEXT: s_endpgm
13027 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13028 ; GFX10-WGP: ; %bb.0: ; %entry
13029 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
13030 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
13031 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
13032 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
13033 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13034 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
13035 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13036 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
13037 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13038 ; GFX10-WGP-NEXT: s_endpgm
13040 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13041 ; GFX10-CU: ; %bb.0: ; %entry
13042 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
13043 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
13044 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
13045 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
13046 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13047 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
13048 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13049 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
13050 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13051 ; GFX10-CU-NEXT: s_endpgm
13053 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13054 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13055 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
13056 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
13057 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
13058 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
13059 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
13060 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13061 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
13062 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13063 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
13064 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13065 ; SKIP-CACHE-INV-NEXT: s_endpgm
13067 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13068 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13069 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13070 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
13071 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
13072 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
13073 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13074 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
13075 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
13076 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
13077 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13078 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13080 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13081 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13082 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13083 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
13084 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
13085 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
13086 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13087 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
13088 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
13089 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
13090 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13091 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13093 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13094 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13095 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13096 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
13097 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
13098 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
13099 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13100 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
13101 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
13102 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
13103 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13104 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13106 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13107 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13108 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13109 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
13110 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
13111 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
13112 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13113 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
13114 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
13115 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
13116 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13117 ; GFX940-TGSPLIT-NEXT: s_endpgm
13119 ; GFX11-WGP-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13120 ; GFX11-WGP: ; %bb.0: ; %entry
13121 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13122 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
13123 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
13124 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
13125 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13126 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
13127 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
13128 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
13129 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13130 ; GFX11-WGP-NEXT: s_endpgm
13132 ; GFX11-CU-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13133 ; GFX11-CU: ; %bb.0: ; %entry
13134 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13135 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
13136 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
13137 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
13138 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13139 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
13140 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
13141 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
13142 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13143 ; GFX11-CU-NEXT: s_endpgm
13145 ; GFX12-WGP-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13146 ; GFX12-WGP: ; %bb.0: ; %entry
13147 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13148 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
13149 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
13150 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
13151 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
13152 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
13153 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
13154 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
13155 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13156 ; GFX12-WGP-NEXT: s_endpgm
13158 ; GFX12-CU-LABEL: local_singlethread_one_as_acquire_seq_cst_cmpxchg:
13159 ; GFX12-CU: ; %bb.0: ; %entry
13160 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13161 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
13162 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
13163 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
13164 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
13165 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
13166 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
13167 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
13168 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13169 ; GFX12-CU-NEXT: s_endpgm
13170 ptr addrspace(3) %out, i32 %in, i32 %old) {
13172 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
13173 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire seq_cst
13177 define amdgpu_kernel void @local_singlethread_one_as_release_seq_cst_cmpxchg(
13178 ; GFX6-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13179 ; GFX6: ; %bb.0: ; %entry
13180 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
13181 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
13182 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
13183 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
13184 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
13185 ; GFX6-NEXT: s_mov_b32 m0, -1
13186 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13187 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
13188 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
13189 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
13190 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13191 ; GFX6-NEXT: s_endpgm
13193 ; GFX7-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13194 ; GFX7: ; %bb.0: ; %entry
13195 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
13196 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
13197 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
13198 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
13199 ; GFX7-NEXT: s_mov_b32 m0, -1
13200 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13201 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
13202 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13203 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
13204 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13205 ; GFX7-NEXT: s_endpgm
13207 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13208 ; GFX10-WGP: ; %bb.0: ; %entry
13209 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
13210 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
13211 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
13212 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
13213 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13214 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
13215 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13216 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
13217 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13218 ; GFX10-WGP-NEXT: s_endpgm
13220 ; GFX10-CU-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13221 ; GFX10-CU: ; %bb.0: ; %entry
13222 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
13223 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
13224 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
13225 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
13226 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13227 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
13228 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13229 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
13230 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13231 ; GFX10-CU-NEXT: s_endpgm
13233 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13234 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13235 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
13236 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
13237 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
13238 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
13239 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
13240 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13241 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
13242 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13243 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
13244 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13245 ; SKIP-CACHE-INV-NEXT: s_endpgm
13247 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13248 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13249 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13250 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
13251 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
13252 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
13253 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13254 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
13255 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
13256 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
13257 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13258 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13260 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13261 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13262 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13263 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
13264 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
13265 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
13266 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13267 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
13268 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
13269 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
13270 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13271 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13273 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13274 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13275 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13276 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
13277 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
13278 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
13279 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13280 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
13281 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
13282 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
13283 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13284 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13286 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13287 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13288 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13289 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
13290 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
13291 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
13292 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13293 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
13294 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
13295 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
13296 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13297 ; GFX940-TGSPLIT-NEXT: s_endpgm
13299 ; GFX11-WGP-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13300 ; GFX11-WGP: ; %bb.0: ; %entry
13301 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13302 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
13303 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
13304 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
13305 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13306 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
13307 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
13308 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
13309 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13310 ; GFX11-WGP-NEXT: s_endpgm
13312 ; GFX11-CU-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13313 ; GFX11-CU: ; %bb.0: ; %entry
13314 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13315 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
13316 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
13317 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
13318 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13319 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
13320 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
13321 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
13322 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13323 ; GFX11-CU-NEXT: s_endpgm
13325 ; GFX12-WGP-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13326 ; GFX12-WGP: ; %bb.0: ; %entry
13327 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13328 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
13329 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
13330 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
13331 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
13332 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
13333 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
13334 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
13335 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13336 ; GFX12-WGP-NEXT: s_endpgm
13338 ; GFX12-CU-LABEL: local_singlethread_one_as_release_seq_cst_cmpxchg:
13339 ; GFX12-CU: ; %bb.0: ; %entry
13340 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13341 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
13342 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
13343 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
13344 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
13345 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
13346 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
13347 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
13348 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13349 ; GFX12-CU-NEXT: s_endpgm
13350 ptr addrspace(3) %out, i32 %in, i32 %old) {
13352 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
13353 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release seq_cst
13357 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_seq_cst_cmpxchg(
13358 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13359 ; GFX6: ; %bb.0: ; %entry
13360 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
13361 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
13362 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
13363 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
13364 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
13365 ; GFX6-NEXT: s_mov_b32 m0, -1
13366 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13367 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
13368 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
13369 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
13370 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13371 ; GFX6-NEXT: s_endpgm
13373 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13374 ; GFX7: ; %bb.0: ; %entry
13375 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
13376 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
13377 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
13378 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
13379 ; GFX7-NEXT: s_mov_b32 m0, -1
13380 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13381 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
13382 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13383 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
13384 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13385 ; GFX7-NEXT: s_endpgm
13387 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13388 ; GFX10-WGP: ; %bb.0: ; %entry
13389 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
13390 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
13391 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
13392 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
13393 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13394 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
13395 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13396 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
13397 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13398 ; GFX10-WGP-NEXT: s_endpgm
13400 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13401 ; GFX10-CU: ; %bb.0: ; %entry
13402 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
13403 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
13404 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
13405 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
13406 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13407 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
13408 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13409 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
13410 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13411 ; GFX10-CU-NEXT: s_endpgm
13413 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13414 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13415 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
13416 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
13417 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
13418 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
13419 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
13420 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13421 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
13422 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13423 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
13424 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13425 ; SKIP-CACHE-INV-NEXT: s_endpgm
13427 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13428 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13429 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13430 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
13431 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
13432 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
13433 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13434 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
13435 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
13436 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
13437 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13438 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13440 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13441 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13442 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13443 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
13444 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
13445 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
13446 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13447 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
13448 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
13449 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
13450 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13451 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13453 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13454 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13455 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13456 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
13457 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
13458 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
13459 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13460 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
13461 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
13462 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
13463 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13464 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13466 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13467 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13468 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13469 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
13470 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
13471 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
13472 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13473 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
13474 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
13475 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
13476 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13477 ; GFX940-TGSPLIT-NEXT: s_endpgm
13479 ; GFX11-WGP-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13480 ; GFX11-WGP: ; %bb.0: ; %entry
13481 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13482 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
13483 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
13484 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
13485 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13486 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
13487 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
13488 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
13489 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13490 ; GFX11-WGP-NEXT: s_endpgm
13492 ; GFX11-CU-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13493 ; GFX11-CU: ; %bb.0: ; %entry
13494 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13495 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
13496 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
13497 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
13498 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13499 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
13500 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
13501 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
13502 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13503 ; GFX11-CU-NEXT: s_endpgm
13505 ; GFX12-WGP-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13506 ; GFX12-WGP: ; %bb.0: ; %entry
13507 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13508 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
13509 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
13510 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
13511 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
13512 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
13513 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
13514 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
13515 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13516 ; GFX12-WGP-NEXT: s_endpgm
13518 ; GFX12-CU-LABEL: local_singlethread_one_as_acq_rel_seq_cst_cmpxchg:
13519 ; GFX12-CU: ; %bb.0: ; %entry
13520 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13521 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
13522 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
13523 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
13524 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
13525 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
13526 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
13527 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
13528 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13529 ; GFX12-CU-NEXT: s_endpgm
13530 ptr addrspace(3) %out, i32 %in, i32 %old) {
13532 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
13533 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel seq_cst
13537 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_seq_cst_cmpxchg(
13538 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13539 ; GFX6: ; %bb.0: ; %entry
13540 ; GFX6-NEXT: s_mov_b64 s[8:9], s[6:7]
13541 ; GFX6-NEXT: s_load_dword s6, s[8:9], 0x0
13542 ; GFX6-NEXT: ; kill: def $sgpr4 killed $sgpr6
13543 ; GFX6-NEXT: s_load_dword s4, s[8:9], 0x1
13544 ; GFX6-NEXT: s_load_dword s5, s[8:9], 0x2
13545 ; GFX6-NEXT: s_mov_b32 m0, -1
13546 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13547 ; GFX6-NEXT: v_mov_b32_e32 v0, s6
13548 ; GFX6-NEXT: v_mov_b32_e32 v1, s5
13549 ; GFX6-NEXT: v_mov_b32_e32 v2, s4
13550 ; GFX6-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13551 ; GFX6-NEXT: s_endpgm
13553 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13554 ; GFX7: ; %bb.0: ; %entry
13555 ; GFX7-NEXT: s_mov_b64 s[8:9], s[6:7]
13556 ; GFX7-NEXT: s_load_dword s6, s[8:9], 0x0
13557 ; GFX7-NEXT: s_load_dword s4, s[8:9], 0x1
13558 ; GFX7-NEXT: s_load_dword s5, s[8:9], 0x2
13559 ; GFX7-NEXT: s_mov_b32 m0, -1
13560 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13561 ; GFX7-NEXT: v_mov_b32_e32 v0, s6
13562 ; GFX7-NEXT: v_mov_b32_e32 v1, s5
13563 ; GFX7-NEXT: v_mov_b32_e32 v2, s4
13564 ; GFX7-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13565 ; GFX7-NEXT: s_endpgm
13567 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13568 ; GFX10-WGP: ; %bb.0: ; %entry
13569 ; GFX10-WGP-NEXT: s_mov_b64 s[8:9], s[6:7]
13570 ; GFX10-WGP-NEXT: s_load_dword s6, s[8:9], 0x0
13571 ; GFX10-WGP-NEXT: s_load_dword s4, s[8:9], 0x4
13572 ; GFX10-WGP-NEXT: s_load_dword s5, s[8:9], 0x8
13573 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13574 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s6
13575 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s5
13576 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s4
13577 ; GFX10-WGP-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13578 ; GFX10-WGP-NEXT: s_endpgm
13580 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13581 ; GFX10-CU: ; %bb.0: ; %entry
13582 ; GFX10-CU-NEXT: s_mov_b64 s[8:9], s[6:7]
13583 ; GFX10-CU-NEXT: s_load_dword s6, s[8:9], 0x0
13584 ; GFX10-CU-NEXT: s_load_dword s4, s[8:9], 0x4
13585 ; GFX10-CU-NEXT: s_load_dword s5, s[8:9], 0x8
13586 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13587 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s6
13588 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s5
13589 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s4
13590 ; GFX10-CU-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13591 ; GFX10-CU-NEXT: s_endpgm
13593 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13594 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13595 ; SKIP-CACHE-INV-NEXT: s_mov_b64 s[4:5], s[2:3]
13596 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[4:5], 0x0
13597 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[4:5], 0x1
13598 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[4:5], 0x2
13599 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
13600 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13601 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s2
13602 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s1
13603 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s0
13604 ; SKIP-CACHE-INV-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13605 ; SKIP-CACHE-INV-NEXT: s_endpgm
13607 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13608 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13609 ; GFX90A-NOTTGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13610 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
13611 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
13612 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
13613 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13614 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s6
13615 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s5
13616 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s4
13617 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13618 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13620 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13621 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13622 ; GFX90A-TGSPLIT-NEXT: s_mov_b64 s[8:9], s[6:7]
13623 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[8:9], 0x0
13624 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[8:9], 0x4
13625 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[8:9], 0x8
13626 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13627 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s6
13628 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s5
13629 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s4
13630 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13631 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13633 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13634 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13635 ; GFX940-NOTTGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13636 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
13637 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
13638 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
13639 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13640 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s2
13641 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s1
13642 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s0
13643 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13644 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13646 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13647 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13648 ; GFX940-TGSPLIT-NEXT: s_mov_b64 s[4:5], s[2:3]
13649 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[4:5], 0x0
13650 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[4:5], 0x4
13651 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[4:5], 0x8
13652 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13653 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s2
13654 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s1
13655 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s0
13656 ; GFX940-TGSPLIT-NEXT: ds_cmpst_b32 v0, v1, v2 offset:16
13657 ; GFX940-TGSPLIT-NEXT: s_endpgm
13659 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13660 ; GFX11-WGP: ; %bb.0: ; %entry
13661 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13662 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
13663 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
13664 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
13665 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13666 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s2
13667 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s1
13668 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s0
13669 ; GFX11-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13670 ; GFX11-WGP-NEXT: s_endpgm
13672 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13673 ; GFX11-CU: ; %bb.0: ; %entry
13674 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13675 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
13676 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
13677 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
13678 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13679 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s2
13680 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s1
13681 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s0
13682 ; GFX11-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13683 ; GFX11-CU-NEXT: s_endpgm
13685 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13686 ; GFX12-WGP: ; %bb.0: ; %entry
13687 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13688 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x0
13689 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x4
13690 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x8
13691 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
13692 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s2
13693 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s1
13694 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s0
13695 ; GFX12-WGP-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13696 ; GFX12-WGP-NEXT: s_endpgm
13698 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_seq_cst_cmpxchg:
13699 ; GFX12-CU: ; %bb.0: ; %entry
13700 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13701 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x0
13702 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x4
13703 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x8
13704 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
13705 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s2
13706 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s1
13707 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s0
13708 ; GFX12-CU-NEXT: ds_cmpstore_b32 v0, v1, v2 offset:16
13709 ; GFX12-CU-NEXT: s_endpgm
13710 ptr addrspace(3) %out, i32 %in, i32 %old) {
13712 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
13713 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst seq_cst
13717 define amdgpu_kernel void @local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg(
13718 ; GFX6-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13719 ; GFX6: ; %bb.0: ; %entry
13720 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
13721 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
13722 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
13723 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
13724 ; GFX6-NEXT: s_mov_b32 m0, -1
13725 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13726 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
13727 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
13728 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
13729 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13730 ; GFX6-NEXT: s_mov_b32 m0, -1
13731 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
13732 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13733 ; GFX6-NEXT: ds_write_b32 v0, v1
13734 ; GFX6-NEXT: s_endpgm
13736 ; GFX7-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13737 ; GFX7: ; %bb.0: ; %entry
13738 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
13739 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
13740 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
13741 ; GFX7-NEXT: s_mov_b32 m0, -1
13742 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13743 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13744 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
13745 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
13746 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13747 ; GFX7-NEXT: s_mov_b32 m0, -1
13748 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13749 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13750 ; GFX7-NEXT: ds_write_b32 v0, v1
13751 ; GFX7-NEXT: s_endpgm
13753 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13754 ; GFX10-WGP: ; %bb.0: ; %entry
13755 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
13756 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
13757 ; GFX10-WGP-NEXT: s_nop 0
13758 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
13759 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13760 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13761 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
13762 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
13763 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13764 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13765 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13766 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
13767 ; GFX10-WGP-NEXT: s_endpgm
13769 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13770 ; GFX10-CU: ; %bb.0: ; %entry
13771 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
13772 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
13773 ; GFX10-CU-NEXT: s_nop 0
13774 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
13775 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13776 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13777 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
13778 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
13779 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13780 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13781 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13782 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
13783 ; GFX10-CU-NEXT: s_endpgm
13785 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13786 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
13787 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
13788 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
13789 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
13790 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
13791 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13792 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13793 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
13794 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
13795 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13796 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
13797 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
13798 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
13799 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
13800 ; SKIP-CACHE-INV-NEXT: s_endpgm
13802 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13803 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
13804 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
13805 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
13806 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
13807 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
13808 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13809 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
13810 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13811 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
13812 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13813 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
13814 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13815 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
13816 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
13818 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13819 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
13820 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
13821 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
13822 ; GFX90A-TGSPLIT-NEXT: s_nop 0
13823 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
13824 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13825 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
13826 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
13827 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
13828 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13829 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
13830 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13831 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
13832 ; GFX90A-TGSPLIT-NEXT: s_endpgm
13834 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13835 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
13836 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
13837 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
13838 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
13839 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
13840 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13841 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
13842 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13843 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
13844 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13845 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
13846 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13847 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
13848 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
13850 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13851 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
13852 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
13853 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
13854 ; GFX940-TGSPLIT-NEXT: s_nop 0
13855 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
13856 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13857 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
13858 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
13859 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
13860 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13861 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
13862 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
13863 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
13864 ; GFX940-TGSPLIT-NEXT: s_endpgm
13866 ; GFX11-WGP-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13867 ; GFX11-WGP: ; %bb.0: ; %entry
13868 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13869 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
13870 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
13871 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
13872 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13873 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
13874 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
13875 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
13876 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
13877 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
13878 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
13879 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
13880 ; GFX11-WGP-NEXT: s_endpgm
13882 ; GFX11-CU-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13883 ; GFX11-CU: ; %bb.0: ; %entry
13884 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13885 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
13886 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
13887 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
13888 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13889 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
13890 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
13891 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
13892 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
13893 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
13894 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
13895 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
13896 ; GFX11-CU-NEXT: s_endpgm
13898 ; GFX12-WGP-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13899 ; GFX12-WGP: ; %bb.0: ; %entry
13900 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
13901 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
13902 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
13903 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
13904 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
13905 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
13906 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
13907 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
13908 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
13909 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
13910 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
13911 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
13912 ; GFX12-WGP-NEXT: s_endpgm
13914 ; GFX12-CU-LABEL: local_singlethread_one_as_monotonic_monotonic_ret_cmpxchg:
13915 ; GFX12-CU: ; %bb.0: ; %entry
13916 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
13917 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
13918 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
13919 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
13920 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
13921 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
13922 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
13923 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
13924 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
13925 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
13926 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
13927 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
13928 ; GFX12-CU-NEXT: s_endpgm
13929 ptr addrspace(3) %out, i32 %in, i32 %old) {
13931 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
13932 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic monotonic
13933 %val0 = extractvalue { i32, i1 } %val, 0
13934 store i32 %val0, ptr addrspace(3) %out, align 4
13938 define amdgpu_kernel void @local_singlethread_one_as_acquire_monotonic_ret_cmpxchg(
13939 ; GFX6-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
13940 ; GFX6: ; %bb.0: ; %entry
13941 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
13942 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
13943 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
13944 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
13945 ; GFX6-NEXT: s_mov_b32 m0, -1
13946 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13947 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
13948 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
13949 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
13950 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13951 ; GFX6-NEXT: s_mov_b32 m0, -1
13952 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
13953 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
13954 ; GFX6-NEXT: ds_write_b32 v0, v1
13955 ; GFX6-NEXT: s_endpgm
13957 ; GFX7-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
13958 ; GFX7: ; %bb.0: ; %entry
13959 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
13960 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
13961 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
13962 ; GFX7-NEXT: s_mov_b32 m0, -1
13963 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13964 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13965 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
13966 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
13967 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13968 ; GFX7-NEXT: s_mov_b32 m0, -1
13969 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
13970 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
13971 ; GFX7-NEXT: ds_write_b32 v0, v1
13972 ; GFX7-NEXT: s_endpgm
13974 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
13975 ; GFX10-WGP: ; %bb.0: ; %entry
13976 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
13977 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
13978 ; GFX10-WGP-NEXT: s_nop 0
13979 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
13980 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13981 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13982 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
13983 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
13984 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
13985 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
13986 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
13987 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
13988 ; GFX10-WGP-NEXT: s_endpgm
13990 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
13991 ; GFX10-CU: ; %bb.0: ; %entry
13992 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
13993 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
13994 ; GFX10-CU-NEXT: s_nop 0
13995 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
13996 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
13997 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
13998 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
13999 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
14000 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14001 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14002 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14003 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
14004 ; GFX10-CU-NEXT: s_endpgm
14006 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
14007 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14008 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
14009 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
14010 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
14011 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14012 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14013 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14014 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
14015 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
14016 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14017 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14018 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14019 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14020 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
14021 ; SKIP-CACHE-INV-NEXT: s_endpgm
14023 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
14024 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14025 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14026 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14027 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
14028 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14029 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14030 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14031 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14032 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14033 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14034 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14035 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14036 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14037 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14039 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
14040 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14041 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14042 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14043 ; GFX90A-TGSPLIT-NEXT: s_nop 0
14044 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14045 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14046 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14047 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14048 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14049 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14050 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14051 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14052 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
14053 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14055 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
14056 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14057 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14058 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14059 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
14060 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14061 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14062 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14063 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14064 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14065 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14066 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14067 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14068 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14069 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14071 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
14072 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14073 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14074 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14075 ; GFX940-TGSPLIT-NEXT: s_nop 0
14076 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14077 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14078 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14079 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14080 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14081 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14082 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14083 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14084 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
14085 ; GFX940-TGSPLIT-NEXT: s_endpgm
14087 ; GFX11-WGP-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
14088 ; GFX11-WGP: ; %bb.0: ; %entry
14089 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14090 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
14091 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
14092 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
14093 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14094 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14095 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
14096 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
14097 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14098 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14099 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14100 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
14101 ; GFX11-WGP-NEXT: s_endpgm
14103 ; GFX11-CU-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
14104 ; GFX11-CU: ; %bb.0: ; %entry
14105 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14106 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
14107 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
14108 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
14109 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14110 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14111 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
14112 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
14113 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14114 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14115 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14116 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
14117 ; GFX11-CU-NEXT: s_endpgm
14119 ; GFX12-WGP-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
14120 ; GFX12-WGP: ; %bb.0: ; %entry
14121 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14122 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
14123 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
14124 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
14125 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
14126 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
14127 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
14128 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
14129 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14130 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
14131 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
14132 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
14133 ; GFX12-WGP-NEXT: s_endpgm
14135 ; GFX12-CU-LABEL: local_singlethread_one_as_acquire_monotonic_ret_cmpxchg:
14136 ; GFX12-CU: ; %bb.0: ; %entry
14137 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14138 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
14139 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
14140 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
14141 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
14142 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
14143 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
14144 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
14145 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14146 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
14147 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
14148 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
14149 ; GFX12-CU-NEXT: s_endpgm
14150 ptr addrspace(3) %out, i32 %in, i32 %old) {
14152 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
14153 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire monotonic
14154 %val0 = extractvalue { i32, i1 } %val, 0
14155 store i32 %val0, ptr addrspace(3) %out, align 4
14159 define amdgpu_kernel void @local_singlethread_one_as_release_monotonic_ret_cmpxchg(
14160 ; GFX6-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14161 ; GFX6: ; %bb.0: ; %entry
14162 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
14163 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
14164 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
14165 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
14166 ; GFX6-NEXT: s_mov_b32 m0, -1
14167 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14168 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
14169 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
14170 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
14171 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14172 ; GFX6-NEXT: s_mov_b32 m0, -1
14173 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
14174 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14175 ; GFX6-NEXT: ds_write_b32 v0, v1
14176 ; GFX6-NEXT: s_endpgm
14178 ; GFX7-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14179 ; GFX7: ; %bb.0: ; %entry
14180 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
14181 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
14182 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
14183 ; GFX7-NEXT: s_mov_b32 m0, -1
14184 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14185 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14186 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
14187 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
14188 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14189 ; GFX7-NEXT: s_mov_b32 m0, -1
14190 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14191 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14192 ; GFX7-NEXT: ds_write_b32 v0, v1
14193 ; GFX7-NEXT: s_endpgm
14195 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14196 ; GFX10-WGP: ; %bb.0: ; %entry
14197 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
14198 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
14199 ; GFX10-WGP-NEXT: s_nop 0
14200 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
14201 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14202 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14203 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
14204 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
14205 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14206 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14207 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14208 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
14209 ; GFX10-WGP-NEXT: s_endpgm
14211 ; GFX10-CU-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14212 ; GFX10-CU: ; %bb.0: ; %entry
14213 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
14214 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
14215 ; GFX10-CU-NEXT: s_nop 0
14216 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
14217 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14218 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14219 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
14220 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
14221 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14222 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14223 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14224 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
14225 ; GFX10-CU-NEXT: s_endpgm
14227 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14228 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14229 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
14230 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
14231 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
14232 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14233 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14234 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14235 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
14236 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
14237 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14238 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14239 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14240 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14241 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
14242 ; SKIP-CACHE-INV-NEXT: s_endpgm
14244 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14245 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14246 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14247 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14248 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
14249 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14250 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14251 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14252 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14253 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14254 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14255 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14256 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14257 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14258 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14260 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14261 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14262 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14263 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14264 ; GFX90A-TGSPLIT-NEXT: s_nop 0
14265 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14266 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14267 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14268 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14269 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14270 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14271 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14272 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14273 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
14274 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14276 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14277 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14278 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14279 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14280 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
14281 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14282 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14283 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14284 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14285 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14286 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14287 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14288 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14289 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14290 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14292 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14293 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14294 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14295 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14296 ; GFX940-TGSPLIT-NEXT: s_nop 0
14297 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14298 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14299 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14300 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14301 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14302 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14303 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14304 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14305 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
14306 ; GFX940-TGSPLIT-NEXT: s_endpgm
14308 ; GFX11-WGP-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14309 ; GFX11-WGP: ; %bb.0: ; %entry
14310 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14311 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
14312 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
14313 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
14314 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14315 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14316 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
14317 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
14318 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14319 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14320 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14321 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
14322 ; GFX11-WGP-NEXT: s_endpgm
14324 ; GFX11-CU-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14325 ; GFX11-CU: ; %bb.0: ; %entry
14326 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14327 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
14328 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
14329 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
14330 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14331 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14332 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
14333 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
14334 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14335 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14336 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14337 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
14338 ; GFX11-CU-NEXT: s_endpgm
14340 ; GFX12-WGP-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14341 ; GFX12-WGP: ; %bb.0: ; %entry
14342 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14343 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
14344 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
14345 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
14346 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
14347 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
14348 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
14349 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
14350 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14351 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
14352 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
14353 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
14354 ; GFX12-WGP-NEXT: s_endpgm
14356 ; GFX12-CU-LABEL: local_singlethread_one_as_release_monotonic_ret_cmpxchg:
14357 ; GFX12-CU: ; %bb.0: ; %entry
14358 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14359 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
14360 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
14361 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
14362 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
14363 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
14364 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
14365 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
14366 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14367 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
14368 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
14369 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
14370 ; GFX12-CU-NEXT: s_endpgm
14371 ptr addrspace(3) %out, i32 %in, i32 %old) {
14373 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
14374 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release monotonic
14375 %val0 = extractvalue { i32, i1 } %val, 0
14376 store i32 %val0, ptr addrspace(3) %out, align 4
14380 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg(
14381 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14382 ; GFX6: ; %bb.0: ; %entry
14383 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
14384 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
14385 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
14386 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
14387 ; GFX6-NEXT: s_mov_b32 m0, -1
14388 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14389 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
14390 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
14391 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
14392 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14393 ; GFX6-NEXT: s_mov_b32 m0, -1
14394 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
14395 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14396 ; GFX6-NEXT: ds_write_b32 v0, v1
14397 ; GFX6-NEXT: s_endpgm
14399 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14400 ; GFX7: ; %bb.0: ; %entry
14401 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
14402 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
14403 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
14404 ; GFX7-NEXT: s_mov_b32 m0, -1
14405 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14406 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14407 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
14408 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
14409 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14410 ; GFX7-NEXT: s_mov_b32 m0, -1
14411 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14412 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14413 ; GFX7-NEXT: ds_write_b32 v0, v1
14414 ; GFX7-NEXT: s_endpgm
14416 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14417 ; GFX10-WGP: ; %bb.0: ; %entry
14418 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
14419 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
14420 ; GFX10-WGP-NEXT: s_nop 0
14421 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
14422 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14423 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14424 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
14425 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
14426 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14427 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14428 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14429 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
14430 ; GFX10-WGP-NEXT: s_endpgm
14432 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14433 ; GFX10-CU: ; %bb.0: ; %entry
14434 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
14435 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
14436 ; GFX10-CU-NEXT: s_nop 0
14437 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
14438 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14439 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14440 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
14441 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
14442 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14443 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14444 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14445 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
14446 ; GFX10-CU-NEXT: s_endpgm
14448 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14449 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14450 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
14451 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
14452 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
14453 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14454 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14455 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14456 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
14457 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
14458 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14459 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14460 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14461 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14462 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
14463 ; SKIP-CACHE-INV-NEXT: s_endpgm
14465 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14466 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14467 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14468 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14469 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
14470 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14471 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14472 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14473 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14474 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14475 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14476 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14477 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14478 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14479 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14481 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14482 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14483 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14484 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14485 ; GFX90A-TGSPLIT-NEXT: s_nop 0
14486 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14487 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14488 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14489 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14490 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14491 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14492 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14493 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14494 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
14495 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14497 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14498 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14499 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14500 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14501 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
14502 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14503 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14504 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14505 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14506 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14507 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14508 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14509 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14510 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14511 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14513 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14514 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14515 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14516 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14517 ; GFX940-TGSPLIT-NEXT: s_nop 0
14518 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14519 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14520 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14521 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14522 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14523 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14524 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14525 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14526 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
14527 ; GFX940-TGSPLIT-NEXT: s_endpgm
14529 ; GFX11-WGP-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14530 ; GFX11-WGP: ; %bb.0: ; %entry
14531 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14532 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
14533 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
14534 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
14535 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14536 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14537 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
14538 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
14539 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14540 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14541 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14542 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
14543 ; GFX11-WGP-NEXT: s_endpgm
14545 ; GFX11-CU-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14546 ; GFX11-CU: ; %bb.0: ; %entry
14547 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14548 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
14549 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
14550 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
14551 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14552 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14553 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
14554 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
14555 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14556 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14557 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14558 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
14559 ; GFX11-CU-NEXT: s_endpgm
14561 ; GFX12-WGP-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14562 ; GFX12-WGP: ; %bb.0: ; %entry
14563 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14564 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
14565 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
14566 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
14567 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
14568 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
14569 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
14570 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
14571 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14572 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
14573 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
14574 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
14575 ; GFX12-WGP-NEXT: s_endpgm
14577 ; GFX12-CU-LABEL: local_singlethread_one_as_acq_rel_monotonic_ret_cmpxchg:
14578 ; GFX12-CU: ; %bb.0: ; %entry
14579 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14580 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
14581 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
14582 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
14583 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
14584 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
14585 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
14586 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
14587 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14588 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
14589 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
14590 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
14591 ; GFX12-CU-NEXT: s_endpgm
14592 ptr addrspace(3) %out, i32 %in, i32 %old) {
14594 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
14595 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel monotonic
14596 %val0 = extractvalue { i32, i1 } %val, 0
14597 store i32 %val0, ptr addrspace(3) %out, align 4
14601 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg(
14602 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14603 ; GFX6: ; %bb.0: ; %entry
14604 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
14605 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
14606 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
14607 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
14608 ; GFX6-NEXT: s_mov_b32 m0, -1
14609 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14610 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
14611 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
14612 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
14613 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14614 ; GFX6-NEXT: s_mov_b32 m0, -1
14615 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
14616 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14617 ; GFX6-NEXT: ds_write_b32 v0, v1
14618 ; GFX6-NEXT: s_endpgm
14620 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14621 ; GFX7: ; %bb.0: ; %entry
14622 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
14623 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
14624 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
14625 ; GFX7-NEXT: s_mov_b32 m0, -1
14626 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14627 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14628 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
14629 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
14630 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14631 ; GFX7-NEXT: s_mov_b32 m0, -1
14632 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14633 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14634 ; GFX7-NEXT: ds_write_b32 v0, v1
14635 ; GFX7-NEXT: s_endpgm
14637 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14638 ; GFX10-WGP: ; %bb.0: ; %entry
14639 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
14640 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
14641 ; GFX10-WGP-NEXT: s_nop 0
14642 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
14643 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14644 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14645 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
14646 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
14647 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14648 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14649 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14650 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
14651 ; GFX10-WGP-NEXT: s_endpgm
14653 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14654 ; GFX10-CU: ; %bb.0: ; %entry
14655 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
14656 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
14657 ; GFX10-CU-NEXT: s_nop 0
14658 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
14659 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14660 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14661 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
14662 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
14663 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14664 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14665 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14666 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
14667 ; GFX10-CU-NEXT: s_endpgm
14669 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14670 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14671 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
14672 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
14673 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
14674 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14675 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14676 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14677 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
14678 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
14679 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14680 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14681 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14682 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14683 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
14684 ; SKIP-CACHE-INV-NEXT: s_endpgm
14686 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14687 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14688 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14689 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14690 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
14691 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14692 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14693 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14694 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14695 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14696 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14697 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14698 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14699 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14700 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14702 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14703 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14704 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14705 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14706 ; GFX90A-TGSPLIT-NEXT: s_nop 0
14707 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14708 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14709 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14710 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14711 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14712 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14713 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14714 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14715 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
14716 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14718 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14719 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14720 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14721 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14722 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
14723 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14724 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14725 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14726 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14727 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14728 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14729 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14730 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14731 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14732 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14734 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14735 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14736 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14737 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14738 ; GFX940-TGSPLIT-NEXT: s_nop 0
14739 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14740 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14741 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14742 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14743 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14744 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14745 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14746 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14747 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
14748 ; GFX940-TGSPLIT-NEXT: s_endpgm
14750 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14751 ; GFX11-WGP: ; %bb.0: ; %entry
14752 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14753 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
14754 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
14755 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
14756 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14757 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14758 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
14759 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
14760 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14761 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14762 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14763 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
14764 ; GFX11-WGP-NEXT: s_endpgm
14766 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14767 ; GFX11-CU: ; %bb.0: ; %entry
14768 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14769 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
14770 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
14771 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
14772 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14773 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14774 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
14775 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
14776 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14777 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14778 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14779 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
14780 ; GFX11-CU-NEXT: s_endpgm
14782 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14783 ; GFX12-WGP: ; %bb.0: ; %entry
14784 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14785 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
14786 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
14787 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
14788 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
14789 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
14790 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
14791 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
14792 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14793 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
14794 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
14795 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
14796 ; GFX12-WGP-NEXT: s_endpgm
14798 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_monotonic_ret_cmpxchg:
14799 ; GFX12-CU: ; %bb.0: ; %entry
14800 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14801 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
14802 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
14803 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
14804 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
14805 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
14806 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
14807 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
14808 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14809 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
14810 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
14811 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
14812 ; GFX12-CU-NEXT: s_endpgm
14813 ptr addrspace(3) %out, i32 %in, i32 %old) {
14815 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
14816 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst monotonic
14817 %val0 = extractvalue { i32, i1 } %val, 0
14818 store i32 %val0, ptr addrspace(3) %out, align 4
14822 define amdgpu_kernel void @local_singlethread_one_as_monotonic_acquire_ret_cmpxchg(
14823 ; GFX6-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14824 ; GFX6: ; %bb.0: ; %entry
14825 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
14826 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
14827 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
14828 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
14829 ; GFX6-NEXT: s_mov_b32 m0, -1
14830 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14831 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
14832 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
14833 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
14834 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14835 ; GFX6-NEXT: s_mov_b32 m0, -1
14836 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
14837 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
14838 ; GFX6-NEXT: ds_write_b32 v0, v1
14839 ; GFX6-NEXT: s_endpgm
14841 ; GFX7-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14842 ; GFX7: ; %bb.0: ; %entry
14843 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
14844 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
14845 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
14846 ; GFX7-NEXT: s_mov_b32 m0, -1
14847 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14848 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14849 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
14850 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
14851 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14852 ; GFX7-NEXT: s_mov_b32 m0, -1
14853 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
14854 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
14855 ; GFX7-NEXT: ds_write_b32 v0, v1
14856 ; GFX7-NEXT: s_endpgm
14858 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14859 ; GFX10-WGP: ; %bb.0: ; %entry
14860 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
14861 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
14862 ; GFX10-WGP-NEXT: s_nop 0
14863 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
14864 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14865 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14866 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
14867 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
14868 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14869 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
14870 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
14871 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
14872 ; GFX10-WGP-NEXT: s_endpgm
14874 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14875 ; GFX10-CU: ; %bb.0: ; %entry
14876 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
14877 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
14878 ; GFX10-CU-NEXT: s_nop 0
14879 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
14880 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14881 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14882 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
14883 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
14884 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14885 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
14886 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
14887 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
14888 ; GFX10-CU-NEXT: s_endpgm
14890 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14891 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
14892 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
14893 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
14894 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
14895 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14896 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14897 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14898 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
14899 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
14900 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14901 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
14902 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
14903 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
14904 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
14905 ; SKIP-CACHE-INV-NEXT: s_endpgm
14907 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14908 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
14909 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14910 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14911 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
14912 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14913 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14914 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14915 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14916 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14917 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14918 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14919 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14920 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14921 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
14923 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14924 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
14925 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
14926 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
14927 ; GFX90A-TGSPLIT-NEXT: s_nop 0
14928 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
14929 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14930 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14931 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
14932 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
14933 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14934 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
14935 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14936 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
14937 ; GFX90A-TGSPLIT-NEXT: s_endpgm
14939 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14940 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
14941 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14942 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14943 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
14944 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14945 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14946 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14947 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14948 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14949 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14950 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14951 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14952 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
14953 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
14955 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14956 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
14957 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
14958 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
14959 ; GFX940-TGSPLIT-NEXT: s_nop 0
14960 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
14961 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14962 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14963 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
14964 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
14965 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
14966 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
14967 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
14968 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
14969 ; GFX940-TGSPLIT-NEXT: s_endpgm
14971 ; GFX11-WGP-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14972 ; GFX11-WGP: ; %bb.0: ; %entry
14973 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
14974 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
14975 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
14976 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
14977 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14978 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14979 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
14980 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
14981 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14982 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
14983 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
14984 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
14985 ; GFX11-WGP-NEXT: s_endpgm
14987 ; GFX11-CU-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
14988 ; GFX11-CU: ; %bb.0: ; %entry
14989 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
14990 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
14991 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
14992 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
14993 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
14994 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14995 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
14996 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
14997 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
14998 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
14999 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15000 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
15001 ; GFX11-CU-NEXT: s_endpgm
15003 ; GFX12-WGP-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
15004 ; GFX12-WGP: ; %bb.0: ; %entry
15005 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15006 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
15007 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
15008 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
15009 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
15010 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15011 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
15012 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
15013 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15014 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15015 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
15016 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
15017 ; GFX12-WGP-NEXT: s_endpgm
15019 ; GFX12-CU-LABEL: local_singlethread_one_as_monotonic_acquire_ret_cmpxchg:
15020 ; GFX12-CU: ; %bb.0: ; %entry
15021 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15022 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
15023 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
15024 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
15025 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
15026 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15027 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
15028 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
15029 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15030 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15031 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
15032 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
15033 ; GFX12-CU-NEXT: s_endpgm
15034 ptr addrspace(3) %out, i32 %in, i32 %old) {
15036 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
15037 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic acquire
15038 %val0 = extractvalue { i32, i1 } %val, 0
15039 store i32 %val0, ptr addrspace(3) %out, align 4
15043 define amdgpu_kernel void @local_singlethread_one_as_acquire_acquire_ret_cmpxchg(
15044 ; GFX6-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15045 ; GFX6: ; %bb.0: ; %entry
15046 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
15047 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
15048 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
15049 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
15050 ; GFX6-NEXT: s_mov_b32 m0, -1
15051 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15052 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15053 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
15054 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
15055 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15056 ; GFX6-NEXT: s_mov_b32 m0, -1
15057 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15058 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15059 ; GFX6-NEXT: ds_write_b32 v0, v1
15060 ; GFX6-NEXT: s_endpgm
15062 ; GFX7-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15063 ; GFX7: ; %bb.0: ; %entry
15064 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
15065 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
15066 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
15067 ; GFX7-NEXT: s_mov_b32 m0, -1
15068 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15069 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15070 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
15071 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
15072 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15073 ; GFX7-NEXT: s_mov_b32 m0, -1
15074 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15075 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15076 ; GFX7-NEXT: ds_write_b32 v0, v1
15077 ; GFX7-NEXT: s_endpgm
15079 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15080 ; GFX10-WGP: ; %bb.0: ; %entry
15081 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
15082 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
15083 ; GFX10-WGP-NEXT: s_nop 0
15084 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
15085 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15086 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15087 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
15088 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
15089 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15090 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15091 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15092 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
15093 ; GFX10-WGP-NEXT: s_endpgm
15095 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15096 ; GFX10-CU: ; %bb.0: ; %entry
15097 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
15098 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
15099 ; GFX10-CU-NEXT: s_nop 0
15100 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
15101 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15102 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15103 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
15104 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
15105 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15106 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15107 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15108 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
15109 ; GFX10-CU-NEXT: s_endpgm
15111 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15112 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
15113 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
15114 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
15115 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
15116 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
15117 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15118 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
15119 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
15120 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
15121 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15122 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
15123 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
15124 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15125 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
15126 ; SKIP-CACHE-INV-NEXT: s_endpgm
15128 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15129 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
15130 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
15131 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
15132 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
15133 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
15134 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15135 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15136 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15137 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
15138 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15139 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15140 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15141 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
15142 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
15144 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15145 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
15146 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
15147 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
15148 ; GFX90A-TGSPLIT-NEXT: s_nop 0
15149 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
15150 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15151 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15152 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15153 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
15154 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15155 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15156 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15157 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
15158 ; GFX90A-TGSPLIT-NEXT: s_endpgm
15160 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15161 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
15162 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
15163 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
15164 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
15165 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
15166 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15167 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15168 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15169 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
15170 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15171 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15172 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15173 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
15174 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
15176 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15177 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
15178 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
15179 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
15180 ; GFX940-TGSPLIT-NEXT: s_nop 0
15181 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
15182 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15183 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15184 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15185 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
15186 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15187 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15188 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15189 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
15190 ; GFX940-TGSPLIT-NEXT: s_endpgm
15192 ; GFX11-WGP-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15193 ; GFX11-WGP: ; %bb.0: ; %entry
15194 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15195 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
15196 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
15197 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
15198 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15199 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
15200 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
15201 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
15202 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15203 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
15204 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15205 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
15206 ; GFX11-WGP-NEXT: s_endpgm
15208 ; GFX11-CU-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15209 ; GFX11-CU: ; %bb.0: ; %entry
15210 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15211 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
15212 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
15213 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
15214 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15215 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
15216 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
15217 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
15218 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15219 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
15220 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15221 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
15222 ; GFX11-CU-NEXT: s_endpgm
15224 ; GFX12-WGP-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15225 ; GFX12-WGP: ; %bb.0: ; %entry
15226 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15227 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
15228 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
15229 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
15230 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
15231 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15232 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
15233 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
15234 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15235 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15236 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
15237 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
15238 ; GFX12-WGP-NEXT: s_endpgm
15240 ; GFX12-CU-LABEL: local_singlethread_one_as_acquire_acquire_ret_cmpxchg:
15241 ; GFX12-CU: ; %bb.0: ; %entry
15242 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15243 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
15244 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
15245 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
15246 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
15247 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15248 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
15249 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
15250 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15251 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15252 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
15253 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
15254 ; GFX12-CU-NEXT: s_endpgm
15255 ptr addrspace(3) %out, i32 %in, i32 %old) {
15257 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
15258 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire acquire
15259 %val0 = extractvalue { i32, i1 } %val, 0
15260 store i32 %val0, ptr addrspace(3) %out, align 4
15264 define amdgpu_kernel void @local_singlethread_one_as_release_acquire_ret_cmpxchg(
15265 ; GFX6-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15266 ; GFX6: ; %bb.0: ; %entry
15267 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
15268 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
15269 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
15270 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
15271 ; GFX6-NEXT: s_mov_b32 m0, -1
15272 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15273 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15274 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
15275 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
15276 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15277 ; GFX6-NEXT: s_mov_b32 m0, -1
15278 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15279 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15280 ; GFX6-NEXT: ds_write_b32 v0, v1
15281 ; GFX6-NEXT: s_endpgm
15283 ; GFX7-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15284 ; GFX7: ; %bb.0: ; %entry
15285 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
15286 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
15287 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
15288 ; GFX7-NEXT: s_mov_b32 m0, -1
15289 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15290 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15291 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
15292 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
15293 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15294 ; GFX7-NEXT: s_mov_b32 m0, -1
15295 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15296 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15297 ; GFX7-NEXT: ds_write_b32 v0, v1
15298 ; GFX7-NEXT: s_endpgm
15300 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15301 ; GFX10-WGP: ; %bb.0: ; %entry
15302 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
15303 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
15304 ; GFX10-WGP-NEXT: s_nop 0
15305 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
15306 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15307 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15308 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
15309 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
15310 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15311 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15312 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15313 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
15314 ; GFX10-WGP-NEXT: s_endpgm
15316 ; GFX10-CU-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15317 ; GFX10-CU: ; %bb.0: ; %entry
15318 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
15319 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
15320 ; GFX10-CU-NEXT: s_nop 0
15321 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
15322 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15323 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15324 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
15325 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
15326 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15327 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15328 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15329 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
15330 ; GFX10-CU-NEXT: s_endpgm
15332 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15333 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
15334 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
15335 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
15336 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
15337 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
15338 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15339 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
15340 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
15341 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
15342 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15343 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
15344 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
15345 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15346 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
15347 ; SKIP-CACHE-INV-NEXT: s_endpgm
15349 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15350 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
15351 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
15352 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
15353 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
15354 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
15355 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15356 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15357 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15358 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
15359 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15360 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15361 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15362 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
15363 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
15365 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15366 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
15367 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
15368 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
15369 ; GFX90A-TGSPLIT-NEXT: s_nop 0
15370 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
15371 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15372 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15373 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15374 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
15375 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15376 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15377 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15378 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
15379 ; GFX90A-TGSPLIT-NEXT: s_endpgm
15381 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15382 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
15383 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
15384 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
15385 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
15386 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
15387 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15388 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15389 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15390 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
15391 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15392 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15393 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15394 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
15395 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
15397 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15398 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
15399 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
15400 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
15401 ; GFX940-TGSPLIT-NEXT: s_nop 0
15402 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
15403 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15404 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15405 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15406 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
15407 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15408 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15409 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15410 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
15411 ; GFX940-TGSPLIT-NEXT: s_endpgm
15413 ; GFX11-WGP-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15414 ; GFX11-WGP: ; %bb.0: ; %entry
15415 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15416 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
15417 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
15418 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
15419 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15420 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
15421 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
15422 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
15423 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15424 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
15425 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15426 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
15427 ; GFX11-WGP-NEXT: s_endpgm
15429 ; GFX11-CU-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15430 ; GFX11-CU: ; %bb.0: ; %entry
15431 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15432 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
15433 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
15434 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
15435 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15436 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
15437 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
15438 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
15439 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15440 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
15441 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15442 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
15443 ; GFX11-CU-NEXT: s_endpgm
15445 ; GFX12-WGP-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15446 ; GFX12-WGP: ; %bb.0: ; %entry
15447 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15448 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
15449 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
15450 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
15451 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
15452 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15453 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
15454 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
15455 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15456 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15457 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
15458 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
15459 ; GFX12-WGP-NEXT: s_endpgm
15461 ; GFX12-CU-LABEL: local_singlethread_one_as_release_acquire_ret_cmpxchg:
15462 ; GFX12-CU: ; %bb.0: ; %entry
15463 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15464 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
15465 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
15466 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
15467 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
15468 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15469 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
15470 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
15471 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15472 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15473 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
15474 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
15475 ; GFX12-CU-NEXT: s_endpgm
15476 ptr addrspace(3) %out, i32 %in, i32 %old) {
15478 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
15479 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release acquire
15480 %val0 = extractvalue { i32, i1 } %val, 0
15481 store i32 %val0, ptr addrspace(3) %out, align 4
15485 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg(
15486 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15487 ; GFX6: ; %bb.0: ; %entry
15488 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
15489 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
15490 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
15491 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
15492 ; GFX6-NEXT: s_mov_b32 m0, -1
15493 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15494 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15495 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
15496 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
15497 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15498 ; GFX6-NEXT: s_mov_b32 m0, -1
15499 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15500 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15501 ; GFX6-NEXT: ds_write_b32 v0, v1
15502 ; GFX6-NEXT: s_endpgm
15504 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15505 ; GFX7: ; %bb.0: ; %entry
15506 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
15507 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
15508 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
15509 ; GFX7-NEXT: s_mov_b32 m0, -1
15510 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15511 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15512 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
15513 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
15514 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15515 ; GFX7-NEXT: s_mov_b32 m0, -1
15516 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15517 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15518 ; GFX7-NEXT: ds_write_b32 v0, v1
15519 ; GFX7-NEXT: s_endpgm
15521 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15522 ; GFX10-WGP: ; %bb.0: ; %entry
15523 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
15524 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
15525 ; GFX10-WGP-NEXT: s_nop 0
15526 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
15527 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15528 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15529 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
15530 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
15531 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15532 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15533 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15534 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
15535 ; GFX10-WGP-NEXT: s_endpgm
15537 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15538 ; GFX10-CU: ; %bb.0: ; %entry
15539 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
15540 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
15541 ; GFX10-CU-NEXT: s_nop 0
15542 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
15543 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15544 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15545 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
15546 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
15547 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15548 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15549 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15550 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
15551 ; GFX10-CU-NEXT: s_endpgm
15553 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15554 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
15555 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
15556 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
15557 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
15558 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
15559 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15560 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
15561 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
15562 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
15563 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15564 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
15565 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
15566 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15567 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
15568 ; SKIP-CACHE-INV-NEXT: s_endpgm
15570 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15571 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
15572 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
15573 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
15574 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
15575 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
15576 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15577 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15578 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15579 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
15580 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15581 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15582 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15583 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
15584 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
15586 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15587 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
15588 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
15589 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
15590 ; GFX90A-TGSPLIT-NEXT: s_nop 0
15591 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
15592 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15593 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15594 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15595 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
15596 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15597 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15598 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15599 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
15600 ; GFX90A-TGSPLIT-NEXT: s_endpgm
15602 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15603 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
15604 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
15605 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
15606 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
15607 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
15608 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15609 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15610 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15611 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
15612 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15613 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15614 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15615 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
15616 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
15618 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15619 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
15620 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
15621 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
15622 ; GFX940-TGSPLIT-NEXT: s_nop 0
15623 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
15624 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15625 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15626 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15627 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
15628 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15629 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15630 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15631 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
15632 ; GFX940-TGSPLIT-NEXT: s_endpgm
15634 ; GFX11-WGP-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15635 ; GFX11-WGP: ; %bb.0: ; %entry
15636 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15637 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
15638 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
15639 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
15640 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15641 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
15642 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
15643 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
15644 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15645 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
15646 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15647 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
15648 ; GFX11-WGP-NEXT: s_endpgm
15650 ; GFX11-CU-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15651 ; GFX11-CU: ; %bb.0: ; %entry
15652 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15653 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
15654 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
15655 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
15656 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15657 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
15658 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
15659 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
15660 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15661 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
15662 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15663 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
15664 ; GFX11-CU-NEXT: s_endpgm
15666 ; GFX12-WGP-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15667 ; GFX12-WGP: ; %bb.0: ; %entry
15668 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15669 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
15670 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
15671 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
15672 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
15673 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15674 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
15675 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
15676 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15677 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15678 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
15679 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
15680 ; GFX12-WGP-NEXT: s_endpgm
15682 ; GFX12-CU-LABEL: local_singlethread_one_as_acq_rel_acquire_ret_cmpxchg:
15683 ; GFX12-CU: ; %bb.0: ; %entry
15684 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15685 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
15686 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
15687 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
15688 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
15689 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15690 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
15691 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
15692 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15693 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15694 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
15695 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
15696 ; GFX12-CU-NEXT: s_endpgm
15697 ptr addrspace(3) %out, i32 %in, i32 %old) {
15699 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
15700 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel acquire
15701 %val0 = extractvalue { i32, i1 } %val, 0
15702 store i32 %val0, ptr addrspace(3) %out, align 4
15706 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg(
15707 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15708 ; GFX6: ; %bb.0: ; %entry
15709 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
15710 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
15711 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
15712 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
15713 ; GFX6-NEXT: s_mov_b32 m0, -1
15714 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15715 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15716 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
15717 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
15718 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15719 ; GFX6-NEXT: s_mov_b32 m0, -1
15720 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15721 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15722 ; GFX6-NEXT: ds_write_b32 v0, v1
15723 ; GFX6-NEXT: s_endpgm
15725 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15726 ; GFX7: ; %bb.0: ; %entry
15727 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
15728 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
15729 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
15730 ; GFX7-NEXT: s_mov_b32 m0, -1
15731 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15732 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15733 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
15734 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
15735 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15736 ; GFX7-NEXT: s_mov_b32 m0, -1
15737 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15738 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15739 ; GFX7-NEXT: ds_write_b32 v0, v1
15740 ; GFX7-NEXT: s_endpgm
15742 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15743 ; GFX10-WGP: ; %bb.0: ; %entry
15744 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
15745 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
15746 ; GFX10-WGP-NEXT: s_nop 0
15747 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
15748 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15749 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15750 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
15751 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
15752 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15753 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15754 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15755 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
15756 ; GFX10-WGP-NEXT: s_endpgm
15758 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15759 ; GFX10-CU: ; %bb.0: ; %entry
15760 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
15761 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
15762 ; GFX10-CU-NEXT: s_nop 0
15763 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
15764 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15765 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15766 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
15767 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
15768 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15769 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15770 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15771 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
15772 ; GFX10-CU-NEXT: s_endpgm
15774 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15775 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
15776 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
15777 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
15778 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
15779 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
15780 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15781 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
15782 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
15783 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
15784 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15785 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
15786 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
15787 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
15788 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
15789 ; SKIP-CACHE-INV-NEXT: s_endpgm
15791 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15792 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
15793 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
15794 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
15795 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
15796 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
15797 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15798 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15799 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15800 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
15801 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15802 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15803 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15804 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
15805 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
15807 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15808 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
15809 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
15810 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
15811 ; GFX90A-TGSPLIT-NEXT: s_nop 0
15812 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
15813 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15814 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15815 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
15816 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
15817 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15818 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
15819 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15820 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
15821 ; GFX90A-TGSPLIT-NEXT: s_endpgm
15823 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15824 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
15825 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
15826 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
15827 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
15828 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
15829 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15830 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15831 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15832 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
15833 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15834 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15835 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15836 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
15837 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
15839 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15840 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
15841 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
15842 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
15843 ; GFX940-TGSPLIT-NEXT: s_nop 0
15844 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
15845 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15846 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15847 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
15848 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
15849 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15850 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
15851 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
15852 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
15853 ; GFX940-TGSPLIT-NEXT: s_endpgm
15855 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15856 ; GFX11-WGP: ; %bb.0: ; %entry
15857 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15858 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
15859 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
15860 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
15861 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15862 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
15863 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
15864 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
15865 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15866 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
15867 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
15868 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
15869 ; GFX11-WGP-NEXT: s_endpgm
15871 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15872 ; GFX11-CU: ; %bb.0: ; %entry
15873 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15874 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
15875 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
15876 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
15877 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15878 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
15879 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
15880 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
15881 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15882 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
15883 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
15884 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
15885 ; GFX11-CU-NEXT: s_endpgm
15887 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15888 ; GFX12-WGP: ; %bb.0: ; %entry
15889 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
15890 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
15891 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
15892 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
15893 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
15894 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15895 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
15896 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
15897 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15898 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
15899 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
15900 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
15901 ; GFX12-WGP-NEXT: s_endpgm
15903 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_acquire_ret_cmpxchg:
15904 ; GFX12-CU: ; %bb.0: ; %entry
15905 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
15906 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
15907 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
15908 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
15909 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
15910 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15911 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
15912 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
15913 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
15914 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
15915 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
15916 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
15917 ; GFX12-CU-NEXT: s_endpgm
15918 ptr addrspace(3) %out, i32 %in, i32 %old) {
15920 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
15921 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst acquire
15922 %val0 = extractvalue { i32, i1 } %val, 0
15923 store i32 %val0, ptr addrspace(3) %out, align 4
15927 define amdgpu_kernel void @local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg(
15928 ; GFX6-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
15929 ; GFX6: ; %bb.0: ; %entry
15930 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
15931 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
15932 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
15933 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
15934 ; GFX6-NEXT: s_mov_b32 m0, -1
15935 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15936 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15937 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
15938 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
15939 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15940 ; GFX6-NEXT: s_mov_b32 m0, -1
15941 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
15942 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
15943 ; GFX6-NEXT: ds_write_b32 v0, v1
15944 ; GFX6-NEXT: s_endpgm
15946 ; GFX7-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
15947 ; GFX7: ; %bb.0: ; %entry
15948 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
15949 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
15950 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
15951 ; GFX7-NEXT: s_mov_b32 m0, -1
15952 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15953 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15954 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
15955 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
15956 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15957 ; GFX7-NEXT: s_mov_b32 m0, -1
15958 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
15959 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
15960 ; GFX7-NEXT: ds_write_b32 v0, v1
15961 ; GFX7-NEXT: s_endpgm
15963 ; GFX10-WGP-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
15964 ; GFX10-WGP: ; %bb.0: ; %entry
15965 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
15966 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
15967 ; GFX10-WGP-NEXT: s_nop 0
15968 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
15969 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15970 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15971 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
15972 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
15973 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15974 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
15975 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
15976 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
15977 ; GFX10-WGP-NEXT: s_endpgm
15979 ; GFX10-CU-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
15980 ; GFX10-CU: ; %bb.0: ; %entry
15981 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
15982 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
15983 ; GFX10-CU-NEXT: s_nop 0
15984 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
15985 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15986 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15987 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
15988 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
15989 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
15990 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
15991 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
15992 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
15993 ; GFX10-CU-NEXT: s_endpgm
15995 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
15996 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
15997 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
15998 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
15999 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
16000 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16001 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16002 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16003 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
16004 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
16005 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16006 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16007 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16008 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16009 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
16010 ; SKIP-CACHE-INV-NEXT: s_endpgm
16012 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
16013 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
16014 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16015 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16016 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
16017 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16018 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16019 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16020 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16021 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16022 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16023 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16024 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16025 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16026 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
16028 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
16029 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
16030 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16031 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16032 ; GFX90A-TGSPLIT-NEXT: s_nop 0
16033 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16034 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16035 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16036 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16037 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16038 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16039 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16040 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16041 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
16042 ; GFX90A-TGSPLIT-NEXT: s_endpgm
16044 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
16045 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
16046 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16047 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16048 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
16049 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16050 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16051 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16052 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16053 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16054 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16055 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16056 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16057 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16058 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
16060 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
16061 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
16062 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16063 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16064 ; GFX940-TGSPLIT-NEXT: s_nop 0
16065 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16066 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16067 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16068 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16069 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16070 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16071 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16072 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16073 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
16074 ; GFX940-TGSPLIT-NEXT: s_endpgm
16076 ; GFX11-WGP-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
16077 ; GFX11-WGP: ; %bb.0: ; %entry
16078 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16079 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16080 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16081 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16082 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16083 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16084 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
16085 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
16086 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16087 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16088 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16089 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
16090 ; GFX11-WGP-NEXT: s_endpgm
16092 ; GFX11-CU-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
16093 ; GFX11-CU: ; %bb.0: ; %entry
16094 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16095 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
16096 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
16097 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
16098 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16099 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16100 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
16101 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
16102 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16103 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16104 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16105 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
16106 ; GFX11-CU-NEXT: s_endpgm
16108 ; GFX12-WGP-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
16109 ; GFX12-WGP: ; %bb.0: ; %entry
16110 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16111 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16112 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16113 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16114 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
16115 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
16116 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
16117 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
16118 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16119 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
16120 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
16121 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
16122 ; GFX12-WGP-NEXT: s_endpgm
16124 ; GFX12-CU-LABEL: local_singlethread_one_as_monotonic_seq_cst_ret_cmpxchg:
16125 ; GFX12-CU: ; %bb.0: ; %entry
16126 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16127 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
16128 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
16129 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
16130 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
16131 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
16132 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
16133 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
16134 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16135 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
16136 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
16137 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
16138 ; GFX12-CU-NEXT: s_endpgm
16139 ptr addrspace(3) %out, i32 %in, i32 %old) {
16141 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
16142 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") monotonic seq_cst
16143 %val0 = extractvalue { i32, i1 } %val, 0
16144 store i32 %val0, ptr addrspace(3) %out, align 4
16148 define amdgpu_kernel void @local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg(
16149 ; GFX6-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16150 ; GFX6: ; %bb.0: ; %entry
16151 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
16152 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
16153 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
16154 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
16155 ; GFX6-NEXT: s_mov_b32 m0, -1
16156 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16157 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
16158 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
16159 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
16160 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16161 ; GFX6-NEXT: s_mov_b32 m0, -1
16162 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
16163 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16164 ; GFX6-NEXT: ds_write_b32 v0, v1
16165 ; GFX6-NEXT: s_endpgm
16167 ; GFX7-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16168 ; GFX7: ; %bb.0: ; %entry
16169 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
16170 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
16171 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
16172 ; GFX7-NEXT: s_mov_b32 m0, -1
16173 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16174 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16175 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
16176 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
16177 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16178 ; GFX7-NEXT: s_mov_b32 m0, -1
16179 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16180 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16181 ; GFX7-NEXT: ds_write_b32 v0, v1
16182 ; GFX7-NEXT: s_endpgm
16184 ; GFX10-WGP-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16185 ; GFX10-WGP: ; %bb.0: ; %entry
16186 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
16187 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
16188 ; GFX10-WGP-NEXT: s_nop 0
16189 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
16190 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16191 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
16192 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
16193 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
16194 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16195 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
16196 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16197 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
16198 ; GFX10-WGP-NEXT: s_endpgm
16200 ; GFX10-CU-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16201 ; GFX10-CU: ; %bb.0: ; %entry
16202 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
16203 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
16204 ; GFX10-CU-NEXT: s_nop 0
16205 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
16206 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16207 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
16208 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
16209 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
16210 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16211 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
16212 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16213 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
16214 ; GFX10-CU-NEXT: s_endpgm
16216 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16217 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
16218 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
16219 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
16220 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
16221 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16222 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16223 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16224 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
16225 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
16226 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16227 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16228 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16229 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16230 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
16231 ; SKIP-CACHE-INV-NEXT: s_endpgm
16233 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16234 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
16235 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16236 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16237 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
16238 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16239 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16240 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16241 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16242 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16243 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16244 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16245 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16246 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16247 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
16249 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16250 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
16251 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16252 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16253 ; GFX90A-TGSPLIT-NEXT: s_nop 0
16254 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16255 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16256 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16257 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16258 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16259 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16260 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16261 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16262 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
16263 ; GFX90A-TGSPLIT-NEXT: s_endpgm
16265 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16266 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
16267 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16268 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16269 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
16270 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16271 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16272 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16273 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16274 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16275 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16276 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16277 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16278 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16279 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
16281 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16282 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
16283 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16284 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16285 ; GFX940-TGSPLIT-NEXT: s_nop 0
16286 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16287 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16288 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16289 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16290 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16291 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16292 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16293 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16294 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
16295 ; GFX940-TGSPLIT-NEXT: s_endpgm
16297 ; GFX11-WGP-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16298 ; GFX11-WGP: ; %bb.0: ; %entry
16299 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16300 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16301 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16302 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16303 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16304 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16305 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
16306 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
16307 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16308 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16309 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16310 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
16311 ; GFX11-WGP-NEXT: s_endpgm
16313 ; GFX11-CU-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16314 ; GFX11-CU: ; %bb.0: ; %entry
16315 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16316 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
16317 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
16318 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
16319 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16320 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16321 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
16322 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
16323 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16324 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16325 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16326 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
16327 ; GFX11-CU-NEXT: s_endpgm
16329 ; GFX12-WGP-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16330 ; GFX12-WGP: ; %bb.0: ; %entry
16331 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16332 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16333 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16334 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16335 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
16336 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
16337 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
16338 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
16339 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16340 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
16341 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
16342 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
16343 ; GFX12-WGP-NEXT: s_endpgm
16345 ; GFX12-CU-LABEL: local_singlethread_one_as_acquire_seq_cst_ret_cmpxchg:
16346 ; GFX12-CU: ; %bb.0: ; %entry
16347 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16348 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
16349 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
16350 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
16351 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
16352 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
16353 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
16354 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
16355 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16356 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
16357 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
16358 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
16359 ; GFX12-CU-NEXT: s_endpgm
16360 ptr addrspace(3) %out, i32 %in, i32 %old) {
16362 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
16363 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acquire seq_cst
16364 %val0 = extractvalue { i32, i1 } %val, 0
16365 store i32 %val0, ptr addrspace(3) %out, align 4
16369 define amdgpu_kernel void @local_singlethread_one_as_release_seq_cst_ret_cmpxchg(
16370 ; GFX6-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16371 ; GFX6: ; %bb.0: ; %entry
16372 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
16373 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
16374 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
16375 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
16376 ; GFX6-NEXT: s_mov_b32 m0, -1
16377 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16378 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
16379 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
16380 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
16381 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16382 ; GFX6-NEXT: s_mov_b32 m0, -1
16383 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
16384 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16385 ; GFX6-NEXT: ds_write_b32 v0, v1
16386 ; GFX6-NEXT: s_endpgm
16388 ; GFX7-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16389 ; GFX7: ; %bb.0: ; %entry
16390 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
16391 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
16392 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
16393 ; GFX7-NEXT: s_mov_b32 m0, -1
16394 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16395 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16396 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
16397 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
16398 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16399 ; GFX7-NEXT: s_mov_b32 m0, -1
16400 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16401 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16402 ; GFX7-NEXT: ds_write_b32 v0, v1
16403 ; GFX7-NEXT: s_endpgm
16405 ; GFX10-WGP-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16406 ; GFX10-WGP: ; %bb.0: ; %entry
16407 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
16408 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
16409 ; GFX10-WGP-NEXT: s_nop 0
16410 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
16411 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16412 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
16413 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
16414 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
16415 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16416 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
16417 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16418 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
16419 ; GFX10-WGP-NEXT: s_endpgm
16421 ; GFX10-CU-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16422 ; GFX10-CU: ; %bb.0: ; %entry
16423 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
16424 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
16425 ; GFX10-CU-NEXT: s_nop 0
16426 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
16427 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16428 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
16429 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
16430 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
16431 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16432 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
16433 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16434 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
16435 ; GFX10-CU-NEXT: s_endpgm
16437 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16438 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
16439 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
16440 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
16441 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
16442 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16443 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16444 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16445 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
16446 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
16447 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16448 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16449 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16450 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16451 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
16452 ; SKIP-CACHE-INV-NEXT: s_endpgm
16454 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16455 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
16456 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16457 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16458 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
16459 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16460 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16461 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16462 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16463 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16464 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16465 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16466 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16467 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16468 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
16470 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16471 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
16472 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16473 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16474 ; GFX90A-TGSPLIT-NEXT: s_nop 0
16475 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16476 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16477 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16478 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16479 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16480 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16481 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16482 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16483 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
16484 ; GFX90A-TGSPLIT-NEXT: s_endpgm
16486 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16487 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
16488 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16489 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16490 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
16491 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16492 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16493 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16494 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16495 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16496 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16497 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16498 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16499 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16500 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
16502 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16503 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
16504 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16505 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16506 ; GFX940-TGSPLIT-NEXT: s_nop 0
16507 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16508 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16509 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16510 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16511 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16512 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16513 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16514 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16515 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
16516 ; GFX940-TGSPLIT-NEXT: s_endpgm
16518 ; GFX11-WGP-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16519 ; GFX11-WGP: ; %bb.0: ; %entry
16520 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16521 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16522 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16523 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16524 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16525 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16526 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
16527 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
16528 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16529 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16530 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16531 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
16532 ; GFX11-WGP-NEXT: s_endpgm
16534 ; GFX11-CU-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16535 ; GFX11-CU: ; %bb.0: ; %entry
16536 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16537 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
16538 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
16539 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
16540 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16541 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16542 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
16543 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
16544 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16545 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16546 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16547 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
16548 ; GFX11-CU-NEXT: s_endpgm
16550 ; GFX12-WGP-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16551 ; GFX12-WGP: ; %bb.0: ; %entry
16552 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16553 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16554 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16555 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16556 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
16557 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
16558 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
16559 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
16560 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16561 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
16562 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
16563 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
16564 ; GFX12-WGP-NEXT: s_endpgm
16566 ; GFX12-CU-LABEL: local_singlethread_one_as_release_seq_cst_ret_cmpxchg:
16567 ; GFX12-CU: ; %bb.0: ; %entry
16568 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16569 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
16570 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
16571 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
16572 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
16573 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
16574 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
16575 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
16576 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16577 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
16578 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
16579 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
16580 ; GFX12-CU-NEXT: s_endpgm
16581 ptr addrspace(3) %out, i32 %in, i32 %old) {
16583 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
16584 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") release seq_cst
16585 %val0 = extractvalue { i32, i1 } %val, 0
16586 store i32 %val0, ptr addrspace(3) %out, align 4
16590 define amdgpu_kernel void @local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg(
16591 ; GFX6-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16592 ; GFX6: ; %bb.0: ; %entry
16593 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
16594 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
16595 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
16596 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
16597 ; GFX6-NEXT: s_mov_b32 m0, -1
16598 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16599 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
16600 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
16601 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
16602 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16603 ; GFX6-NEXT: s_mov_b32 m0, -1
16604 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
16605 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16606 ; GFX6-NEXT: ds_write_b32 v0, v1
16607 ; GFX6-NEXT: s_endpgm
16609 ; GFX7-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16610 ; GFX7: ; %bb.0: ; %entry
16611 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
16612 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
16613 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
16614 ; GFX7-NEXT: s_mov_b32 m0, -1
16615 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16616 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16617 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
16618 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
16619 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16620 ; GFX7-NEXT: s_mov_b32 m0, -1
16621 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16622 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16623 ; GFX7-NEXT: ds_write_b32 v0, v1
16624 ; GFX7-NEXT: s_endpgm
16626 ; GFX10-WGP-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16627 ; GFX10-WGP: ; %bb.0: ; %entry
16628 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
16629 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
16630 ; GFX10-WGP-NEXT: s_nop 0
16631 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
16632 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16633 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
16634 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
16635 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
16636 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16637 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
16638 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16639 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
16640 ; GFX10-WGP-NEXT: s_endpgm
16642 ; GFX10-CU-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16643 ; GFX10-CU: ; %bb.0: ; %entry
16644 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
16645 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
16646 ; GFX10-CU-NEXT: s_nop 0
16647 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
16648 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16649 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
16650 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
16651 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
16652 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16653 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
16654 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16655 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
16656 ; GFX10-CU-NEXT: s_endpgm
16658 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16659 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
16660 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
16661 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
16662 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
16663 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16664 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16665 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16666 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
16667 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
16668 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16669 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16670 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16671 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16672 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
16673 ; SKIP-CACHE-INV-NEXT: s_endpgm
16675 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16676 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
16677 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16678 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16679 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
16680 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16681 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16682 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16683 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16684 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16685 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16686 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16687 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16688 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16689 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
16691 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16692 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
16693 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16694 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16695 ; GFX90A-TGSPLIT-NEXT: s_nop 0
16696 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16697 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16698 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16699 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16700 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16701 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16702 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16703 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16704 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
16705 ; GFX90A-TGSPLIT-NEXT: s_endpgm
16707 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16708 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
16709 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16710 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16711 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
16712 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16713 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16714 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16715 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16716 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16717 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16718 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16719 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16720 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16721 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
16723 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16724 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
16725 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16726 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16727 ; GFX940-TGSPLIT-NEXT: s_nop 0
16728 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16729 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16730 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16731 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16732 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16733 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16734 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16735 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16736 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
16737 ; GFX940-TGSPLIT-NEXT: s_endpgm
16739 ; GFX11-WGP-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16740 ; GFX11-WGP: ; %bb.0: ; %entry
16741 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16742 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16743 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16744 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16745 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16746 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16747 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
16748 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
16749 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16750 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16751 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16752 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
16753 ; GFX11-WGP-NEXT: s_endpgm
16755 ; GFX11-CU-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16756 ; GFX11-CU: ; %bb.0: ; %entry
16757 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16758 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
16759 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
16760 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
16761 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16762 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16763 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
16764 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
16765 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16766 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16767 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16768 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
16769 ; GFX11-CU-NEXT: s_endpgm
16771 ; GFX12-WGP-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16772 ; GFX12-WGP: ; %bb.0: ; %entry
16773 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16774 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16775 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16776 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16777 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
16778 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
16779 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
16780 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
16781 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16782 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
16783 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
16784 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
16785 ; GFX12-WGP-NEXT: s_endpgm
16787 ; GFX12-CU-LABEL: local_singlethread_one_as_acq_rel_seq_cst_ret_cmpxchg:
16788 ; GFX12-CU: ; %bb.0: ; %entry
16789 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16790 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
16791 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
16792 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
16793 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
16794 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
16795 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
16796 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
16797 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16798 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
16799 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
16800 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
16801 ; GFX12-CU-NEXT: s_endpgm
16802 ptr addrspace(3) %out, i32 %in, i32 %old) {
16804 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
16805 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") acq_rel seq_cst
16806 %val0 = extractvalue { i32, i1 } %val, 0
16807 store i32 %val0, ptr addrspace(3) %out, align 4
16811 define amdgpu_kernel void @local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg(
16812 ; GFX6-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16813 ; GFX6: ; %bb.0: ; %entry
16814 ; GFX6-NEXT: s_load_dword s4, s[6:7], 0x0
16815 ; GFX6-NEXT: ; kill: def $sgpr5 killed $sgpr4
16816 ; GFX6-NEXT: s_load_dword s5, s[6:7], 0x1
16817 ; GFX6-NEXT: s_load_dword s6, s[6:7], 0x2
16818 ; GFX6-NEXT: s_mov_b32 m0, -1
16819 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16820 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
16821 ; GFX6-NEXT: v_mov_b32_e32 v1, s6
16822 ; GFX6-NEXT: v_mov_b32_e32 v2, s5
16823 ; GFX6-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16824 ; GFX6-NEXT: s_mov_b32 m0, -1
16825 ; GFX6-NEXT: v_mov_b32_e32 v0, s4
16826 ; GFX6-NEXT: s_waitcnt lgkmcnt(0)
16827 ; GFX6-NEXT: ds_write_b32 v0, v1
16828 ; GFX6-NEXT: s_endpgm
16830 ; GFX7-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16831 ; GFX7: ; %bb.0: ; %entry
16832 ; GFX7-NEXT: s_load_dword s4, s[6:7], 0x0
16833 ; GFX7-NEXT: s_load_dword s5, s[6:7], 0x1
16834 ; GFX7-NEXT: s_load_dword s6, s[6:7], 0x2
16835 ; GFX7-NEXT: s_mov_b32 m0, -1
16836 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16837 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16838 ; GFX7-NEXT: v_mov_b32_e32 v1, s6
16839 ; GFX7-NEXT: v_mov_b32_e32 v2, s5
16840 ; GFX7-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16841 ; GFX7-NEXT: s_mov_b32 m0, -1
16842 ; GFX7-NEXT: v_mov_b32_e32 v0, s4
16843 ; GFX7-NEXT: s_waitcnt lgkmcnt(0)
16844 ; GFX7-NEXT: ds_write_b32 v0, v1
16845 ; GFX7-NEXT: s_endpgm
16847 ; GFX10-WGP-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16848 ; GFX10-WGP: ; %bb.0: ; %entry
16849 ; GFX10-WGP-NEXT: s_load_dword s4, s[6:7], 0x0
16850 ; GFX10-WGP-NEXT: s_load_dword s5, s[6:7], 0x4
16851 ; GFX10-WGP-NEXT: s_nop 0
16852 ; GFX10-WGP-NEXT: s_load_dword s6, s[6:7], 0x8
16853 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16854 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
16855 ; GFX10-WGP-NEXT: v_mov_b32_e32 v1, s6
16856 ; GFX10-WGP-NEXT: v_mov_b32_e32 v2, s5
16857 ; GFX10-WGP-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16858 ; GFX10-WGP-NEXT: v_mov_b32_e32 v0, s4
16859 ; GFX10-WGP-NEXT: s_waitcnt lgkmcnt(0)
16860 ; GFX10-WGP-NEXT: ds_write_b32 v0, v1
16861 ; GFX10-WGP-NEXT: s_endpgm
16863 ; GFX10-CU-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16864 ; GFX10-CU: ; %bb.0: ; %entry
16865 ; GFX10-CU-NEXT: s_load_dword s4, s[6:7], 0x0
16866 ; GFX10-CU-NEXT: s_load_dword s5, s[6:7], 0x4
16867 ; GFX10-CU-NEXT: s_nop 0
16868 ; GFX10-CU-NEXT: s_load_dword s6, s[6:7], 0x8
16869 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16870 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
16871 ; GFX10-CU-NEXT: v_mov_b32_e32 v1, s6
16872 ; GFX10-CU-NEXT: v_mov_b32_e32 v2, s5
16873 ; GFX10-CU-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16874 ; GFX10-CU-NEXT: v_mov_b32_e32 v0, s4
16875 ; GFX10-CU-NEXT: s_waitcnt lgkmcnt(0)
16876 ; GFX10-CU-NEXT: ds_write_b32 v0, v1
16877 ; GFX10-CU-NEXT: s_endpgm
16879 ; SKIP-CACHE-INV-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16880 ; SKIP-CACHE-INV: ; %bb.0: ; %entry
16881 ; SKIP-CACHE-INV-NEXT: s_load_dword s0, s[2:3], 0x0
16882 ; SKIP-CACHE-INV-NEXT: s_load_dword s1, s[2:3], 0x1
16883 ; SKIP-CACHE-INV-NEXT: s_load_dword s2, s[2:3], 0x2
16884 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16885 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16886 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16887 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v1, s2
16888 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v2, s1
16889 ; SKIP-CACHE-INV-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16890 ; SKIP-CACHE-INV-NEXT: s_mov_b32 m0, -1
16891 ; SKIP-CACHE-INV-NEXT: v_mov_b32_e32 v0, s0
16892 ; SKIP-CACHE-INV-NEXT: s_waitcnt lgkmcnt(0)
16893 ; SKIP-CACHE-INV-NEXT: ds_write_b32 v0, v1
16894 ; SKIP-CACHE-INV-NEXT: s_endpgm
16896 ; GFX90A-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16897 ; GFX90A-NOTTGSPLIT: ; %bb.0: ; %entry
16898 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16899 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16900 ; GFX90A-NOTTGSPLIT-NEXT: s_nop 0
16901 ; GFX90A-NOTTGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16902 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16903 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16904 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16905 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16906 ; GFX90A-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16907 ; GFX90A-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16908 ; GFX90A-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16909 ; GFX90A-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16910 ; GFX90A-NOTTGSPLIT-NEXT: s_endpgm
16912 ; GFX90A-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16913 ; GFX90A-TGSPLIT: ; %bb.0: ; %entry
16914 ; GFX90A-TGSPLIT-NEXT: s_load_dword s4, s[6:7], 0x0
16915 ; GFX90A-TGSPLIT-NEXT: s_load_dword s5, s[6:7], 0x4
16916 ; GFX90A-TGSPLIT-NEXT: s_nop 0
16917 ; GFX90A-TGSPLIT-NEXT: s_load_dword s6, s[6:7], 0x8
16918 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16919 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16920 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v1, s6
16921 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v2, s5
16922 ; GFX90A-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16923 ; GFX90A-TGSPLIT-NEXT: v_mov_b32_e32 v0, s4
16924 ; GFX90A-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16925 ; GFX90A-TGSPLIT-NEXT: ds_write_b32 v0, v1
16926 ; GFX90A-TGSPLIT-NEXT: s_endpgm
16928 ; GFX940-NOTTGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16929 ; GFX940-NOTTGSPLIT: ; %bb.0: ; %entry
16930 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16931 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16932 ; GFX940-NOTTGSPLIT-NEXT: s_nop 0
16933 ; GFX940-NOTTGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16934 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16935 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16936 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16937 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16938 ; GFX940-NOTTGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16939 ; GFX940-NOTTGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16940 ; GFX940-NOTTGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16941 ; GFX940-NOTTGSPLIT-NEXT: ds_write_b32 v0, v1
16942 ; GFX940-NOTTGSPLIT-NEXT: s_endpgm
16944 ; GFX940-TGSPLIT-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16945 ; GFX940-TGSPLIT: ; %bb.0: ; %entry
16946 ; GFX940-TGSPLIT-NEXT: s_load_dword s0, s[2:3], 0x0
16947 ; GFX940-TGSPLIT-NEXT: s_load_dword s1, s[2:3], 0x4
16948 ; GFX940-TGSPLIT-NEXT: s_nop 0
16949 ; GFX940-TGSPLIT-NEXT: s_load_dword s2, s[2:3], 0x8
16950 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16951 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16952 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v1, s2
16953 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v2, s1
16954 ; GFX940-TGSPLIT-NEXT: ds_cmpst_rtn_b32 v1, v0, v1, v2 offset:16
16955 ; GFX940-TGSPLIT-NEXT: v_mov_b32_e32 v0, s0
16956 ; GFX940-TGSPLIT-NEXT: s_waitcnt lgkmcnt(0)
16957 ; GFX940-TGSPLIT-NEXT: ds_write_b32 v0, v1
16958 ; GFX940-TGSPLIT-NEXT: s_endpgm
16960 ; GFX11-WGP-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16961 ; GFX11-WGP: ; %bb.0: ; %entry
16962 ; GFX11-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16963 ; GFX11-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16964 ; GFX11-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16965 ; GFX11-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16966 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16967 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16968 ; GFX11-WGP-NEXT: v_mov_b32_e32 v1, s2
16969 ; GFX11-WGP-NEXT: v_mov_b32_e32 v2, s1
16970 ; GFX11-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16971 ; GFX11-WGP-NEXT: v_mov_b32_e32 v0, s0
16972 ; GFX11-WGP-NEXT: s_waitcnt lgkmcnt(0)
16973 ; GFX11-WGP-NEXT: ds_store_b32 v0, v1
16974 ; GFX11-WGP-NEXT: s_endpgm
16976 ; GFX11-CU-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16977 ; GFX11-CU: ; %bb.0: ; %entry
16978 ; GFX11-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
16979 ; GFX11-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
16980 ; GFX11-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
16981 ; GFX11-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
16982 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16983 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16984 ; GFX11-CU-NEXT: v_mov_b32_e32 v1, s2
16985 ; GFX11-CU-NEXT: v_mov_b32_e32 v2, s1
16986 ; GFX11-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
16987 ; GFX11-CU-NEXT: v_mov_b32_e32 v0, s0
16988 ; GFX11-CU-NEXT: s_waitcnt lgkmcnt(0)
16989 ; GFX11-CU-NEXT: ds_store_b32 v0, v1
16990 ; GFX11-CU-NEXT: s_endpgm
16992 ; GFX12-WGP-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
16993 ; GFX12-WGP: ; %bb.0: ; %entry
16994 ; GFX12-WGP-NEXT: s_mov_b64 s[4:5], s[2:3]
16995 ; GFX12-WGP-NEXT: s_load_b32 s0, s[4:5], 0x0
16996 ; GFX12-WGP-NEXT: s_load_b32 s2, s[4:5], 0x4
16997 ; GFX12-WGP-NEXT: s_load_b32 s1, s[4:5], 0x8
16998 ; GFX12-WGP-NEXT: s_wait_kmcnt 0x0
16999 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
17000 ; GFX12-WGP-NEXT: v_mov_b32_e32 v1, s2
17001 ; GFX12-WGP-NEXT: v_mov_b32_e32 v2, s1
17002 ; GFX12-WGP-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
17003 ; GFX12-WGP-NEXT: v_mov_b32_e32 v0, s0
17004 ; GFX12-WGP-NEXT: s_wait_dscnt 0x0
17005 ; GFX12-WGP-NEXT: ds_store_b32 v0, v1
17006 ; GFX12-WGP-NEXT: s_endpgm
17008 ; GFX12-CU-LABEL: local_singlethread_one_as_seq_cst_seq_cst_ret_cmpxchg:
17009 ; GFX12-CU: ; %bb.0: ; %entry
17010 ; GFX12-CU-NEXT: s_mov_b64 s[4:5], s[2:3]
17011 ; GFX12-CU-NEXT: s_load_b32 s0, s[4:5], 0x0
17012 ; GFX12-CU-NEXT: s_load_b32 s2, s[4:5], 0x4
17013 ; GFX12-CU-NEXT: s_load_b32 s1, s[4:5], 0x8
17014 ; GFX12-CU-NEXT: s_wait_kmcnt 0x0
17015 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
17016 ; GFX12-CU-NEXT: v_mov_b32_e32 v1, s2
17017 ; GFX12-CU-NEXT: v_mov_b32_e32 v2, s1
17018 ; GFX12-CU-NEXT: ds_cmpstore_rtn_b32 v1, v0, v1, v2 offset:16
17019 ; GFX12-CU-NEXT: v_mov_b32_e32 v0, s0
17020 ; GFX12-CU-NEXT: s_wait_dscnt 0x0
17021 ; GFX12-CU-NEXT: ds_store_b32 v0, v1
17022 ; GFX12-CU-NEXT: s_endpgm
17023 ptr addrspace(3) %out, i32 %in, i32 %old) {
17025 %gep = getelementptr i32, ptr addrspace(3) %out, i32 4
17026 %val = cmpxchg volatile ptr addrspace(3) %gep, i32 %old, i32 %in syncscope("singlethread-one-as") seq_cst seq_cst
17027 %val0 = extractvalue { i32, i1 } %val, 0
17028 store i32 %val0, ptr addrspace(3) %out, align 4